SDN Controller Blueprints Data Adaptor 47/64547/1
authorSingal, Kapil (ks220y) <ks220y@att.com>
Wed, 5 Sep 2018 01:22:01 +0000 (21:22 -0400)
committerSingal, Kapil (ks220y) <ks220y@att.com>
Wed, 5 Sep 2018 01:22:01 +0000 (21:22 -0400)
Formatting, Organizing Imports, Code Cleanup for SDN Controller Blueprints Data Adaptor Component

Change-Id: I029da1d9660129ae3415429661d37b9ea13bcb8b
Issue-ID: CCSDK-495
Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
66 files changed:
blueprints-processor/.gitignore
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/ConfigDataAdaptorException.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/DataAdaptorConstants.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDao.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigResourceDao.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigResourceDaoImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/NamedQueryExecutorDao.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/NamedQueryExecutorDaoImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/QueryExecutorDao.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/QueryExecutorDaoImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/TransactionLogDao.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/TransactionLogDaoImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/db/DataSourceWrap.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/domain/ConfigPropertyMapData.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/domain/ConfigResource.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/domain/ResourceAssignmentData.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/domain/TransactionLog.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/service/ConfigResourceNode.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/service/ConfigResourceService.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/service/ConfigResourceServiceImpl.java
blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigResourceDaoTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigTransactionLogDaoTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/dao/QueryExecutorDaoTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/service/ConfigResourceNodeTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/config/data/adaptor/service/ConfigResourceServiceTest.java
blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/log4j.properties
blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context-h2db.xml
blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context.xml
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorConstants.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/ConfigRestAdaptorException.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/data/RestResponse.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/AbstractConfigRestClientAdapter.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorService.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/ConfigRestClientServiceAdapter.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/GenericRestClientAdapterImpl.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/service/SSLRestClientAdapterImpl.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/BasicAuthorizationInterceptor.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/config/rest/adaptor/utils/LoggingRequestInterceptor.java
blueprints-processor/adaptors/rest-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/config/rest/adaptor/service/AbstractConfigRestClientAdapterTest.java
blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/config/rest/adaptor/service/GenericRestClientServiceTest.java
blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/config/rest/adaptor/service/SSLClientServiceTest.java
blueprints-processor/adaptors/rest-adaptor-provider/src/test/java/org/onap/ccsdk/config/rest/adaptor/utils/RestTemplateFactoryTest.java
blueprints-processor/adaptors/rest-adaptor-provider/src/test/resources/config-rest-adaptor.properties
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/ConfigAssignmentConstants.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/data/ResourceAssignmentData.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/processor/ProcessorFactory.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/processor/ResourceAssignmentProcessor.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentPersistService.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentProcessService.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentService.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentServiceImpl.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigAssignmentUtils.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ConfigPreviewService.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ResourceDictionaryService.java
blueprints-processor/plugin/assignment-provider/src/main/java/org/onap/ccsdk/config/assignment/service/ResourceModelService.java
blueprints-processor/plugin/assignment-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigPreviewServiceTest.java
blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ConfigResourceAssignmentTestUtils.java
blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ResourceAssignmentGenerationTest.java
blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/ResourceAssignmentValidation.java
blueprints-processor/plugin/assignment-provider/src/test/java/org/onap/ccsdk/config/assignment/service/TopologicalSortingTest.java

index 781272f..dcf24b5 100644 (file)
@@ -1,30 +1,30 @@
-# Target dir in all projects
-**/target/*
-**/target-ide/*
-
-# Logs dir in all projects
-**/logs/*
-**/debug-logs/*
-
-# Added for Intellij IDEA IDE
-**/.idea/*
-
-# Generated models and features
-**/bin/*
-
-# MANIFEST.MF is updated on every clean install
-**/src/main/resources/META-INF/
-**/src/main/yang-gen-sal
-**/src/main/yang-gen-config
-
-
-**/pom.xml.versionsBackup
-**/.flattened-pom.xml
-**/.pydevproject
-**/.settings
-**/.classpath
-**/.project
-
-**/*.class
-**/*.prefs
+# Target dir in all projects\r
+**/target/*\r
+**/target-ide/*\r
+\r
+# Logs dir in all projects\r
+**/logs/*\r
+**/debug-logs/*\r
+\r
+# Added for Intellij IDEA IDE\r
+**/.idea/*\r
+\r
+# Generated models and features\r
+**/bin/*\r
+\r
+# MANIFEST.MF is updated on every clean install\r
+**/src/main/resources/META-INF/\r
+**/src/main/yang-gen-sal\r
+**/src/main/yang-gen-config\r
+\r
+\r
+**/pom.xml.versionsBackup\r
+**/.flattened-pom.xml\r
+**/.pydevproject\r
+**/.settings\r
+**/.classpath\r
+**/.project\r
+\r
+**/*.class\r
+**/*.prefs\r
 **/*.iml
\ No newline at end of file
index c794b5d..cd4ac27 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor;\r
@@ -20,12 +23,12 @@ package org.onap.ccsdk.config.data.adaptor;
  * @version 1.0\r
  */\r
 public class ConfigDataAdaptorException extends Exception {\r
-    \r
+\r
     /**\r
      *\r
      */\r
     private static final long serialVersionUID = 1L;\r
-    \r
+\r
     /**\r
      * This is a ConfigDataAdaptorException constructor\r
      *\r
@@ -34,7 +37,7 @@ public class ConfigDataAdaptorException extends Exception {
     public ConfigDataAdaptorException(String message) {\r
         super(message);\r
     }\r
-    \r
+\r
     /**\r
      * This is a ConfigDataAdaptorException constructor\r
      *\r
@@ -43,5 +46,5 @@ public class ConfigDataAdaptorException extends Exception {
     public ConfigDataAdaptorException(String message, Throwable cause) {\r
         super(message, cause);\r
     }\r
-    \r
+\r
 }\r
index c942ed6..6a61370 100644 (file)
@@ -1,29 +1,32 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor;\r
 \r
 @SuppressWarnings("squid:S1118")\r
 public class DataAdaptorConstants {\r
-    \r
+\r
     public static final String OUTPUT_STATUS_SUCCESS = "success";\r
     public static final String OUTPUT_STATUS_FAILURE = "failure";\r
-    \r
+\r
     public static final String PROPERTY_ENV_TYPE = "org.onap.ccsdk.config.rest.adaptors.envtype";\r
     public static final String PROPERTY_ENV_PROD = "field";\r
     public static final String PROPERTY_ENV_SOLO = "solo";\r
-    \r
+\r
     public static final String INPUT_PARAM_TAGS = "tags";\r
     public static final String INPUT_PARAM_CAPABILITY_NAME = "capabilityName";\r
     public static final String INPUT_PARAM_MESSAGE = "message";\r
@@ -35,39 +38,39 @@ public class DataAdaptorConstants {
     public static final String INPUT_PARAM_ASDC_ARTIFACT_IND = "asdcArtifactInd";\r
     public static final Object INPUT_PARAM_VNF_ID = "vnfId";\r
     public static final Object INPUT_PARAM_VM_NAME = "vmName";\r
-    \r
+\r
     public static final Object INPUT_PARAM_CONFIG_CONTENT_TYPE = "configContentType";\r
-    \r
+\r
     public static final Object INPUT_PARAM_CONFIG_CONTENT = "configContent";\r
     public static final Object INPUT_PARAM_CONFIG_INDICATOR = "configIndicator";\r
-    \r
+\r
     public static final Object CONFIG_CONTENT_TYPE_CONFIGURATION = "Configuration";\r
     public static final Object CONFIG_CONTENT_TYPE_PARAMETERS = "Parameters";\r
     public static final Object CONFIG_INDICATOR_PREPARE = "Prepare";\r
     public static final Object CONFIG_INDICATOR_ACTIVE = "Active";\r
-    \r
+\r
     public static final String INPUT_PARAM_RESPONSE_PRIFIX = "response-prefix";\r
     public static final String INPUT_PARAM_VNF_TYPE = "vnfType";\r
     public static final String INPUT_PARAM_VNFC_TYPE = "vnfcType";\r
     public static final String INPUT_PARAM_ACTION = "action";\r
     public static final String INPUT_PARAM_API_VERSION = "apiVersion";\r
-    \r
+\r
     public static final String INPUT_PARAM_FILE_ID = "fileId";\r
     public static final String INPUT_PARAM_UPLOAD_CONFIG_ID = "uploadConfigId";\r
     public static final String FILE_CATEGORY_SERVICE_TEMPLATE = "service_template";\r
-    \r
+\r
     public static final String ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL";\r
-    \r
+\r
     public static final String LOG_MESSAGE_TYPE_LOG = "Log";\r
     public static final String LOG_MESSAGE_TYPE_COMPONENT = "Component";\r
     public static final String LOG_MESSAGE_TYPE_REQUEST = "Request";\r
     public static final String LOG_MESSAGE_TYPE_MODEL = "Model";\r
     public static final String LOG_MESSAGE_TYPE_DATA = "Data";\r
     public static final String LOG_MESSAGE_TYPE_CONFIG = "Config";\r
-    \r
+\r
     public static final String SELF_SERVICE_STATUS_RECEIVED = "Received";\r
     public static final String SELF_SERVICE_STATUS_ACKNOWLEDGED = "Acknowledged";\r
     public static final String SELF_SERVICE_STATUS_REPLIED = "Replied";\r
     public static final String SELF_SERVICE_STATUS_FAILED = "Failed";\r
-    \r
+\r
 }\r
index e1b25be..2bf9682 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -17,7 +20,7 @@ package org.onap.ccsdk.config.data.adaptor.dao;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
 \r
 public interface ConfigPropertyMapDao {\r
-    \r
+\r
     /**\r
      * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key.\r
      *\r
@@ -26,5 +29,5 @@ public interface ConfigPropertyMapDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails\r
      */\r
     public String getConfigPropertyByKey(String key) throws SvcLogicException;\r
-    \r
+\r
 }\r
index 84c96a8..423e014 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -28,16 +31,16 @@ import com.att.eelf.configuration.EELFManager;
 import com.google.common.base.Preconditions;\r
 \r
 public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigPropertyMapDaoImpl.class);\r
-    \r
+\r
     private JdbcTemplate jdbcTemplate;\r
     private Map<String, String> configPropertyMap = new ConcurrentHashMap<>();\r
-    \r
+\r
     public ConfigPropertyMapDaoImpl(JdbcTemplate jdbcTemplate) {\r
         this.jdbcTemplate = jdbcTemplate;\r
         initializeMap();\r
-        \r
+\r
         String envType = configPropertyMap.get(DataAdaptorConstants.PROPERTY_ENV_TYPE);\r
         if (!(DataAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType)\r
                 || DataAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) {\r
@@ -48,7 +51,7 @@ public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao {
             executor.scheduleWithFixedDelay(task, 60, 15, TimeUnit.MINUTES);\r
         }\r
     }\r
-    \r
+\r
     private void initializeMap() {\r
         String getPropQuery = "SELECT * FROM CONFIG_PROPERTY_MAP";\r
         jdbcTemplate.queryForList(getPropQuery).forEach(rows -> {\r
@@ -58,11 +61,11 @@ public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao {
         });\r
         logger.trace("loaded configPropertyMap : ({})", configPropertyMap);\r
     }\r
-    \r
+\r
     @Override\r
     public String getConfigPropertyByKey(String key) throws SvcLogicException {\r
         Preconditions.checkArgument(StringUtils.isNotBlank(key), "missing property key");\r
         return configPropertyMap.get(key);\r
     }\r
-    \r
+\r
 }\r
index 98f2647..6362886 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -19,7 +22,7 @@ import org.onap.ccsdk.config.data.adaptor.domain.ConfigResource;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
 \r
 public interface ConfigResourceDao {\r
-    \r
+\r
     /**\r
      * Issue a single SQL Insert operation for CONFIG_RESOURCE table via a prepared statement, binding\r
      * the given arguments.\r
@@ -29,7 +32,7 @@ public interface ConfigResourceDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert\r
      */\r
     public ConfigResource save(ConfigResource configResourceInput) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue a single SQL Delete operation for CONFIG_RESOURCE table via a prepared statement, binding\r
      * the given arguments.\r
@@ -39,7 +42,7 @@ public interface ConfigResourceDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert\r
      */\r
     public void deleteByConfigResource(ConfigResource configResourceInput) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_RESOURCE table for given input param to create a prepared statement to bind to the\r
      * query, mapping each row to a Java object via a ConfigResource RowMapper.\r
@@ -50,6 +53,6 @@ public interface ConfigResourceDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<ConfigResource> findByConfigResource(ConfigResource configResourceInput) throws SvcLogicException;\r
-    \r
+\r
     public ConfigResource getConfigResource(ConfigResource configResource) throws SvcLogicException;\r
 }\r
index 88cb78c..42cbbd1 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -29,38 +32,38 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ConfigResourceDaoImpl implements ConfigResourceDao {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceDaoImpl.class);\r
-    \r
+\r
     private JdbcTemplate jdbcTemplate;\r
-    \r
+\r
     public ConfigResourceDaoImpl(JdbcTemplate jdbcTemplate) {\r
         this.jdbcTemplate = jdbcTemplate;\r
     }\r
-    \r
+\r
     @Override\r
     public ConfigResource save(ConfigResource configResource) throws SvcLogicException {\r
-        \r
+\r
         ConfigResource dbConfigResource = checkConfigResource(configResource);\r
-        \r
+\r
         if (dbConfigResource != null && StringUtils.isNotBlank(dbConfigResource.getConfigResourceId())) {\r
             configResource.setConfigResourceId(dbConfigResource.getConfigResourceId());\r
-            \r
+\r
             validateConfigResource(configResource);\r
-            \r
+\r
             update(configResource);\r
-            \r
+\r
             saveConfigResourceAssignmentData(configResource);\r
         } else {\r
             String addQuery = "INSERT INTO CONFIG_RESOURCE "\r
                     + "( config_resource_id, resource_id, resource_type, service_template_name, service_template_version,"\r
                     + "template_name, recipe_name, request_id, resource_data, mask_data, status, created_date, updated_by ) "\r
                     + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";\r
-            \r
+\r
             configResource.setConfigResourceId(configResource.getUniqueId());\r
-            \r
+\r
             validateConfigResource(configResource);\r
-            \r
+\r
             logger.info("saving config resource ({}) ...", configResource);\r
             jdbcTemplate.update(addQuery, configResource.getConfigResourceId(), configResource.getResourceId(),\r
                     configResource.getResourceType(), configResource.getServiceTemplateName(),\r
@@ -68,13 +71,13 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
                     configResource.getRecipeName(), configResource.getRequestId(), configResource.getResourceData(),\r
                     configResource.getMaskData(), configResource.getStatus(), configResource.getCreatedDate(),\r
                     configResource.getUpdatedBy());\r
-            \r
+\r
             saveConfigResourceAssignmentData(configResource);\r
         }\r
         dbConfigResource = getConfigResource(configResource);\r
         return dbConfigResource;\r
     }\r
-    \r
+\r
     private void update(ConfigResource configResource) throws SvcLogicException {\r
         if (StringUtils.isNotBlank(configResource.getConfigResourceId())) {\r
             logger.info("updating config resource ({}) ...", configResource);\r
@@ -82,7 +85,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             String updateQuery = "UPDATE CONFIG_RESOURCE SET "\r
                     + "resource_data = ?, mask_data = ?, created_date = ?, updated_by = ? ,service_template_name = ?, service_template_version = ? "\r
                     + "where config_resource_id = ?";\r
-            \r
+\r
             jdbcTemplate.update(updateQuery, configResource.getResourceData(), configResource.getMaskData(),\r
                     configResource.getCreatedDate(), configResource.getUpdatedBy(),\r
                     configResource.getServiceTemplateName(), configResource.getServiceTemplateVersion(),\r
@@ -91,7 +94,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             throw new SvcLogicException("missing config resource id to update.");\r
         }\r
     }\r
-    \r
+\r
     private void saveConfigResourceAssignmentData(ConfigResource configResource) {\r
         if (configResource != null && StringUtils.isNotBlank(configResource.getConfigResourceId())) {\r
             List<Object> listOfArguments = new ArrayList<>();\r
@@ -100,7 +103,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             this.jdbcTemplate.update(deleteQuery, listOfArguments.toArray());\r
             logger.info("config resource assignment data deleted successfully for the  config_resource_id ({})",\r
                     configResource.getConfigResourceId());\r
-            \r
+\r
             if (configResource.getResourceAssignments() != null) {\r
                 List<ResourceAssignmentData> resourceAssignments = configResource.getResourceAssignments();\r
                 for (ResourceAssignmentData resourceAssignmentData : resourceAssignments) {\r
@@ -112,13 +115,13 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             }\r
         }\r
     }\r
-    \r
+\r
     private ResourceAssignmentData saveResourceAssignmentData(ResourceAssignmentData resourceAssignmentData) {\r
         String addQuery = "INSERT INTO CONFIG_RESOURCE_ASSIGNMENT_DATA "\r
                 + "( config_resource_assignment_data_id, config_resource_id, version, updated_by, template_key_name, "\r
                 + "resource_name, data_type, entry_schema, resource_value, source, status, message ) "\r
                 + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";\r
-        \r
+\r
         logger.debug("saving config resource assignment data ({}) ... ", resourceAssignmentData);\r
         jdbcTemplate.update(addQuery, resourceAssignmentData.getId(), resourceAssignmentData.getConfigResourceId(),\r
                 resourceAssignmentData.getVersion(), resourceAssignmentData.getUpdatedBy(),\r
@@ -126,33 +129,33 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
                 resourceAssignmentData.getDataType(), resourceAssignmentData.getEntrySchema(),\r
                 resourceAssignmentData.getResourceValue(), resourceAssignmentData.getSource(),\r
                 resourceAssignmentData.getStatus(), resourceAssignmentData.getMessage());\r
-        \r
+\r
         return resourceAssignmentData;\r
     }\r
-    \r
+\r
     @Override\r
     public void deleteByConfigResource(ConfigResource configResourceInput) throws SvcLogicException {\r
         StringBuilder selectArtifactBuffer = new StringBuilder();\r
         List<Object> listOfArguments = new ArrayList<>();\r
-        \r
+\r
         selectArtifactBuffer.append("DELETE FROM CONFIG_RESOURCE WHERE config_resource_id = ? ");\r
         listOfArguments.add(configResourceInput.getConfigResourceId());\r
-        \r
+\r
         String queryString = selectArtifactBuffer.toString();\r
         this.jdbcTemplate.update(queryString, listOfArguments.toArray());\r
         logger.info("config resource ({}) deleted successfully ", configResourceInput);\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     @Override\r
     public List<ConfigResource> findByConfigResource(ConfigResource configResourceInput) throws SvcLogicException {\r
         StringBuilder selectArtifactBuffer = new StringBuilder();\r
         List<Object> listOfArguments = new ArrayList<>();\r
-        \r
+\r
         selectArtifactBuffer.append("SELECT * FROM CONFIG_RESOURCE WHERE ");\r
-        \r
+\r
         StringBuilder whereClauseRemaining = new StringBuilder();\r
-        \r
+\r
         if (configResourceInput.getServiceTemplateName() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -160,7 +163,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("service_template_name = ? ");\r
             listOfArguments.add(configResourceInput.getServiceTemplateName());\r
         }\r
-        \r
+\r
         if (configResourceInput.getServiceTemplateVersion() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -168,7 +171,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("service_template_version = ? ");\r
             listOfArguments.add(configResourceInput.getServiceTemplateVersion());\r
         }\r
-        \r
+\r
         if (configResourceInput.getResourceId() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -176,7 +179,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("resource_id = ? ");\r
             listOfArguments.add(configResourceInput.getResourceId());\r
         }\r
-        \r
+\r
         if (configResourceInput.getResourceType() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -184,7 +187,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("resource_type = ? ");\r
             listOfArguments.add(configResourceInput.getResourceType());\r
         }\r
-        \r
+\r
         if (configResourceInput.getRequestId() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -192,7 +195,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("request_id = ? ");\r
             listOfArguments.add(configResourceInput.getRequestId());\r
         }\r
-        \r
+\r
         if (configResourceInput.getTemplateName() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -200,7 +203,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("template_name = ? ");\r
             listOfArguments.add(configResourceInput.getTemplateName());\r
         }\r
-        \r
+\r
         if (configResourceInput.getRecipeName() != null) {\r
             if (whereClauseRemaining.length() != 0) {\r
                 whereClauseRemaining.append("AND ");\r
@@ -208,14 +211,14 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             whereClauseRemaining.append("recipe_name = ? ");\r
             listOfArguments.add(configResourceInput.getRecipeName());\r
         }\r
-        \r
+\r
         String queryString = selectArtifactBuffer.toString() + whereClauseRemaining.toString();\r
         logger.info("config resource queryString ({})", queryString);\r
         List<ConfigResource> configResources =\r
                 this.jdbcTemplate.query(queryString, listOfArguments.toArray(), new ConfigResourceMapper());\r
-        \r
+\r
         List<ConfigResource> returnConfigResources = new ArrayList<>();\r
-        \r
+\r
         if (configResources != null) {\r
             for (ConfigResource configResource : configResources) {\r
                 if (configResource != null) {\r
@@ -225,11 +228,11 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
         }\r
         return returnConfigResources;\r
     }\r
-    \r
+\r
     public ConfigResource checkConfigResource(ConfigResource configResource) {\r
         StringBuilder selectBuffer = new StringBuilder();\r
         List<Object> listOfArguments = new ArrayList<>();\r
-        \r
+\r
         selectBuffer.append(\r
                 "SELECT * FROM CONFIG_RESOURCE WHERE resource_id = ? AND resource_type = ? AND template_name = ? ");\r
         listOfArguments.add(configResource.getResourceId());\r
@@ -237,7 +240,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
         listOfArguments.add(configResource.getTemplateName());\r
         return queryOneForObject(selectBuffer.toString(), listOfArguments.toArray(), new ConfigResourceMapper());\r
     }\r
-    \r
+\r
     @Override\r
     public ConfigResource getConfigResource(ConfigResource configResource) throws SvcLogicException {\r
         ConfigResource dbConfigResource = checkConfigResource(configResource);\r
@@ -248,7 +251,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
         }\r
         return configResource;\r
     }\r
-    \r
+\r
     private List<ResourceAssignmentData> getResourceAssignmentdata(String configResourceId) {\r
         List<Object> listOfArguments = new ArrayList<>();\r
         String queryString = "SELECT * FROM CONFIG_RESOURCE_ASSIGNMENT_DATA WHERE config_resource_id = ? ";\r
@@ -256,32 +259,32 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
         listOfArguments.add(configResourceId);\r
         return this.jdbcTemplate.query(queryString, listOfArguments.toArray(), new ResourceAssignmentDataMapper());\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     private boolean validateConfigResource(ConfigResource configResource) throws SvcLogicException {\r
         if (configResource == null) {\r
             throw new SvcLogicException("config resource information is missing.");\r
         }\r
-        \r
+\r
         if (StringUtils.isBlank(configResource.getConfigResourceId())) {\r
             throw new SvcLogicException("config resource id is missing.");\r
         }\r
-        \r
+\r
         if (StringUtils.isBlank(configResource.getResourceType())) {\r
             throw new SvcLogicException("config resource type is missing.");\r
         }\r
         if (StringUtils.isBlank(configResource.getResourceId())) {\r
             throw new SvcLogicException("config resource  resource id is missing.");\r
         }\r
-        \r
+\r
         if (StringUtils.isBlank(configResource.getRecipeName())) {\r
             throw new SvcLogicException("config resource action name is missing.");\r
         }\r
-        \r
+\r
         if (StringUtils.isBlank(configResource.getTemplateName())) {\r
             throw new SvcLogicException("config resource template name is missing.");\r
         }\r
-        \r
+\r
         if (configResource.getResourceAssignments() != null) {\r
             List<ResourceAssignmentData> resourceAssignments = configResource.getResourceAssignments();\r
             for (ResourceAssignmentData resourceAssignmentData : resourceAssignments) {\r
@@ -306,15 +309,15 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
                     if (resourceAssignmentData.getResourceValue() == null) {\r
                         resourceAssignmentData.setResourceValue("");\r
                     }\r
-                    \r
+\r
                     validateResourceAssignmentData(resourceAssignmentData);\r
                 }\r
             }\r
         }\r
-        \r
+\r
         return true;\r
     }\r
-    \r
+\r
     private boolean validateResourceAssignmentData(ResourceAssignmentData resourceAssignmentData)\r
             throws SvcLogicException {\r
         if (resourceAssignmentData == null) {\r
@@ -357,7 +360,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
         }\r
         return true;\r
     }\r
-    \r
+\r
     private <T> T queryOneForObject(String sql, Object[] args, RowMapper<T> rowMapper) {\r
         List<T> results = this.jdbcTemplate.query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));\r
         if (results != null && !results.isEmpty()) {\r
@@ -366,7 +369,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             return null;\r
         }\r
     }\r
-    \r
+\r
     class ConfigResourceMapper implements RowMapper<ConfigResource> {\r
         @Override\r
         public ConfigResource mapRow(ResultSet rs, int rowNum) throws SQLException {\r
@@ -387,7 +390,7 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             return configResource;\r
         }\r
     }\r
-    \r
+\r
     class ResourceAssignmentDataMapper implements RowMapper<ResourceAssignmentData> {\r
         @Override\r
         public ResourceAssignmentData mapRow(ResultSet rs, int rowNum) throws SQLException {\r
@@ -408,5 +411,5 @@ public class ConfigResourceDaoImpl implements ConfigResourceDao {
             return resourceAssignmentData;\r
         }\r
     }\r
-    \r
+\r
 }\r
index d8d5090..4cebb30 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -24,7 +27,7 @@ public interface NamedQueryExecutorDao {
      * Return NamedParameterJdbcTemplate object.\r
      */\r
     public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the\r
      * query, expecting a result list.\r
@@ -39,7 +42,7 @@ public interface NamedQueryExecutorDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue an update via a prepared statement, binding the given arguments.\r
      *\r
@@ -50,5 +53,5 @@ public interface NamedQueryExecutorDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update\r
      */\r
     public int update(String sql, Map<String, Object> parameters) throws SvcLogicException;\r
-    \r
+\r
 }\r
index bbb12cf..bcfe6b6 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -25,26 +28,26 @@ import com.att.eelf.configuration.EELFManager;
 public class NamedQueryExecutorDaoImpl implements NamedQueryExecutorDao {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);\r
     private static final String CLASS_NAME = "NamedQueryExecutorDaoImpl";\r
-    \r
+\r
     @Autowired(required = true)\r
     private NamedParameterJdbcTemplate namedParameterJdbcTemplate;\r
-    \r
+\r
     public NamedQueryExecutorDaoImpl(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {\r
         this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;\r
         logger.info("{} Constructor initialised..", CLASS_NAME);\r
     }\r
-    \r
+\r
     @Override\r
     public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {\r
         logger.debug("Query  ({}) with parameters ({})", sql, parameters);\r
         return namedParameterJdbcTemplate.queryForList(sql, parameters);\r
     }\r
-    \r
+\r
     @Override\r
     public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {\r
         return namedParameterJdbcTemplate;\r
     }\r
-    \r
+\r
     @Override\r
     public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {\r
         logger.debug("update ({}) with parameters ({})", sql, parameters);\r
index f66cd4a..0c39524 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -19,7 +22,7 @@ import java.util.Map;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
 \r
 public interface QueryExecutorDao {\r
-    \r
+\r
     /**\r
      * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the\r
      * query, expecting a result list.\r
@@ -35,7 +38,7 @@ public interface QueryExecutorDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue a single SQL update operation (such as an insert, update or delete statement) via a\r
      * prepared statement, binding the given arguments.\r
@@ -47,5 +50,5 @@ public interface QueryExecutorDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update\r
      */\r
     public int update(String sql, Object[] data) throws SvcLogicException;\r
-    \r
+\r
 }\r
index bc3901a..076ec1d 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -23,28 +26,28 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class QueryExecutorDaoImpl implements QueryExecutorDao {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);\r
     private static final String CLASS_NAME = "QueryExecutorDaoImpl";\r
-    \r
+\r
     @Autowired(required = true)\r
     private JdbcTemplate jdbcTemplate;\r
-    \r
+\r
     public QueryExecutorDaoImpl(JdbcTemplate jdbcTemplate) {\r
         this.jdbcTemplate = jdbcTemplate;\r
         logger.info("{} Constructor initialised..", CLASS_NAME);\r
     }\r
-    \r
+\r
     @Override\r
     public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {\r
         logger.debug("Query  ({}) with data ({})", sql, data);\r
         return jdbcTemplate.queryForList(sql, data);\r
     }\r
-    \r
+\r
     @Override\r
     public int update(String sql, Object[] data) throws SvcLogicException {\r
         logger.debug("Query  ({}) with data ({})", sql, data);\r
         return jdbcTemplate.update(sql, data);\r
     }\r
-    \r
+\r
 }\r
index f87dbb7..c4747e2 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -19,7 +22,7 @@ import org.onap.ccsdk.config.data.adaptor.domain.TransactionLog;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
 \r
 public interface TransactionLogDao {\r
-    \r
+\r
     /**\r
      * Issue a single SQL Insert operation for CONFIG_TRANSACTION_LOG table via a prepared statement,\r
      * binding the given arguments.\r
@@ -29,7 +32,7 @@ public interface TransactionLogDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert\r
      */\r
     public void save(TransactionLog transactionLog) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a\r
      * TransactionLog RowMapper.\r
@@ -40,7 +43,7 @@ public interface TransactionLogDao {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a\r
      * TransactionLog RowMapper.\r
@@ -54,5 +57,5 @@ public interface TransactionLogDao {
      */\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)\r
             throws SvcLogicException;\r
-    \r
+\r
 }\r
index 88d9c84..fd3d810 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -26,15 +29,15 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class TransactionLogDaoImpl implements TransactionLogDao {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(TransactionLogDaoImpl.class);\r
-    \r
+\r
     private JdbcTemplate jdbcTemplate;\r
-    \r
+\r
     public TransactionLogDaoImpl(JdbcTemplate jdbcTemplate) {\r
         this.jdbcTemplate = jdbcTemplate;\r
     }\r
-    \r
+\r
     @Override\r
     public void save(TransactionLog transactionLog) throws SvcLogicException {\r
         if (transactionLog != null && StringUtils.isNotBlank(transactionLog.getRequestId())) {\r
@@ -44,9 +47,9 @@ public class TransactionLogDaoImpl implements TransactionLogDao {
                     transactionLog.getMessageType(), transactionLog.getMessage());\r
             logger.trace("TransactionLog Updated Successfully for message_type {}", transactionLog.getMessageType());\r
         }\r
-        \r
+\r
     }\r
-    \r
+\r
     @Override\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {\r
         if (StringUtils.isNotBlank(requestId)) {\r
@@ -57,7 +60,7 @@ public class TransactionLogDaoImpl implements TransactionLogDao {
             throw new SvcLogicException("TransactionLog Request id  (" + requestId + ")is missing ");\r
         }\r
     }\r
-    \r
+\r
     @Override\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)\r
             throws SvcLogicException {\r
@@ -70,7 +73,7 @@ public class TransactionLogDaoImpl implements TransactionLogDao {
             throw new SvcLogicException("TransactionLog Request id  (" + requestId + ")is missing ");\r
         }\r
     }\r
-    \r
+\r
     private static final class TransactionLogMapper implements RowMapper<TransactionLog> {\r
         @Override\r
         public TransactionLog mapRow(ResultSet rs, int rowNum) throws SQLException {\r
@@ -83,5 +86,5 @@ public class TransactionLogDaoImpl implements TransactionLogDao {
             return transactionLog;\r
         }\r
     }\r
-    \r
+\r
 }\r
index 888bdcb..18ca945 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.db;\r
@@ -23,51 +26,51 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class DataSourceWrap implements DataSource {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(DataSourceWrap.class);\r
-    \r
+\r
     private DataSource dataSource;\r
-    \r
+\r
     public DataSourceWrap(DataSource dataSource) {\r
         logger.info("Setting Data Source {} ", dataSource);\r
         this.dataSource = dataSource;\r
     }\r
-    \r
+\r
     @Override\r
     public PrintWriter getLogWriter() throws SQLException {\r
         return dataSource.getLogWriter();\r
     }\r
-    \r
+\r
     @Override\r
     public void setLogWriter(PrintWriter out) throws SQLException {\r
         dataSource.setLogWriter(out);\r
     }\r
-    \r
+\r
     @Override\r
     public void setLoginTimeout(int seconds) throws SQLException {\r
         dataSource.setLoginTimeout(seconds);\r
     }\r
-    \r
+\r
     @Override\r
     public int getLoginTimeout() throws SQLException {\r
         return dataSource.getLoginTimeout();\r
     }\r
-    \r
+\r
     @Override\r
     public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {\r
         return dataSource.getParentLogger();\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T unwrap(Class<T> iface) throws SQLException {\r
         return dataSource.unwrap(iface);\r
     }\r
-    \r
+\r
     @Override\r
     public boolean isWrapperFor(Class<?> iface) throws SQLException {\r
         return dataSource.isWrapperFor(iface);\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S2095")\r
     @Override\r
     public Connection getConnection() throws SQLException {\r
@@ -76,7 +79,7 @@ public class DataSourceWrap implements DataSource {
         c.setAutoCommit(true);\r
         return c;\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S2095")\r
     @Override\r
     public Connection getConnection(String username, String pass) throws SQLException {\r
@@ -84,5 +87,5 @@ public class DataSourceWrap implements DataSource {
         c.setAutoCommit(true);\r
         return c;\r
     }\r
-    \r
+\r
 }\r
index 6cc796e..7d6bff9 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.domain;\r
@@ -18,29 +21,29 @@ import java.io.Serializable;
 \r
 public class ConfigPropertyMapData implements Serializable {\r
     private static final long serialVersionUID = 1L;\r
-    \r
+\r
     private String referenceKey;\r
     private String referenceValue;\r
-    \r
+\r
     public String getReferenceKey() {\r
         return referenceKey;\r
     }\r
-    \r
+\r
     public void setReferenceKey(String referenceKey) {\r
         this.referenceKey = referenceKey;\r
     }\r
-    \r
+\r
     public String getReferenceValue() {\r
         return referenceValue;\r
     }\r
-    \r
+\r
     public void setReferenceValue(String referenceValue) {\r
         this.referenceValue = referenceValue;\r
     }\r
-    \r
+\r
     @Override\r
     public String toString() {\r
         return "ConfigPropertyMapData [referenceKey=" + referenceKey + ", referenceValue=" + referenceValue + "]";\r
     }\r
-    \r
+\r
 }\r
index 2e46198..c8394a7 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.domain;\r
@@ -24,7 +27,7 @@ public class ConfigResource implements Serializable {
      *\r
      */\r
     private static final long serialVersionUID = 1L;\r
-    \r
+\r
     private String configResourceId;\r
     private String resourceId;\r
     private String resourceType;\r
@@ -39,119 +42,119 @@ public class ConfigResource implements Serializable {
     private String status;\r
     private String updatedBy;\r
     private List<ResourceAssignmentData> resourceAssignments;\r
-    \r
+\r
     public String getConfigResourceId() {\r
         return configResourceId;\r
     }\r
-    \r
+\r
     public void setConfigResourceId(String configResourceId) {\r
         this.configResourceId = configResourceId;\r
     }\r
-    \r
+\r
     public String getResourceId() {\r
         return resourceId;\r
     }\r
-    \r
+\r
     public void setResourceId(String resourceId) {\r
         this.resourceId = resourceId;\r
     }\r
-    \r
+\r
     public String getResourceType() {\r
         return resourceType;\r
     }\r
-    \r
+\r
     public void setResourceType(String resourceType) {\r
         this.resourceType = resourceType;\r
     }\r
-    \r
+\r
     public String getServiceTemplateName() {\r
         return serviceTemplateName;\r
     }\r
-    \r
+\r
     public void setServiceTemplateName(String serviceTemplateName) {\r
         this.serviceTemplateName = serviceTemplateName;\r
     }\r
-    \r
+\r
     public String getServiceTemplateVersion() {\r
         return serviceTemplateVersion;\r
     }\r
-    \r
+\r
     public void setServiceTemplateVersion(String serviceTemplateVersion) {\r
         this.serviceTemplateVersion = serviceTemplateVersion;\r
     }\r
-    \r
+\r
     public String getTemplateName() {\r
         return templateName;\r
     }\r
-    \r
+\r
     public void setTemplateName(String templateName) {\r
         this.templateName = templateName;\r
     }\r
-    \r
+\r
     public String getRecipeName() {\r
         return recipeName;\r
     }\r
-    \r
+\r
     public void setRecipeName(String recipeName) {\r
         this.recipeName = recipeName;\r
     }\r
-    \r
+\r
     public String getRequestId() {\r
         return requestId;\r
     }\r
-    \r
+\r
     public void setRequestId(String requestId) {\r
         this.requestId = requestId;\r
     }\r
-    \r
+\r
     public String getResourceData() {\r
         return resourceData;\r
     }\r
-    \r
+\r
     public void setResourceData(String resourceData) {\r
         this.resourceData = resourceData;\r
     }\r
-    \r
+\r
     public String getMaskData() {\r
         return maskData;\r
     }\r
-    \r
+\r
     public void setMaskData(String maskData) {\r
         this.maskData = maskData;\r
     }\r
-    \r
+\r
     public Date getCreatedDate() {\r
         return createdDate;\r
     }\r
-    \r
+\r
     public void setCreatedDate(Date createdDate) {\r
         this.createdDate = createdDate;\r
     }\r
-    \r
+\r
     public String getStatus() {\r
         return status;\r
     }\r
-    \r
+\r
     public void setStatus(String status) {\r
         this.status = status;\r
     }\r
-    \r
+\r
     public String getUpdatedBy() {\r
         return updatedBy;\r
     }\r
-    \r
+\r
     public void setUpdatedBy(String updatedBy) {\r
         this.updatedBy = updatedBy;\r
     }\r
-    \r
+\r
     public List<ResourceAssignmentData> getResourceAssignments() {\r
         return resourceAssignments;\r
     }\r
-    \r
+\r
     public void setResourceAssignments(List<ResourceAssignmentData> resourceAssignments) {\r
         this.resourceAssignments = resourceAssignments;\r
     }\r
-    \r
+\r
     @Override\r
     public String toString() {\r
         return "ConfigResource [configResourceId=" + configResourceId + ", resourceId=" + resourceId\r
@@ -160,9 +163,9 @@ public class ConfigResource implements Serializable {
                 + ", requestId=" + requestId + ", resourceData= ******** , maskData=" + maskData + ", createdDate="\r
                 + createdDate + ", updatedBy=" + updatedBy + "]";\r
     }\r
-    \r
+\r
     public String getUniqueId() {\r
         return UUID.randomUUID().toString();\r
     }\r
-    \r
+\r
 }\r
index c213326..75c1a49 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.domain;\r
@@ -19,7 +22,7 @@ import java.util.Date;
 import java.util.UUID;\r
 \r
 public class ResourceAssignmentData implements Serializable {\r
-    \r
+\r
     private static final long serialVersionUID = 1L;\r
     private String id;\r
     private String configResourceId;\r
@@ -34,11 +37,11 @@ public class ResourceAssignmentData implements Serializable {
     private String source;\r
     private String status;\r
     private String message;\r
-    \r
+\r
     public String getUniqueId() {\r
         return UUID.randomUUID().toString();\r
     }\r
-    \r
+\r
     @Override\r
     public String toString() {\r
         return "ResourceAssignmentData [id=" + id + ", configResourceId=" + configResourceId + ", version=" + version\r
@@ -46,109 +49,109 @@ public class ResourceAssignmentData implements Serializable {
                 + ", resourceName=" + resourceName + ", dataType=" + dataType + ", source=" + source + ", status="\r
                 + status + "]";\r
     }\r
-    \r
+\r
     public String getId() {\r
         return id;\r
     }\r
-    \r
+\r
     public void setId(String id) {\r
         this.id = id;\r
     }\r
-    \r
+\r
     public String getConfigResourceId() {\r
         return configResourceId;\r
     }\r
-    \r
+\r
     public void setConfigResourceId(String configResourceId) {\r
         this.configResourceId = configResourceId;\r
     }\r
-    \r
+\r
     public Integer getVersion() {\r
         return version;\r
     }\r
-    \r
+\r
     public void setVersion(Integer version) {\r
         this.version = version;\r
     }\r
-    \r
+\r
     public Date getUpdatedDate() {\r
         return updatedDate;\r
     }\r
-    \r
+\r
     public void setUpdatedDate(Date updatedDate) {\r
         this.updatedDate = updatedDate;\r
     }\r
-    \r
+\r
     public String getUpdatedBy() {\r
         return updatedBy;\r
     }\r
-    \r
+\r
     public void setUpdatedBy(String updatedBy) {\r
         this.updatedBy = updatedBy;\r
     }\r
-    \r
+\r
     public String getTemplateKeyName() {\r
         return templateKeyName;\r
     }\r
-    \r
+\r
     public void setTemplateKeyName(String templateKeyName) {\r
         this.templateKeyName = templateKeyName;\r
     }\r
-    \r
+\r
     public String getResourceName() {\r
         return resourceName;\r
     }\r
-    \r
+\r
     public void setResourceName(String resourceName) {\r
         this.resourceName = resourceName;\r
     }\r
-    \r
+\r
     public String getDataType() {\r
         return dataType;\r
     }\r
-    \r
+\r
     public void setDataType(String dataType) {\r
         this.dataType = dataType;\r
     }\r
-    \r
+\r
     public String getEntrySchema() {\r
         return entrySchema;\r
     }\r
-    \r
+\r
     public void setEntrySchema(String entrySchema) {\r
         this.entrySchema = entrySchema;\r
     }\r
-    \r
+\r
     public String getResourceValue() {\r
         return resourceValue;\r
     }\r
-    \r
+\r
     public void setResourceValue(String resourceValue) {\r
         this.resourceValue = resourceValue;\r
     }\r
-    \r
+\r
     public String getSource() {\r
         return source;\r
     }\r
-    \r
+\r
     public void setSource(String source) {\r
         this.source = source;\r
     }\r
-    \r
+\r
     public String getStatus() {\r
         return status;\r
     }\r
-    \r
+\r
     public void setStatus(String status) {\r
         this.status = status;\r
     }\r
-    \r
+\r
     public String getMessage() {\r
         return message;\r
     }\r
-    \r
+\r
     public void setMessage(String message) {\r
         this.message = message;\r
     }\r
-    \r
+\r
 }\r
index 3ae6ad3..77235d1 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.domain;\r
@@ -20,23 +23,23 @@ import java.util.UUID;
 \r
 public class TransactionLog implements Serializable {\r
     private static final long serialVersionUID = 1L;\r
-    \r
+\r
     private String transactionLogId;\r
     private String requestId;\r
     private String messageType;\r
     private Date creationDate;\r
     private String message;\r
-    \r
+\r
     public TransactionLog() {\r
-        \r
+\r
     }\r
-    \r
+\r
     public TransactionLog(String requestId, String messageType, String message) {\r
         this.requestId = requestId;\r
         this.messageType = messageType;\r
         this.message = message;\r
     }\r
-    \r
+\r
     @Override\r
     public String toString() {\r
         StringBuilder buffer = new StringBuilder("[");\r
@@ -47,49 +50,49 @@ public class TransactionLog implements Serializable {
         buffer.append("]");\r
         return buffer.toString();\r
     }\r
-    \r
+\r
     public String getTransactionLogId() {\r
         return transactionLogId;\r
     }\r
-    \r
+\r
     public void setTransactionLogId(String transactionLogId) {\r
         this.transactionLogId = transactionLogId;\r
     }\r
-    \r
+\r
     public String getRequestId() {\r
         return requestId;\r
     }\r
-    \r
+\r
     public void setRequestId(String requestId) {\r
         this.requestId = requestId;\r
     }\r
-    \r
+\r
     public String getMessageType() {\r
         return messageType;\r
     }\r
-    \r
+\r
     public void setMessageType(String messageType) {\r
         this.messageType = messageType;\r
     }\r
-    \r
+\r
     public Date getCreationDate() {\r
         return creationDate;\r
     }\r
-    \r
+\r
     public void setCreationDate(Date creationDate) {\r
         this.creationDate = creationDate;\r
     }\r
-    \r
+\r
     public String getMessage() {\r
         return message;\r
     }\r
-    \r
+\r
     public void setMessage(String message) {\r
         this.message = message;\r
     }\r
-    \r
+\r
     public String getUniqueId() {\r
         return UUID.randomUUID().toString();\r
     }\r
-    \r
+\r
 }\r
index e8f5817..f85da14 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.service;\r
@@ -23,30 +26,30 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;\r
 \r
 public class ConfigResourceNode implements SvcLogicJavaPlugin {\r
-    \r
+\r
     private ConfigResourceService configResourceService;\r
-    \r
+\r
     public ConfigResourceNode(ConfigResourceService configResourceService) {\r
         this.configResourceService = configResourceService;\r
     }\r
-    \r
+\r
     public void saveConfigTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {\r
         String responsePrefix = inParams.get(DataAdaptorConstants.INPUT_PARAM_RESPONSE_PRIFIX);\r
         try {\r
             responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";\r
-            \r
+\r
             String messageType = inParams.get(DataAdaptorConstants.INPUT_PARAM_MESSAGE_TYPE);\r
             String message = inParams.get(DataAdaptorConstants.INPUT_PARAM_MESSAGE);\r
             String requestId = ctx.getAttribute("request-id");\r
-            \r
+\r
             TransactionLog transactionLog = new TransactionLog();\r
-            \r
+\r
             transactionLog.setMessage(message);\r
             transactionLog.setMessageType(messageType);\r
             transactionLog.setRequestId(requestId);\r
-            \r
+\r
             configResourceService.save(transactionLog);\r
-            \r
+\r
         } catch (Exception e) {\r
             ctx.setAttribute(responsePrefix + DataAdaptorConstants.OUTPUT_PARAM_STATUS,\r
                     DataAdaptorConstants.OUTPUT_STATUS_FAILURE);\r
@@ -54,5 +57,5 @@ public class ConfigResourceNode implements SvcLogicJavaPlugin {
             throw new SvcLogicException("Failed in saveConfigTransactionLog :" + e.getMessage());\r
         }\r
     }\r
-    \r
+\r
 }\r
index f2b3fa7..b99b74f 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.service;\r
@@ -22,12 +25,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;\r
 \r
 public interface ConfigResourceService {\r
-    \r
+\r
     /**\r
      * Return NamedParameterJdbcTemplate object.\r
      */\r
     public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the\r
      * query, expecting a result list.\r
@@ -42,7 +45,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<Map<String, Object>> query(String sql, Map<String, Object> param) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue an update via a prepared statement, binding the given arguments.\r
      *\r
@@ -53,7 +56,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update\r
      */\r
     public int update(String sql, Map<String, Object> param) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the\r
      * query, expecting a result list.\r
@@ -68,7 +71,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue a single SQL update operation (such as an insert, update or delete statement) via a\r
      * prepared statement, binding the given arguments.\r
@@ -80,7 +83,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update\r
      */\r
     public int update(String sql, Object[] data) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue a single SQL Insert operation for CONFIG_TRANSACTION_LOG table via a prepared statement,\r
      * binding the given arguments.\r
@@ -90,7 +93,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert\r
      */\r
     public void save(TransactionLog transactionLog) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a\r
      * TransactionLog RowMapper.\r
@@ -101,7 +104,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_RESOURCE table for given input param to create a prepared statement to bind to the\r
      * query, mapping each row to a Java object via a ConfigResource RowMapper.\r
@@ -112,7 +115,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails\r
      */\r
     public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Issue a single SQL update operation (insert or update statement) for CONFIG_RESOURCE table via a\r
      * prepared statement, binding the given arguments.\r
@@ -122,7 +125,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert\r
      */\r
     public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key.\r
      *\r
@@ -131,7 +134,7 @@ public interface ConfigResourceService {
      * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails\r
      */\r
     public String getConfigPropertyByKey(String key) throws SvcLogicException;\r
-    \r
+\r
     /**\r
      * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a\r
      * TransactionLog RowMapper.\r
@@ -145,5 +148,5 @@ public interface ConfigResourceService {
      */\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)\r
             throws SvcLogicException;\r
-    \r
+\r
 }\r
index 77fbbe1..c880309 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.service;\r
@@ -31,18 +34,18 @@ import com.att.eelf.configuration.EELFManager;
 public class ConfigResourceServiceImpl implements ConfigResourceService {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceServiceImpl.class);\r
     private static final String CLASS_NAME = "ConfigResourceServiceImpl";\r
-    \r
+\r
     private TransactionLogDao transactionLogDao;\r
     private ConfigResourceDao configResourceDao;\r
     private QueryExecutorDao queryExecutorDao;\r
     private NamedQueryExecutorDao namedQueryExecutorDao;\r
     private ConfigPropertyMapDao configPropertyMapDao;\r
-    \r
+\r
     @SuppressWarnings("squid:S00107")\r
     public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao,\r
             QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao,\r
             ConfigPropertyMapDao configPropertyMapDao) {\r
-        \r
+\r
         logger.info("{} Constuctor Initated...", CLASS_NAME);\r
         this.transactionLogDao = transactionLogDao;\r
         this.configResourceDao = configResourceDao;\r
@@ -50,61 +53,61 @@ public class ConfigResourceServiceImpl implements ConfigResourceService {
         this.namedQueryExecutorDao = namedQueryExecutorDao;\r
         this.configPropertyMapDao = configPropertyMapDao;\r
     }\r
-    \r
+\r
     @Override\r
     public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException {\r
         return namedQueryExecutorDao.getNamedParameterJdbcTemplate();\r
     }\r
-    \r
+\r
     @Override\r
     public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {\r
         return namedQueryExecutorDao.query(sql, parameters);\r
     }\r
-    \r
+\r
     @Override\r
     public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {\r
         return namedQueryExecutorDao.update(sql, parameters);\r
     }\r
-    \r
+\r
     @Override\r
     public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {\r
         return queryExecutorDao.query(sql, data);\r
     }\r
-    \r
+\r
     @Override\r
     public int update(String sql, Object[] data) throws SvcLogicException {\r
         return queryExecutorDao.update(sql, data);\r
     }\r
-    \r
+\r
     @Override\r
     public void save(TransactionLog transactionLog) throws SvcLogicException {\r
         transactionLogDao.save(transactionLog);\r
     }\r
-    \r
+\r
     @Override\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {\r
         return transactionLogDao.getTransactionsByRequestId(requestId);\r
     }\r
-    \r
+\r
     @Override\r
     public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)\r
             throws SvcLogicException {\r
         return transactionLogDao.getTransactionsByRequestId(requestId, messageType);\r
     }\r
-    \r
+\r
     @Override\r
     public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException {\r
         return configResourceDao.findByConfigResource(configResource);\r
     }\r
-    \r
+\r
     @Override\r
     public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException {\r
         return configResourceDao.save(configResource);\r
     }\r
-    \r
+\r
     @Override\r
     public String getConfigPropertyByKey(String key) throws SvcLogicException {\r
         return configPropertyMapDao.getConfigPropertyByKey(key);\r
     }\r
-    \r
+\r
 }\r
index 445f623..4cf4d78 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
   Copyright © 2017-2018 AT&T Intellectual Property.\r
+  Modifications Copyright © 2018 IBM.\r
   \r
   Licensed under the Apache License, Version 2.0 (the "License");\r
   you may not use this file except in compliance with the License.\r
index 487bcd9..2873638 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -27,22 +30,22 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ConfigPropertyMapDaoTest {\r
-    \r
+\r
     @Autowired\r
     private ConfigPropertyMapDao configPropertyMapDao;\r
-    \r
+\r
     @Autowired\r
     private QueryExecutorDao queryExecutorDao;\r
-    \r
+\r
     @Test\r
     public void testConfigResourcesData() throws Exception {\r
         String sql = "INSERT INTO CONFIG_PROPERTY_MAP (reference_key, reference_value) VALUES ( ?, ?)";\r
         Object[] data = new Object[] {"dummy123", "username123"};\r
         int result = queryExecutorDao.update(sql, data);\r
         Assert.assertNotNull("Failed to get Query Result", result);\r
-        \r
+\r
         String propKeyValye = configPropertyMapDao.getConfigPropertyByKey("org.onap.ccsdk.config.rest.adaptors.test");\r
         Assert.assertNull("propKeyValue is null", propKeyValye);\r
     }\r
-    \r
+\r
 }\r
index ae493e6..0e57d3b 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -37,24 +40,24 @@ import com.att.eelf.configuration.EELFManager;
 @ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ConfigResourceDaoTest {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceDaoTest.class);\r
-    \r
+\r
     @Autowired\r
     private ConfigResourceDao configResourceDao;\r
-    \r
+\r
     @Before\r
     public void initialise() {\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test\r
     public void testAssignmentResourceData() throws Exception {\r
         ConfigResource configResource = new ConfigResource();\r
         String resourceData = IOUtils.toString(\r
                 ConfigResourceDaoTest.class.getClassLoader().getResourceAsStream("reference/resource_data.json"),\r
                 Charset.defaultCharset());\r
-        \r
+\r
         logger.trace("resourceData = " + resourceData);\r
         configResource.setResourceData(resourceData);\r
         configResource.setServiceTemplateName("sample-name");\r
@@ -68,7 +71,7 @@ public class ConfigResourceDaoTest {
         configResource.setStatus("success");\r
         configResource.setCreatedDate(new Date(System.currentTimeMillis()));\r
         configResource.setUpdatedBy("an188a");\r
-        \r
+\r
         List<ResourceAssignmentData> resourceAssignments = new ArrayList<>();\r
         ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();\r
         resourceAssignmentData.setDataType("string");\r
@@ -80,7 +83,7 @@ public class ConfigResourceDaoTest {
         resourceAssignmentData.setSource("input");\r
         resourceAssignments.add(resourceAssignmentData);\r
         configResource.setResourceAssignments(resourceAssignments);\r
-        \r
+\r
         ConfigResource dbConfigResource = configResourceDao.save(configResource);\r
         logger.info("Saved sucessfully : " + dbConfigResource.toString());\r
         Assert.assertNotNull("ConfigResource is null", dbConfigResource);\r
@@ -88,7 +91,7 @@ public class ConfigResourceDaoTest {
         Assert.assertEquals("Resource Assignment Data count missmatch", true,\r
                 dbConfigResource.getResourceAssignments().size() > 0);\r
     }\r
-    \r
+\r
     @Test\r
     public void testConfigResourcesData() throws Exception {\r
         ConfigResource configResourceInput = new ConfigResource();\r
@@ -96,7 +99,7 @@ public class ConfigResourceDaoTest {
         List<ConfigResource> dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);\r
         Assert.assertNotNull("ConfigResources is null", dbConfigResources);\r
         Assert.assertEquals("ConfigResources size missmatch", true, dbConfigResources.size() > 0);\r
-        \r
+\r
         for (ConfigResource configResource : dbConfigResources) {\r
             Assert.assertNotNull("ConfigResources Assignments is null", configResource.getResourceAssignments());\r
             Assert.assertTrue("ConfigResources Assignments size miss mathch ",\r
@@ -104,18 +107,18 @@ public class ConfigResourceDaoTest {
             logger.trace("ResourceAssignments = " + configResource.getResourceAssignments());\r
         }\r
     }\r
-    \r
+\r
     @Test\r
     public void testDeleteByConfigResource() throws Exception {\r
         ConfigResource configResourceInput = new ConfigResource();\r
         configResourceInput.setResourceId("123456");\r
-        \r
+\r
         List<ConfigResource> dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);\r
         Assert.assertTrue("ConfigResources is null", !dbConfigResources.isEmpty());\r
-        \r
+\r
         configResourceInput.setConfigResourceId(dbConfigResources.get(0).getConfigResourceId());\r
         configResourceDao.deleteByConfigResource(configResourceInput);\r
-        \r
+\r
         dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);\r
         Assert.assertTrue("ConfigResources is not null", dbConfigResources.isEmpty());\r
     }\r
index 1fcecce..ba150d5 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -36,41 +39,41 @@ import com.att.eelf.configuration.EELFManager;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class ConfigTransactionLogDaoTest {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigTransactionLogDaoTest.class);\r
-    \r
+\r
     @Autowired\r
     private TransactionLogDao transactionLogDao;\r
-    \r
+\r
     @Autowired\r
     private NamedQueryExecutorDao namedQueryExecutorDao;\r
-    \r
+\r
     @Before\r
     public void initialise() {\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test\r
     public void testQueryExecution() throws Exception {\r
         String requestId = "12345";\r
-        \r
+\r
         transactionLogDao\r
                 .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, "Received Request"));\r
-        \r
+\r
         List<TransactionLog> result = transactionLogDao.getTransactionsByRequestId(requestId);\r
         logger.info("DB ArtifactReference :" + result);\r
         Assert.assertNotNull("Failed to get Query Result", result);\r
-        \r
+\r
         List<TransactionLog> result2 =\r
                 transactionLogDao.getTransactionsByRequestId(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG);\r
         logger.info("DB ArtifactReference :" + result2);\r
         Assert.assertNotNull("Failed to get Query Result", result2);\r
-        \r
+\r
         String namedsql = "SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = :request_id";\r
         Map<String, Object> parameters = new HashMap<>();\r
         parameters.put("request_id", "12345");\r
         List<Map<String, Object>> namedresult = namedQueryExecutorDao.query(namedsql, parameters);\r
         logger.info("DB ArtifactReference :" + namedresult);\r
         Assert.assertNotNull("Failed to get Query Result", namedresult);\r
-        \r
+\r
     }\r
-    \r
+\r
 }\r
index ce3e952..257bc31 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.dao;\r
@@ -32,18 +35,18 @@ import com.att.eelf.configuration.EELFManager;
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
 public class QueryExecutorDaoTest {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoTest.class);\r
-    \r
+\r
     @Autowired\r
     private QueryExecutorDao queryExecutorDao;\r
-    \r
+\r
     @Before\r
     public void initialise() {\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test\r
     public void testInsertQueryExecution() throws Exception {\r
-        \r
+\r
         String sql = "INSERT INTO CONFIG_RESOURCE"\r
                 + "(config_resource_id, resource_id, resource_type, template_name, recipe_name, request_id, resource_data, mask_data, created_date, updated_by) "\r
                 + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";\r
@@ -54,25 +57,25 @@ public class QueryExecutorDaoTest {
         logger.info("Updated successfully rows :" + result);\r
         Assert.assertNotNull("Failed to get Query Result", result);\r
     }\r
-    \r
+\r
     @Test\r
     public void testUpdateQueryExecution() throws Exception {\r
-        \r
+\r
         String sql = "UPDATE CONFIG_RESOURCE set recipe_name=? where config_resource_id=?";\r
         Object[] data = new Object[] {"vce-service-template", "12345"};\r
         int result = queryExecutorDao.update(sql, data);\r
         logger.info("Updated successfully rows :" + result);\r
         Assert.assertNotNull("Failed to get Query Result", result);\r
     }\r
-    \r
+\r
     @Test\r
     public void testDeleteQueryExecution() throws Exception {\r
-        \r
+\r
         String sql = "DELETE FROM CONFIG_RESOURCE where config_resource_id=?";\r
         Object[] data = new Object[] {"12345"};\r
         int result = queryExecutorDao.update(sql, data);\r
         logger.info("Updated successfully rows :" + result);\r
         Assert.assertNotNull("Failed to get Query Result", result);\r
     }\r
-    \r
+\r
 }\r
index 847d5ed..b2f24bf 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.service;\r
@@ -35,33 +38,33 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @RunWith(SpringJUnit4ClassRunner.class)\r
 @ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
 public class ConfigResourceNodeTest {\r
-    \r
+\r
     ConfigResourceNode configResourceNode;\r
-    \r
+\r
     ConfigResourceService configResourceService;\r
-    \r
+\r
     @Autowired\r
     TransactionLogDao transactionLogDao;\r
-    \r
+\r
     @Autowired\r
     ConfigResourceDao configResourceDao;\r
-    \r
+\r
     @Autowired\r
     QueryExecutorDao queryExecutorDao;\r
-    \r
+\r
     @Autowired\r
     NamedQueryExecutorDao namedQueryExecutorDao;\r
-    \r
+\r
     @Autowired\r
     ConfigPropertyMapDao configPropertyMapDao;\r
-    \r
+\r
     @Before\r
     public void before() {\r
         configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,\r
                 namedQueryExecutorDao, configPropertyMapDao);\r
         configResourceNode = new ConfigResourceNode(configResourceService);\r
     }\r
-    \r
+\r
     @Test\r
     public void testSaveConfigTransactionLog() throws Exception {\r
         Map<String, String> inParams = new HashMap<>();\r
@@ -69,12 +72,12 @@ public class ConfigResourceNodeTest {
         inParams.put(DataAdaptorConstants.INPUT_PARAM_MESSAGE, "message");\r
         SvcLogicContext ctx = new SvcLogicContext();\r
         ctx.setAttribute("request-id", "requestId12345");\r
-        \r
+\r
         configResourceNode.saveConfigTransactionLog(inParams, ctx);\r
-        \r
+\r
         Assert.assertTrue(!transactionLogDao.getTransactionsByRequestId("requestId12345").isEmpty());\r
     }\r
-    \r
+\r
     @Test(expected = SvcLogicException.class)\r
     public void testSaveConfigTransactionLogException() throws Exception {\r
         configResourceNode = new ConfigResourceNode(null);\r
index 1240ca2..6f861a3 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.data.adaptor.service;\r
@@ -42,30 +45,30 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 @RunWith(SpringJUnit4ClassRunner.class)\r
 @ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
 public class ConfigResourceServiceTest {\r
-    \r
+\r
     ConfigResourceService configResourceService;\r
-    \r
+\r
     @Autowired\r
     TransactionLogDao transactionLogDao;\r
-    \r
+\r
     @Autowired\r
     ConfigResourceDao configResourceDao;\r
-    \r
+\r
     @Autowired\r
     QueryExecutorDao queryExecutorDao;\r
-    \r
+\r
     @Autowired\r
     NamedQueryExecutorDao namedQueryExecutorDao;\r
-    \r
+\r
     @Autowired\r
     ConfigPropertyMapDao configPropertyMapDao;\r
-    \r
+\r
     @Before\r
     public void before() {\r
         configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,\r
                 namedQueryExecutorDao, configPropertyMapDao);\r
     }\r
-    \r
+\r
     @Test\r
     public void testUpdate() throws Exception {\r
         String sql = "INSERT INTO CONFIG_RESOURCE"\r
@@ -76,20 +79,20 @@ public class ConfigResourceServiceTest {
                         "resource-data", "mask-data", null, new Date(System.currentTimeMillis()), "ab1234"};\r
         int result = configResourceService.update(sql, data);\r
         Assert.assertTrue(result == 1);\r
-        \r
+\r
         sql = "SELECT * FROM CONFIG_RESOURCE WHERE config_resource_id = ?";\r
         data = new Object[] {"54321"};\r
         List<Map<String, Object>> queryResult = configResourceService.query(sql, data);\r
         Assert.assertTrue(queryResult.size() == 1);\r
     }\r
-    \r
+\r
     @Test\r
     public void testSaveAndGetConfigResource() throws Exception {\r
         ConfigResource configResource = new ConfigResource();\r
         String resourceData = IOUtils.toString(\r
                 ConfigResourceDaoTest.class.getClassLoader().getResourceAsStream("reference/resource_data.json"),\r
                 Charset.defaultCharset());\r
-        \r
+\r
         configResource.setResourceData(resourceData);\r
         configResource.setServiceTemplateName("sample-name");\r
         configResource.setServiceTemplateVersion("1.0.0");\r
@@ -102,7 +105,7 @@ public class ConfigResourceServiceTest {
         configResource.setStatus("success");\r
         configResource.setCreatedDate(new Date(System.currentTimeMillis()));\r
         configResource.setUpdatedBy("an188a");\r
-        \r
+\r
         List<ResourceAssignmentData> resourceAssignments = new ArrayList<>();\r
         ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();\r
         resourceAssignmentData.setDataType("string");\r
@@ -114,7 +117,7 @@ public class ConfigResourceServiceTest {
         resourceAssignmentData.setSource("input");\r
         resourceAssignments.add(resourceAssignmentData);\r
         configResource.setResourceAssignments(resourceAssignments);\r
-        \r
+\r
         // save\r
         ConfigResource dbConfigResource = configResourceService.saveConfigResource(configResource);\r
         Assert.assertNotNull("ConfigResource is null", dbConfigResource);\r
@@ -122,7 +125,7 @@ public class ConfigResourceServiceTest {
         Assert.assertEquals("Resource Assignment Data count missmatch", true,\r
                 dbConfigResource.getResourceAssignments().size() > 0);\r
         Assert.assertEquals(configResource.getServiceTemplateVersion(), dbConfigResource.getServiceTemplateVersion());\r
-        \r
+\r
         // update\r
         configResource.setServiceTemplateVersion("1.0.1");\r
         dbConfigResource = configResourceService.saveConfigResource(configResource);\r
@@ -131,7 +134,7 @@ public class ConfigResourceServiceTest {
         Assert.assertEquals("Resource Assignment Data count missmatch", true,\r
                 dbConfigResource.getResourceAssignments().size() > 0);\r
         Assert.assertEquals(configResource.getServiceTemplateVersion(), dbConfigResource.getServiceTemplateVersion());\r
-        \r
+\r
         // find\r
         ConfigResource configResourceInput = new ConfigResource();\r
         configResourceInput.setResourceId(configResource.getResourceId());\r
@@ -144,23 +147,23 @@ public class ConfigResourceServiceTest {
         List<ConfigResource> dbConfigResources = configResourceService.getConfigResource(configResourceInput);\r
         Assert.assertNotNull("ConfigResources is null", dbConfigResources);\r
         Assert.assertEquals("ConfigResources size missmatch", true, dbConfigResources.size() > 0);\r
-        \r
+\r
         for (ConfigResource dbConfigResouce : dbConfigResources) {\r
             Assert.assertNotNull("ConfigResources Assignments is null", dbConfigResouce.getResourceAssignments());\r
             Assert.assertTrue("ConfigResources Assignments size miss mathch ",\r
                     dbConfigResouce.getResourceAssignments().size() > 0);\r
         }\r
     }\r
-    \r
+\r
     @Test\r
     public void testSaveAndGetTransactionLog() throws Exception {\r
         TransactionLog transactionLog = new TransactionLog();\r
         transactionLog.setMessage("message");\r
         transactionLog.setMessageType("messageType");\r
         transactionLog.setRequestId("requestId");\r
-        \r
+\r
         configResourceService.save(transactionLog);\r
-        \r
+\r
         List<TransactionLog> transactions =\r
                 configResourceService.getTransactionsByRequestId(transactionLog.getRequestId());\r
         Assert.assertTrue(transactions.size() == 1);\r
@@ -168,7 +171,7 @@ public class ConfigResourceServiceTest {
                 transactionLog.getMessageType());\r
         Assert.assertTrue(transactions.size() == 1);\r
     }\r
-    \r
+\r
     @Test\r
     public void testNamedQueryExecutorUpdateNQuery() throws Exception {\r
         Map<String, Object> parameters = new HashMap<>();\r
@@ -179,10 +182,10 @@ public class ConfigResourceServiceTest {
         configResourceService.update(\r
                 "INSERT INTO CONFIG_TRANSACTION_LOG ( config_transaction_log_id, request_id, message_type, message ) VALUES (:config_transaction_log_id, :request_id, :message_type, :message) ",\r
                 parameters);\r
-        \r
+\r
         List<Map<String, Object>> result = configResourceService\r
                 .query("SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = :request_id", parameters);\r
-        \r
+\r
         Assert.assertTrue(!result.isEmpty());\r
         Assert.assertNotNull(configResourceService.getNamedParameterJdbcTemplate());\r
     }\r
index ce75592..1f83d15 100644 (file)
@@ -1,5 +1,21 @@
-log4j.rootLogger=INFO, A1
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %5p %t %X{UUID} %c{3}:%L - %m%n
-log4j.logger.org.hibernate=INFO
+###\r
+# Copyright © 2017-2018 AT&T Intellectual Property.\r
+# Modifications Copyright © 2018 IBM.\r
+# \r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+# \r
+#     http://www.apache.org/licenses/LICENSE-2.0\r
+# \r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+###\r
+log4j.rootLogger=INFO, A1\r
+log4j.appender.A1=org.apache.log4j.ConsoleAppender\r
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %5p %t %X{UUID} %c{3}:%L - %m%n\r
+log4j.logger.org.hibernate=INFO\r
index 5b0004c..f0a50f4 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>\r
 <!--\r
   Copyright © 2017-2018 AT&T Intellectual Property.\r
+  Modifications Copyright © 2018 IBM.\r
   \r
   Licensed under the Apache License, Version 2.0 (the "License");\r
   you may not use this file except in compliance with the License.\r
index 0e73b40..17189f2 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>\r
 <!--\r
   Copyright © 2017-2018 AT&T Intellectual Property.\r
+  Modifications Copyright © 2018 IBM.\r
   \r
   Licensed under the Apache License, Version 2.0 (the "License");\r
   you may not use this file except in compliance with the License.\r
index 4b09416..af6b9f2 100644 (file)
@@ -1,24 +1,27 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor;\r
 \r
 public class ConfigRestAdaptorConstants {\r
     private ConfigRestAdaptorConstants() {\r
-        \r
+\r
     }\r
-    \r
+\r
     public static final String SDNC_ROOT_DIR_ENV_VAR_KEY = "SDNC_CONFIG_DIR";\r
     public static final String REST_ADAPTOR_PROPERTIES_FILE_NAME = "config-rest-adaptor.properties";\r
     public static final String PROXY_URL_KEY = "proxyUrl";\r
@@ -26,22 +29,22 @@ public class ConfigRestAdaptorConstants {
     public static final String AAF_USERNAME_KEY = "aafUserName";\r
     public static final String AAF_PSSWD_KEY = "aafPassword";\r
     public static final String COMMON_SERVICE_VERSION_KEY = "commonServiceVersion";\r
-    \r
+\r
     public static final String PROPERTY_ENV_PROD = "field";\r
     public static final String PROPERTY_ENV_SOLO = "solo";\r
-    \r
+\r
     public static final String REST_ADAPTOR_BASE_PROPERTY = "org.onap.ccsdk.config.rest.adaptors.";\r
     public static final String REST_ADAPTOR_ENV_TYPE = "envtype";\r
     public static final String REST_ADAPTOR_TYPE_GENERIC = "generic";\r
     public static final String REST_ADAPTOR_TYPE_SSL = "ssl";\r
-    \r
+\r
     public static final String SSL_SERVICE_BASEURL = ".url";\r
     public static final String SSL_SERVICE_APP = ".application";\r
     public static final String SSL_SERVICE_TRUST = ".ssl.trust";\r
     public static final String SSL_SERVICE_TRUST_PSSWD = ".ssl.trust.psswd";\r
     public static final String SSL_SERVICE_KEY = ".ssl.key";\r
     public static final String SSL_SERVICE_KEY_PSSWD = ".ssl.key.psswd";\r
-    \r
+\r
     public static final String SERVICE_TYPE_PROPERTY = ".type";\r
     public static final String SERVICE_EANABLED_PROPERTY = ".enable";\r
     public static final String SERVICE_ENV_PROPERTY = ".env";\r
@@ -52,7 +55,7 @@ public class ConfigRestAdaptorConstants {
     public static final String SERVICE_PSSWD_PROPERTY = ".passwd";\r
     public static final String SERVICE_CLIENTAUTH_PROPERTY = ".clientAuth";\r
     public static final String SERVICE_AUTHORIZATION_PROPERTY = ".authorization";\r
-    \r
+\r
     public static final String SELECTOR_AAI = "aai";\r
     public static final String SELECTOR_ALTS = "alts";\r
     public static final String SELECTOR_EIPAM = "eipam";\r
@@ -62,5 +65,5 @@ public class ConfigRestAdaptorConstants {
     public static final String SELECTOR_POLICY_MANAGER = "policymanager";\r
     public static final String SELECTOR_NRD = "networkresourcediscovery";\r
     public static final String SELECTOR_NSM = "nsm";\r
-    \r
+\r
 }\r
index 3bb04a2..c6593f1 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor;\r
@@ -20,12 +23,12 @@ package org.onap.ccsdk.config.rest.adaptor;
  * @version 1.0\r
  */\r
 public class ConfigRestAdaptorException extends Exception {\r
-    \r
+\r
     /**\r
      *\r
      */\r
     private static final long serialVersionUID = 1L;\r
-    \r
+\r
     /**\r
      * This is a ConfigRestAdaptorException constructor\r
      *\r
@@ -34,7 +37,7 @@ public class ConfigRestAdaptorException extends Exception {
     public ConfigRestAdaptorException(String message) {\r
         super(message);\r
     }\r
-    \r
+\r
     /**\r
      * This is a ConfigRestAdaptorException constructor\r
      *\r
@@ -43,5 +46,5 @@ public class ConfigRestAdaptorException extends Exception {
     public ConfigRestAdaptorException(String message, Throwable cause) {\r
         super(message, cause);\r
     }\r
-    \r
+\r
 }\r
index ed39ea9..d31aa7e 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.data;\r
@@ -17,57 +20,57 @@ package org.onap.ccsdk.config.rest.adaptor.data;
 import java.util.Map;\r
 \r
 public class RestResponse {\r
-    \r
+\r
     private String statusCode;\r
     private String body;\r
     private Map<String, String> parameters;\r
     private Map<String, String> responseHeaders;\r
     private Map<String, String> requestHeaders;\r
-    \r
+\r
     public String getStatusCode() {\r
         return statusCode;\r
     }\r
-    \r
+\r
     public void setStatusCode(String statusCode) {\r
         this.statusCode = statusCode;\r
     }\r
-    \r
+\r
     public String getBody() {\r
         return body;\r
     }\r
-    \r
+\r
     public void setBody(String body) {\r
         this.body = body;\r
     }\r
-    \r
+\r
     public Map<String, String> getParameters() {\r
         return parameters;\r
     }\r
-    \r
+\r
     public void setParameters(Map<String, String> parameters) {\r
         this.parameters = parameters;\r
     }\r
-    \r
+\r
     public Map<String, String> getResponseHeaders() {\r
         return responseHeaders;\r
     }\r
-    \r
+\r
     public void setResponseHeaders(Map<String, String> responseHeaders) {\r
         this.responseHeaders = responseHeaders;\r
     }\r
-    \r
+\r
     public Map<String, String> getRequestHeaders() {\r
         return requestHeaders;\r
     }\r
-    \r
+\r
     public void setRequestHeaders(Map<String, String> requestHeaders) {\r
         this.requestHeaders = requestHeaders;\r
     }\r
-    \r
+\r
     @Override\r
     public String toString() {\r
         return "RestResponse [statusCode=" + statusCode + ", body=" + body + ", parameters=" + parameters\r
                 + ", responseHeaders=" + responseHeaders + ", requestHeaders=" + requestHeaders + "]";\r
     }\r
-    \r
+\r
 }\r
index 7ccb627..9730262 100644 (file)
@@ -53,24 +53,24 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServiceAdapter {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(AbstractConfigRestClientAdapter.class);\r
     private static final String MS_INIT_FAIL = "Failed to initialise microservice client restTemplate.";\r
-    \r
+\r
     protected boolean isRestClientServiceAdapaterEnabled = false;\r
     protected boolean isSSLServiceAdapaterEnabled = true;\r
-    \r
+\r
     protected Map<String, String> properties = new ConcurrentHashMap<>();\r
     protected String serviceSelector;\r
-    \r
+\r
     protected RestTemplate restTemplate;\r
-    \r
+\r
     protected AbstractConfigRestClientAdapter(Map<String, String> properties, String serviceSelector) {\r
         this.properties = properties;\r
         this.serviceSelector = serviceSelector;\r
         setRestClientServiceAdapaterEnabled();\r
     }\r
-    \r
+\r
     private void setRestClientServiceAdapaterEnabled() {\r
         String isEnabledProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                 + ConfigRestAdaptorConstants.SERVICE_EANABLED_PROPERTY;\r
@@ -82,7 +82,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
             isRestClientServiceAdapaterEnabled = true;\r
         }\r
     }\r
-    \r
+\r
     private List<HttpMessageConverter<?>> getMessageConverters() {\r
         List<HttpMessageConverter<?>> converters = new ArrayList<>();\r
         converters.add(new ByteArrayHttpMessageConverter());\r
@@ -92,85 +92,85 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
         converters.add(new MappingJackson2HttpMessageConverter());\r
         return converters;\r
     }\r
-    \r
+\r
     public void initialise(String user, String pass) {\r
         logger.trace("Config rest template factory user ({}) ", user);\r
-        \r
+\r
         CloseableHttpClient httpClient =\r
                 HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier()).build();\r
         HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();\r
         requestFactory.setHttpClient(httpClient);\r
-        \r
+\r
         restTemplate = new RestTemplate(getMessageConverters());\r
         restTemplate.setRequestFactory(requestFactory);\r
         if (StringUtils.isNotBlank(user) && StringUtils.isNotBlank(pass)) {\r
             restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor(user, pass));\r
         }\r
     }\r
-    \r
+\r
     public void initialiseSSL(String keyStorePath, String trustStorePath, String keyPass, String trustPass)\r
             throws ConfigRestAdaptorException {\r
         logger.trace("SSL rest template factory");\r
-        \r
+\r
         TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;\r
         SSLContext sslContext = null;\r
-        \r
+\r
         try (InputStream keyInput = new FileInputStream(keyStorePath)) {\r
             KeyStore keyStore = KeyStore.getInstance("PKCS12");\r
             keyStore.load(keyInput, keyPass.toCharArray());\r
-            \r
+\r
             logger.info("key loaded successfully");\r
             sslContext = SSLContextBuilder.create().loadKeyMaterial(keyStore, keyPass.toCharArray()).loadTrustMaterial(\r
                     ResourceUtils.getFile(trustStorePath), trustPass.toCharArray(), acceptingTrustStrategy).build();\r
         } catch (Exception e) {\r
             throw new ConfigRestAdaptorException(e.getMessage());\r
         }\r
-        \r
+\r
         SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);\r
         CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();\r
         HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);\r
-        \r
+\r
         restTemplate = new RestTemplate(getMessageConverters());\r
         restTemplate.setRequestFactory(requestFactory);\r
     }\r
-    \r
+\r
     public <T> T getResource(HttpHeaders headers, String url, Class<T> responseType) throws ConfigRestAdaptorException {\r
         ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.GET, null, responseType);\r
         return processResponse(response, url, HttpMethod.GET);\r
     }\r
-    \r
+\r
     public <T> T postResource(HttpHeaders headers, String url, Object request, Class<T> responseType)\r
             throws ConfigRestAdaptorException {\r
         ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.POST, request, responseType);\r
         return processResponse(response, url, HttpMethod.POST);\r
     }\r
-    \r
+\r
     public <T> T exchangeResource(HttpHeaders headers, String url, Object request, Class<T> responseType, String method)\r
             throws ConfigRestAdaptorException {\r
         ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.resolve(method), request, responseType);\r
         return processResponse(response, url, HttpMethod.resolve(method));\r
     }\r
-    \r
+\r
     public RestResponse getResource(HttpHeaders headers, String url) throws ConfigRestAdaptorException {\r
         return exchangeForEntity(headers, url, HttpMethod.GET, null);\r
     }\r
-    \r
+\r
     public RestResponse postResource(HttpHeaders headers, String url, Object request)\r
             throws ConfigRestAdaptorException {\r
         return exchangeForEntity(headers, url, HttpMethod.POST, request);\r
     }\r
-    \r
+\r
     public RestResponse exchangeResource(HttpHeaders headers, String url, Object request, String method)\r
             throws ConfigRestAdaptorException {\r
         return exchangeForEntity(headers, url, HttpMethod.resolve(method), request);\r
     }\r
-    \r
+\r
     private RestResponse exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request)\r
             throws ConfigRestAdaptorException {\r
         RestResponse restResponse = new RestResponse();\r
         restResponse.setRequestHeaders(headers.toSingleValueMap());\r
         ResponseEntity<String> response = null;\r
-        \r
+\r
         try {\r
             if (restTemplate == null) {\r
                 logger.error(MS_INIT_FAIL);\r
@@ -179,7 +179,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
                 logger.debug("url    : ({})", url);\r
                 logger.debug("headers: ({})", headers);\r
                 logger.debug("request: ({})", request);\r
-                \r
+\r
                 if (HttpMethod.GET == httpMethod) {\r
                     HttpEntity<String> entity = new HttpEntity<>("parameters", headers);\r
                     response = restTemplate.exchange(url, httpMethod, entity, String.class);\r
@@ -188,7 +188,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
                     response = restTemplate.exchange(url, httpMethod, entity, String.class);\r
                 }\r
                 logger.debug("response: ({})", response);\r
-                \r
+\r
                 if (response != null) {\r
                     logger.debug("response status code: ({})", response.getStatusCode());\r
                     restResponse.setBody(response.getBody());\r
@@ -210,11 +210,11 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
         }\r
         return restResponse;\r
     }\r
-    \r
+\r
     private <T> ResponseEntity<T> exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod,\r
             Object request, Class<T> responseType) throws ConfigRestAdaptorException {\r
         ResponseEntity<T> response = null;\r
-        \r
+\r
         try {\r
             if (restTemplate == null) {\r
                 logger.error(MS_INIT_FAIL);\r
@@ -223,7 +223,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
                 logger.debug("url    : ({})", url);\r
                 logger.debug("headers: ({})", headers);\r
                 logger.debug("request: ({})", request);\r
-                \r
+\r
                 if (HttpMethod.GET == httpMethod) {\r
                     HttpEntity<String> entity = new HttpEntity<>("parameters", headers);\r
                     response = restTemplate.exchange(url, httpMethod, entity, responseType);\r
@@ -232,7 +232,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
                     response = restTemplate.exchange(url, httpMethod, entity, responseType);\r
                 }\r
                 logger.debug("response: ({})", response);\r
-                \r
+\r
                 if (response != null) {\r
                     logger.debug("response status code: ({})", response.getStatusCode());\r
                 } else {\r
@@ -245,7 +245,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
         }\r
         return response;\r
     }\r
-    \r
+\r
     protected synchronized <T> T processResponse(ResponseEntity<T> response, String url, HttpMethod httpMethod)\r
             throws ConfigRestAdaptorException {\r
         if (response != null) {\r
@@ -262,7 +262,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
         }\r
         throw new ConfigRestAdaptorException(String.format("Rest Operation is failed for the URL (%s)", url));\r
     }\r
-    \r
+\r
     protected synchronized String constructUrl(String baseUrl, String path) {\r
         if (StringUtils.isNotBlank(path)) {\r
             return baseUrl + path;\r
@@ -270,5 +270,5 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic
             return baseUrl;\r
         }\r
     }\r
-    \r
+\r
 }\r
index e15f4ae..98c598a 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -18,7 +21,7 @@ import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;
 import org.onap.ccsdk.config.rest.adaptor.data.RestResponse;\r
 \r
 public interface ConfigRestAdaptorService {\r
-    \r
+\r
     /**\r
      * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in\r
      * defined responseType.\r
@@ -28,7 +31,7 @@ public interface ConfigRestAdaptorService {
      * @param responseType the type of the return value\r
      */\r
     public <T> T getResource(String selectorName, String path, Class<T> responseType) throws ConfigRestAdaptorException;\r
-    \r
+\r
     /**\r
      * Create a new resource by POSTing the given object to the URI template, and returns the response\r
      * as defined responseType\r
@@ -40,7 +43,7 @@ public interface ConfigRestAdaptorService {
      */\r
     public <T> T postResource(String selectorName, String path, Object request, Class<T> responseType)\r
             throws ConfigRestAdaptorException;\r
-    \r
+\r
     /**\r
      * Execute the HTTP method to the given URI template, writing the given request entity to the\r
      * request, and returns the response as defined responseType\r
@@ -53,7 +56,7 @@ public interface ConfigRestAdaptorService {
      */\r
     public <T> T exchangeResource(String selectorName, String path, Object request, Class<T> responseType,\r
             String method) throws ConfigRestAdaptorException;\r
-    \r
+\r
     /**\r
      * Retrieve an entity by doing a GET on the specified URL. The response is converted and stored in\r
      * defined responseType.\r
@@ -62,7 +65,7 @@ public interface ConfigRestAdaptorService {
      * @param path the URI path which will append in baseURL mentioned in selector property\r
      */\r
     public RestResponse getResource(String selectorName, String path) throws ConfigRestAdaptorException;\r
-    \r
+\r
     /**\r
      * Create a new resource by POSTing the given object to the URI template, and returns the response\r
      * as defined responseType\r
@@ -73,7 +76,7 @@ public interface ConfigRestAdaptorService {
      */\r
     public RestResponse postResource(String selectorName, String path, Object request)\r
             throws ConfigRestAdaptorException;\r
-    \r
+\r
     /**\r
      * Execute the HTTP method to the given URI template, writing the given request entity to the\r
      * request, and returns the response as defined responseType\r
@@ -85,5 +88,5 @@ public interface ConfigRestAdaptorService {
      */\r
     public RestResponse exchangeResource(String selectorName, String path, Object request, String method)\r
             throws ConfigRestAdaptorException;\r
-    \r
+\r
 }\r
index b17ed22..65b9def 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -31,16 +34,16 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigRestAdaptorServiceImpl.class);\r
     private Map<String, String> restProperties = new ConcurrentHashMap<>();\r
-    \r
+\r
     public ConfigRestAdaptorServiceImpl(String propertyPath) {\r
         initializeProperties(propertyPath);\r
         try {\r
             String envType = restProperties.get(ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY\r
                     + ConfigRestAdaptorConstants.REST_ADAPTOR_ENV_TYPE);\r
-            \r
+\r
             if (!(ConfigRestAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType)\r
                     || ConfigRestAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) {\r
                 ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);\r
@@ -53,72 +56,72 @@ public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService {
             logger.error(e.getMessage(), e);\r
         }\r
     }\r
-    \r
+\r
     private void initializeProperties(String propertyPath) {\r
         logger.trace("Initialising Config rest adaptor Service with property directory ({})", propertyPath);\r
         try {\r
             if (StringUtils.isBlank(propertyPath)) {\r
                 propertyPath = System.getProperty(ConfigRestAdaptorConstants.SDNC_ROOT_DIR_ENV_VAR_KEY);\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(propertyPath)) {\r
                 throw new ConfigRestAdaptorException(\r
                         String.format("Failed to get the property directory (%s)", propertyPath));\r
             }\r
-            \r
+\r
             // Loading Default config-rest-adaptor.properties\r
             String propertyFile =\r
                     propertyPath + File.separator + ConfigRestAdaptorConstants.REST_ADAPTOR_PROPERTIES_FILE_NAME;\r
-            \r
+\r
             Properties properties = new Properties();\r
             properties.load(new FileInputStream(propertyFile));\r
-            \r
+\r
             logger.trace("Initializing properties details for property file ({}) properties ({})", propertyFile,\r
                     properties);\r
             restProperties.putAll(properties.entrySet().stream()\r
                     .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString())));\r
-            \r
+\r
         } catch (Exception e) {\r
             logger.error(e.getMessage(), e);\r
         }\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T getResource(String serviceSelector, String path, Class<T> responseType)\r
             throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).getResource(path, responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T postResource(String serviceSelector, String path, Object request, Class<T> responseType)\r
             throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).postResource(path, request, responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T exchangeResource(String serviceSelector, String path, Object request, Class<T> responseType,\r
             String method) throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).exchangeResource(path, request, responseType,\r
                 method);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse getResource(String serviceSelector, String path) throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).getResource(path);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse postResource(String serviceSelector, String path, Object request)\r
             throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).postResource(path, request);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse exchangeResource(String serviceSelector, String path, Object request, String method)\r
             throws ConfigRestAdaptorException {\r
         return getRestClientAdapterBySelectorName(serviceSelector).exchangeResource(path, request, method);\r
     }\r
-    \r
+\r
     private ConfigRestClientServiceAdapter getRestClientAdapterBySelectorName(String serviceSelector)\r
             throws ConfigRestAdaptorException {\r
         String adoptorType = restProperties.get(ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
@@ -138,5 +141,5 @@ public class ConfigRestAdaptorServiceImpl implements ConfigRestAdaptorService {
                     String.format("couldn't get rest adoptor type for the selector (%s)", serviceSelector));\r
         }\r
     }\r
-    \r
+\r
 }\r
index e1adb38..46e954f 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -18,18 +21,18 @@ import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;
 import org.onap.ccsdk.config.rest.adaptor.data.RestResponse;\r
 \r
 interface ConfigRestClientServiceAdapter {\r
-    \r
+\r
     public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException;\r
-    \r
+\r
     public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException;\r
-    \r
+\r
     public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)\r
             throws ConfigRestAdaptorException;\r
-    \r
+\r
     public RestResponse getResource(String path) throws ConfigRestAdaptorException;\r
-    \r
+\r
     public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException;\r
-    \r
+\r
     public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException;\r
-    \r
+\r
 }\r
index 55cdca4..8cb5e9b 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -26,16 +29,16 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapter {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(GenericRestClientAdapterImpl.class);\r
     private String baseUrl = "";\r
-    \r
+\r
     public GenericRestClientAdapterImpl(Map<String, String> properties, String serviceSelector)\r
             throws ConfigRestAdaptorException {\r
         super(properties, serviceSelector);\r
         init(serviceSelector);\r
     }\r
-    \r
+\r
     private void init(String serviceSelector) throws ConfigRestAdaptorException {\r
         try {\r
             if (isRestClientServiceAdapaterEnabled) {\r
@@ -45,11 +48,11 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte
                         + ConfigRestAdaptorConstants.SERVICE_USER_PROPERTY;\r
                 String passProperty = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                         + ConfigRestAdaptorConstants.SERVICE_PSSWD_PROPERTY;\r
-                \r
+\r
                 baseUrl = properties.get(baseUrlProperty);\r
                 String userId = properties.get(userProperty);\r
                 String pass = properties.get(passProperty);\r
-                \r
+\r
                 initialise(userId, pass);\r
                 logger.info("Initialised restconf adaptor service for selector ({})", serviceSelector);\r
                 if (restTemplate == null) {\r
@@ -58,52 +61,52 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte
             } else {\r
                 throw new ConfigRestAdaptorException("rest selector (" + serviceSelector + ") is not enabled");\r
             }\r
-            \r
+\r
         } catch (Exception e) {\r
             throw new ConfigRestAdaptorException("GenericRestClientServiceAdapter : " + e.getMessage(), e);\r
         }\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException {\r
         return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException {\r
         return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)\r
             throws ConfigRestAdaptorException {\r
         return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType, method);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse getResource(String path) throws ConfigRestAdaptorException {\r
         return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path));\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException {\r
         return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException {\r
         return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, method);\r
     }\r
-    \r
+\r
     private HttpHeaders formHttpHeaders() {\r
-        \r
+\r
         HttpHeaders headers = new HttpHeaders();\r
-        \r
+\r
         headers.setContentType(MediaType.APPLICATION_JSON);\r
         headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);\r
         headers.add("X-TransactionId", generateUUID());\r
         headers.add("X-ECOMP-RequestID", headers.getFirst("X-TransactionId"));\r
-        \r
+\r
         String appIDPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                 + ConfigRestAdaptorConstants.SERVICE_APPID_PROPERTY;\r
         String environmentPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
@@ -112,7 +115,7 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte
                 + ConfigRestAdaptorConstants.SERVICE_CLIENTAUTH_PROPERTY;\r
         String authorizationPath = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                 + ConfigRestAdaptorConstants.SERVICE_AUTHORIZATION_PROPERTY;\r
-        \r
+\r
         if (StringUtils.isNotBlank(properties.get(appIDPath))) {\r
             headers.add("X-FromAppId", properties.get(appIDPath));\r
         }\r
@@ -125,12 +128,12 @@ public class GenericRestClientAdapterImpl extends AbstractConfigRestClientAdapte
         if (StringUtils.isNotBlank(properties.get(environmentPath))) {\r
             headers.add("Environment", properties.get(environmentPath));\r
         }\r
-        \r
+\r
         return headers;\r
     }\r
-    \r
+\r
     private synchronized String generateUUID() {\r
         return UUID.randomUUID().toString();\r
     }\r
-    \r
+\r
 }\r
index 7d31b81..e444d9f 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -25,23 +28,23 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(SSLRestClientAdapterImpl.class);\r
     private String baseUrl = "";\r
     private String application = "";\r
-    \r
+\r
     public SSLRestClientAdapterImpl(Map<String, String> properties, String serviceSelector)\r
             throws ConfigRestAdaptorException {\r
         super(properties, serviceSelector);\r
         init(serviceSelector);\r
     }\r
-    \r
+\r
     private void init(String serviceSelector) throws ConfigRestAdaptorException {\r
         try {\r
             if (isSSLServiceAdapaterEnabled) {\r
-                \r
+\r
                 logger.info("Initializing SSL client for selector ({}), properties ({})", serviceSelector, properties);\r
-                \r
+\r
                 String baseUrlProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                         + ConfigRestAdaptorConstants.SSL_SERVICE_BASEURL;\r
                 String applicationProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
@@ -54,15 +57,15 @@ public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter {
                         + ConfigRestAdaptorConstants.SSL_SERVICE_TRUST;\r
                 String trustStorePassProp = ConfigRestAdaptorConstants.REST_ADAPTOR_BASE_PROPERTY + serviceSelector\r
                         + ConfigRestAdaptorConstants.SSL_SERVICE_TRUST_PSSWD;\r
-                \r
+\r
                 baseUrl = properties.get(baseUrlProp);\r
                 application = properties.get(applicationProp);\r
-                \r
+\r
                 String keyStorePath = properties.get(keyStorePathProp);\r
                 String trustStorePath = properties.get(trustStorePathProp);\r
                 String keyStorePass = properties.get(keyStorePassProp);\r
                 String trustStorePass = properties.get(trustStorePassProp);\r
-                \r
+\r
                 initialiseSSL(keyStorePath, trustStorePath, keyStorePass, trustStorePass);\r
                 logger.info("Initialised SSL Client Service adaptor service for selector ({})", serviceSelector);\r
                 if (restTemplate == null) {\r
@@ -72,55 +75,55 @@ public class SSLRestClientAdapterImpl extends AbstractConfigRestClientAdapter {
             } else {\r
                 throw new ConfigRestAdaptorException("SSL Client selector (" + serviceSelector + ") is not enabled");\r
             }\r
-            \r
+\r
         } catch (Exception e) {\r
             throw new ConfigRestAdaptorException("SSLRestClientAdapterImpl : " + e.getMessage(), e);\r
         }\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T getResource(String path, Class<T> responseType) throws ConfigRestAdaptorException {\r
         return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path), responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T postResource(String path, Object request, Class<T> responseType) throws ConfigRestAdaptorException {\r
         return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType);\r
     }\r
-    \r
+\r
     @Override\r
     public <T> T exchangeResource(String path, Object request, Class<T> responseType, String method)\r
             throws ConfigRestAdaptorException {\r
         return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, responseType, method);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse getResource(String path) throws ConfigRestAdaptorException {\r
         return super.getResource(formHttpHeaders(), constructUrl(baseUrl, path));\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse postResource(String path, Object request) throws ConfigRestAdaptorException {\r
         return super.postResource(formHttpHeaders(), constructUrl(baseUrl, path), request);\r
     }\r
-    \r
+\r
     @Override\r
     public RestResponse exchangeResource(String path, Object request, String method) throws ConfigRestAdaptorException {\r
         return super.exchangeResource(formHttpHeaders(), constructUrl(baseUrl, path), request, method);\r
     }\r
-    \r
+\r
     private HttpHeaders formHttpHeaders() {\r
-        \r
+\r
         HttpHeaders headers = new HttpHeaders();\r
-        \r
+\r
         headers.setContentType(MediaType.APPLICATION_JSON);\r
         headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);\r
         headers.add("X-FromAppId", application);\r
         headers.add("X-TransactionId", generateUUID());\r
-        \r
+\r
         return headers;\r
     }\r
-    \r
+\r
     private synchronized String generateUUID() {\r
         return UUID.randomUUID().toString();\r
     }\r
index bc486f4..2318fd6 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.utils;\r
@@ -25,11 +28,11 @@ import org.springframework.util.Base64Utils;
 \r
 public class BasicAuthorizationInterceptor implements ClientHttpRequestInterceptor {\r
     private static final Charset UTF_8 = Charset.forName("UTF-8");\r
-    \r
+\r
     private final String username;\r
-    \r
+\r
     private final String pass;\r
-    \r
+\r
     /**\r
      * Create a new interceptor which adds a BASIC authorization header for the given username and pass.\r
      *\r
@@ -41,11 +44,11 @@ public class BasicAuthorizationInterceptor implements ClientHttpRequestIntercept
         this.username = username;\r
         this.pass = (pass != null ? pass : "");\r
     }\r
-    \r
+\r
     @Override\r
     public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)\r
             throws IOException {\r
-        \r
+\r
         String token = Base64Utils.encodeToString((this.username + ":" + this.pass).getBytes(UTF_8));\r
         request.getHeaders().add("Authorization", "Basic " + token);\r
         return execution.execute(request, body);\r
index 0fcc465..4095d62 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.utils;\r
@@ -25,9 +28,9 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(LoggingRequestInterceptor.class);\r
-    \r
+\r
     @Override\r
     public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)\r
             throws IOException {\r
@@ -36,7 +39,7 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
         traceResponse(response);\r
         return response;\r
     }\r
-    \r
+\r
     @SuppressWarnings({"squid:S2629", "squid:S3457"})\r
     private void traceRequest(HttpRequest request, byte[] body) throws IOException {\r
         logger.info("===========================request begin================================================");\r
@@ -46,7 +49,7 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
         logger.info("Request body: {}", new String(body, "UTF-8"));\r
         logger.debug("==========================request end================================================");\r
     }\r
-    \r
+\r
     @SuppressWarnings({"squid:S2629", "squid:S3457"})\r
     private void traceResponse(ClientHttpResponse response) throws IOException {\r
         StringBuilder inputStringBuilder = new StringBuilder();\r
@@ -64,5 +67,5 @@ public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
         logger.debug("Response body: {}", inputStringBuilder.toString());\r
         logger.debug("=======================response end=================================================");\r
     }\r
-    \r
+\r
 }\r
index e6b2694..0b6a6ae 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
   Copyright © 2017-2018 AT&T Intellectual Property.\r
+  Modifications Copyright © 2018 IBM.\r
   \r
   Licensed under the Apache License, Version 2.0 (the "License");\r
   you may not use this file except in compliance with the License.\r
index e698567..6c7f114 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -24,30 +27,30 @@ import org.junit.Before;
 import org.junit.Test;\r
 \r
 public class AbstractConfigRestClientAdapterTest {\r
-    \r
+\r
     Map<String, String> properties = new HashMap<>();\r
-    \r
+\r
     @Before\r
     public void setup() throws Exception {\r
         String propertyfile = "src/test/resources/config-rest-adaptor.properties";\r
-        \r
+\r
         Properties restProperties = new Properties();\r
         restProperties.load(new FileInputStream(propertyfile));\r
-        \r
+\r
         properties.putAll(restProperties.entrySet().stream()\r
                 .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString())));\r
     }\r
-    \r
+\r
     @Test\r
     public void testInitGenericRestClient() throws Exception {\r
         ConfigRestClientServiceAdapter genericRestClient = new GenericRestClientAdapterImpl(properties, "modelservice");\r
         Assert.assertNotNull(genericRestClient);\r
     }\r
-    \r
+\r
     @Test\r
     public void testInitSSLClient() throws Exception {\r
         ConfigRestClientServiceAdapter sslClient = new SSLRestClientAdapterImpl(properties, "aai");\r
         Assert.assertNotNull(sslClient);\r
     }\r
-    \r
+\r
 }\r
index 65a9042..7e7f522 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -22,7 +25,6 @@ import org.junit.Before;
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
 import org.mockito.Matchers;\r
-import org.mockito.Mockito;\r
 import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;\r
 import org.powermock.core.classloader.annotations.PowerMockIgnore;\r
 import org.powermock.core.classloader.annotations.PrepareForTest;\r
@@ -37,80 +39,80 @@ import org.springframework.web.client.RestTemplate;
 @PowerMockIgnore("javax.net.ssl.*")\r
 @PrepareForTest({AbstractConfigRestClientAdapter.class})\r
 public class GenericRestClientServiceTest {\r
-    \r
+\r
     ConfigRestAdaptorService configRestAdaptorService;\r
-    \r
+\r
     RestTemplate mockRestTemplate = mock(RestTemplate.class);\r
-    \r
+\r
     String path = "path";\r
-    \r
+\r
     @Before\r
     public void before() throws Exception {\r
         whenNew(RestTemplate.class).withAnyArguments().thenReturn(mockRestTemplate);\r
-        \r
+\r
         String propertyDir = "src/test/resources";\r
         configRestAdaptorService = new ConfigRestAdaptorServiceImpl(propertyDir);\r
     }\r
-    \r
+\r
     @Test\r
     public void testGetResource() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.getResource("modelservice", path, String.class);\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test\r
     public void testPostResource() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.POST), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.postResource("modelservice", path, null, String.class);\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test\r
     public void testExchange() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.exchangeResource("modelservice", path, null, String.class, "GET");\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testGetResourceError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.getForEntity(Matchers.endsWith(path), Matchers.any())).thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.getResource("modelservice", path, String.class);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testPostResourceError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.postForEntity(Matchers.endsWith(path), Matchers.anyObject(), Matchers.any()))\r
                 .thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.postResource("modelservice", path, null, String.class);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testExchangeError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.exchangeResource("modelservice", path, null, String.class, "GET");\r
     }\r
 }\r
index 4592de8..a5e7572 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.rest.adaptor.service;\r
@@ -22,7 +25,6 @@ import org.junit.Before;
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
 import org.mockito.Matchers;\r
-import org.mockito.Mockito;\r
 import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;\r
 import org.powermock.core.classloader.annotations.PowerMockIgnore;\r
 import org.powermock.core.classloader.annotations.PrepareForTest;\r
@@ -37,80 +39,80 @@ import org.springframework.web.client.RestTemplate;
 @PowerMockIgnore("javax.net.ssl.*")\r
 @PrepareForTest({AbstractConfigRestClientAdapter.class})\r
 public class SSLClientServiceTest {\r
-    \r
+\r
     ConfigRestAdaptorService configRestAdaptorService;\r
-    \r
+\r
     RestTemplate mockRestTemplate = mock(RestTemplate.class);\r
-    \r
+\r
     String path = "path";\r
-    \r
+\r
     @Before\r
     public void before() throws Exception {\r
         whenNew(RestTemplate.class).withAnyArguments().thenReturn(mockRestTemplate);\r
-        \r
+\r
         String propertyDir = "src/test/resources";\r
         configRestAdaptorService = new ConfigRestAdaptorServiceImpl(propertyDir);\r
     }\r
-    \r
+\r
     @Test\r
     public void testGetResource() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.getResource("aai", path, String.class);\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test\r
     public void testPostResource() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.POST), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.postResource("aai", path, null, String.class);\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test\r
     public void testExchange() throws Exception {\r
         String responseBody = "sampleBodyString";\r
         ResponseEntity<Object> response = new ResponseEntity<Object>(responseBody, HttpStatus.OK);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         String body = configRestAdaptorService.exchangeResource("aai", path, null, String.class, "GET");\r
-        \r
+\r
         Assert.assertEquals(responseBody, body);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testGetResourceError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.getForEntity(Matchers.endsWith(path), Matchers.any())).thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.getResource("aai", path, String.class);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testPostResourceError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.postForEntity(Matchers.endsWith(path), Matchers.anyObject(), Matchers.any()))\r
                 .thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.postResource("aai", path, null, String.class);\r
     }\r
-    \r
+\r
     @Test(expected = ConfigRestAdaptorException.class)\r
     public void testExchangeError() throws Exception {\r
         ResponseEntity<Object> response = new ResponseEntity<Object>("", HttpStatus.INTERNAL_SERVER_ERROR);\r
         when(mockRestTemplate.exchange(Matchers.endsWith(path), Matchers.eq(HttpMethod.GET), Matchers.any(),\r
                 Matchers.any(Class.class))).thenReturn(response);\r
-        \r
+\r
         configRestAdaptorService.exchangeResource("aai", path, null, String.class, "GET");\r
     }\r
 }\r
index a01630d..e1d0268 100644 (file)
@@ -1,32 +1,49 @@
-package org.onap.ccsdk.config.rest.adaptor.utils;
-
-import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorConstants;
-import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;
-import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorServiceImpl;
-
-@SuppressWarnings("squid:S2187")
-public class RestTemplateFactoryTest {
-    
-    public static void main(String[] args) {
-        
-        String propertyFile = RestTemplateFactoryTest.class.getClassLoader().getResource(".").getPath();
-        System.out.println(" Property : " + propertyFile);
-        
-        try {
-            ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl = new ConfigRestAdaptorServiceImpl(propertyFile);
-            String restconfResponse = genericRestGetMDSALOperation(args, configRestAdaptorServiceImpl);
-            System.out.println("RestTemplateFactoryTest.main Completed with response :" + restconfResponse);
-        } catch (ConfigRestAdaptorException e) {
-            e.printStackTrace();
-        }
-    }
-    
-    public static String genericRestGetMDSALOperation(String[] args,
-            ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl) throws ConfigRestAdaptorException {
-        String path = "config/Dummy-API:services/service-list/dummy-1234";
-        String restconfResponse = configRestAdaptorServiceImpl.getResource(ConfigRestAdaptorConstants.SELECTOR_RESTCONF,
-                path, String.class);
-        return restconfResponse;
-    }
-    
-}
+/*\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.config.rest.adaptor.utils;\r
+\r
+import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorConstants;\r
+import org.onap.ccsdk.config.rest.adaptor.ConfigRestAdaptorException;\r
+import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorServiceImpl;\r
+\r
+@SuppressWarnings("squid:S2187")\r
+public class RestTemplateFactoryTest {\r
+\r
+    public static void main(String[] args) {\r
+\r
+        String propertyFile = RestTemplateFactoryTest.class.getClassLoader().getResource(".").getPath();\r
+        System.out.println(" Property : " + propertyFile);\r
+\r
+        try {\r
+            ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl = new ConfigRestAdaptorServiceImpl(propertyFile);\r
+            String restconfResponse = genericRestGetMDSALOperation(args, configRestAdaptorServiceImpl);\r
+            System.out.println("RestTemplateFactoryTest.main Completed with response :" + restconfResponse);\r
+        } catch (ConfigRestAdaptorException e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    public static String genericRestGetMDSALOperation(String[] args,\r
+            ConfigRestAdaptorServiceImpl configRestAdaptorServiceImpl) throws ConfigRestAdaptorException {\r
+        String path = "config/Dummy-API:services/service-list/dummy-1234";\r
+        String restconfResponse = configRestAdaptorServiceImpl.getResource(ConfigRestAdaptorConstants.SELECTOR_RESTCONF,\r
+                path, String.class);\r
+        return restconfResponse;\r
+    }\r
+\r
+}\r
index 725e484..4527e89 100644 (file)
@@ -1,29 +1,45 @@
-#
-# Configuration file for SDNC Controller Module
-#
-
-org.onap.ccsdk.config.rest.adaptors.envtype=solo
-
-# Config Generator Microservices
-org.onap.ccsdk.config.rest.adaptors.modelservice.type=generic
-org.onap.ccsdk.config.rest.adaptors.modelservice.enable=true
-org.onap.ccsdk.config.rest.adaptors.modelservice.url=http://localhost:8080/configgenerator/service/
-org.onap.ccsdk.config.rest.adaptors.modelservice.user=admin
-org.onap.ccsdk.config.rest.adaptors.modelservice.passwd=admin
-
-# Generic RESTCONF Adaptor
-org.onap.ccsdk.config.rest.adaptors.restconf.type=generic
-org.onap.ccsdk.config.rest.adaptors.restconf.enable=true
-org.onap.ccsdk.config.rest.adaptors.restconf.user=admin
-org.onap.ccsdk.config.rest.adaptors.restconf.passwd=admin
-org.onap.ccsdk.config.rest.adaptors.restconf.url=http://localhost:8181/restconf/
-
-# SSL AAI Adaptor
-org.onap.ccsdk.config.rest.adaptors.aai.propertyfile=aai.properties
-org.onap.ccsdk.config.rest.adaptors.aai.type=ssl
-org.onap.ccsdk.config.rest.adaptors.aai.enable=true
-org.onap.ccsdk.config.rest.adaptors.aai.url=https://localhost:8443/onap-aai/
-org.onap.ccsdk.config.rest.adaptors.aai.ssl.trust=src/test/resources/truststore.client.jks
-org.onap.ccsdk.config.rest.adaptors.aai.ssl.trust.psswd=changeme
-org.onap.ccsdk.config.rest.adaptors.aai.ssl.key=src/test/resources/keystore.client.p12
-org.onap.ccsdk.config.rest.adaptors.aai.ssl.key.psswd=changeme
+###\r
+# Copyright © 2017-2018 AT&T Intellectual Property.\r
+# Modifications Copyright © 2018 IBM.\r
+# \r
+# Licensed under the Apache License, Version 2.0 (the "License");\r
+# you may not use this file except in compliance with the License.\r
+# You may obtain a copy of the License at\r
+# \r
+#     http://www.apache.org/licenses/LICENSE-2.0\r
+# \r
+# Unless required by applicable law or agreed to in writing, software\r
+# distributed under the License is distributed on an "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+# See the License for the specific language governing permissions and\r
+# limitations under the License.\r
+###\r
+#\r
+# Configuration file for SDNC Controller Module\r
+#\r
+\r
+org.onap.ccsdk.config.rest.adaptors.envtype=solo\r
+\r
+# Config Generator Microservices\r
+org.onap.ccsdk.config.rest.adaptors.modelservice.type=generic\r
+org.onap.ccsdk.config.rest.adaptors.modelservice.enable=true\r
+org.onap.ccsdk.config.rest.adaptors.modelservice.url=http://localhost:8080/configgenerator/service/\r
+org.onap.ccsdk.config.rest.adaptors.modelservice.user=admin\r
+org.onap.ccsdk.config.rest.adaptors.modelservice.passwd=admin\r
+\r
+# Generic RESTCONF Adaptor\r
+org.onap.ccsdk.config.rest.adaptors.restconf.type=generic\r
+org.onap.ccsdk.config.rest.adaptors.restconf.enable=true\r
+org.onap.ccsdk.config.rest.adaptors.restconf.user=admin\r
+org.onap.ccsdk.config.rest.adaptors.restconf.passwd=admin\r
+org.onap.ccsdk.config.rest.adaptors.restconf.url=http://localhost:8181/restconf/\r
+\r
+# SSL AAI Adaptor\r
+org.onap.ccsdk.config.rest.adaptors.aai.propertyfile=aai.properties\r
+org.onap.ccsdk.config.rest.adaptors.aai.type=ssl\r
+org.onap.ccsdk.config.rest.adaptors.aai.enable=true\r
+org.onap.ccsdk.config.rest.adaptors.aai.url=https://localhost:8443/onap-aai/\r
+org.onap.ccsdk.config.rest.adaptors.aai.ssl.trust=src/test/resources/truststore.client.jks\r
+org.onap.ccsdk.config.rest.adaptors.aai.ssl.trust.psswd=changeme\r
+org.onap.ccsdk.config.rest.adaptors.aai.ssl.key=src/test/resources/keystore.client.p12\r
+org.onap.ccsdk.config.rest.adaptors.aai.ssl.key.psswd=changeme\r
index 9ab5ae6..10e217b 100644 (file)
@@ -1,34 +1,37 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment;\r
 \r
 @SuppressWarnings("squid:S1118")\r
 public class ConfigAssignmentConstants {\r
-    \r
+\r
     public static final String OUTPUT_PARAM_STATUS = "status";\r
     public static final String OUTPUT_PARAM_RESOURCE_ASSIGNMENT_PARAMS = "resource-assignment-params";\r
     public static final String OUTPUT_PARAM_MASHED_DATA = "mashed-data";\r
     public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";\r
     public static final String OUTPUT_STATUS_SUCCESS = "success";\r
     public static final String OUTPUT_STATUS_FAILURE = "failure";\r
-    \r
+\r
     public static final String INPUT_PARAM_REQUEST_ID = "request-id";\r
     public static final String INPUT_PARAM_RESOURCE_ID = "resource-id";\r
     public static final String INPUT_PARAM_RESOURCE_TYPE = "resource-type";\r
     public static final String INPUT_PARAM_ACTION_NAME = "action-name";\r
     public static final String INPUT_PARAM_TEMPLATE_NAMES = "template-names";\r
     public static final String INPUT_PARAM_INPUT_DATA = "input-data";\r
-    \r
+\r
 }\r
index d8a2745..816c943 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.data;\r
@@ -21,7 +24,7 @@ import org.onap.ccsdk.config.model.data.ResourceAssignment;
 import org.onap.ccsdk.sli.core.sli.SvcLogicContext;\r
 \r
 public class ResourceAssignmentData {\r
-    \r
+\r
     private String requestId;\r
     private boolean reloadModel;\r
     private String resourceType;\r
@@ -37,123 +40,123 @@ public class ResourceAssignmentData {
     private Map<String, String> templatesMashedContents = new HashMap<>();\r
     private Map<String, String> templatesData = new HashMap<>();\r
     private Map<String, Object> context = new HashMap<>();\r
-    \r
+\r
     public String getRequestId() {\r
         return requestId;\r
     }\r
-    \r
+\r
     public void setRequestId(String requestId) {\r
         this.requestId = requestId;\r
     }\r
-    \r
+\r
     public String getResourceType() {\r
         return resourceType;\r
     }\r
-    \r
+\r
     public void setResourceType(String resourceType) {\r
         this.resourceType = resourceType;\r
     }\r
-    \r
+\r
     public String getResourceId() {\r
         return resourceId;\r
     }\r
-    \r
+\r
     public void setResourceId(String resourceId) {\r
         this.resourceId = resourceId;\r
     }\r
-    \r
+\r
     public String getServiceTemplateName() {\r
         return serviceTemplateName;\r
     }\r
-    \r
+\r
     public void setServiceTemplateName(String serviceTemplateName) {\r
         this.serviceTemplateName = serviceTemplateName;\r
     }\r
-    \r
+\r
     public String getServiceTemplateVersion() {\r
         return serviceTemplateVersion;\r
     }\r
-    \r
+\r
     public void setServiceTemplateVersion(String serviceTemplateVersion) {\r
         this.serviceTemplateVersion = serviceTemplateVersion;\r
     }\r
-    \r
+\r
     public String getActionName() {\r
         return actionName;\r
     }\r
-    \r
+\r
     public void setActionName(String actionName) {\r
         this.actionName = actionName;\r
     }\r
-    \r
+\r
     public String getInputData() {\r
         return inputData;\r
     }\r
-    \r
+\r
     public void setInputData(String inputData) {\r
         this.inputData = inputData;\r
     }\r
-    \r
+\r
     public List<String> getTemplateNames() {\r
         return templateNames;\r
     }\r
-    \r
+\r
     public void setTemplateNames(List<String> templateNames) {\r
         this.templateNames = templateNames;\r
     }\r
-    \r
+\r
     public Map<String, List<ResourceAssignment>> getTemplatesResourceAssignments() {\r
         return templatesResourceAssignments;\r
     }\r
-    \r
+\r
     public void setTemplatesResourceAssignments(Map<String, List<ResourceAssignment>> templatesResourceAssignments) {\r
         this.templatesResourceAssignments = templatesResourceAssignments;\r
     }\r
-    \r
+\r
     public Map<String, String> getTemplatesContents() {\r
         return templatesContents;\r
     }\r
-    \r
+\r
     public void setTemplatesContents(Map<String, String> templatesContents) {\r
         this.templatesContents = templatesContents;\r
     }\r
-    \r
+\r
     public Map<String, String> getTemplatesMashedContents() {\r
         return templatesMashedContents;\r
     }\r
-    \r
+\r
     public void setTemplatesMashedContents(Map<String, String> templatesMashedContents) {\r
         this.templatesMashedContents = templatesMashedContents;\r
     }\r
-    \r
+\r
     public Map<String, String> getTemplatesData() {\r
         return templatesData;\r
     }\r
-    \r
+\r
     public void setTemplatesData(Map<String, String> templatesData) {\r
         this.templatesData = templatesData;\r
     }\r
-    \r
+\r
     public Map<String, Object> getContext() {\r
         return context;\r
     }\r
-    \r
+\r
     public void setContext(Map<String, Object> context) {\r
         this.context = context;\r
     }\r
-    \r
+\r
     public SvcLogicContext getSvcLogicContext() {\r
         return svcLogicContext;\r
     }\r
-    \r
+\r
     public void setSvcLogicContext(SvcLogicContext svcLogicContext) {\r
         this.svcLogicContext = svcLogicContext;\r
     }\r
-    \r
+\r
     public boolean isReloadModel() {\r
         return reloadModel;\r
     }\r
-    \r
+\r
     public void setReloadModel(boolean reloadModel) {\r
         this.reloadModel = reloadModel;\r
     }\r
index d80fec8..5fcedd8 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.processor;\r
@@ -21,20 +24,20 @@ import org.onap.ccsdk.config.model.service.ComponentNodeService;
 import org.onap.ccsdk.config.rest.adaptor.service.ConfigRestAdaptorService;\r
 \r
 public class ProcessorFactory {\r
-    \r
+\r
     private ConfigResourceService configResourceService;\r
     private ConfigRestAdaptorService configRestAdaptorService;\r
     private ComponentNodeService componentNodeService;\r
-    \r
+\r
     public ProcessorFactory(ConfigResourceService configResourceService,\r
             ConfigRestAdaptorService configRestAdaptorService, ComponentNodeService componentNodeService) {\r
         this.componentNodeService = componentNodeService;\r
         this.configResourceService = configResourceService;\r
         this.configRestAdaptorService = configRestAdaptorService;\r
     }\r
-    \r
+\r
     public ComponentNode getInstance(String source) {\r
-        \r
+\r
         if (ConfigModelConstant.SOURCE_DEFAULT.equalsIgnoreCase(source)) {\r
             return new DefaultResourceProcessor(configResourceService);\r
         } else if (ConfigModelConstant.SOURCE_DB.equalsIgnoreCase(source)) {\r
@@ -45,5 +48,5 @@ public class ProcessorFactory {
         // Default\r
         return new InputResourceProcessor(configResourceService);\r
     }\r
-    \r
+\r
 }\r
index c1c9b93..70d9abc 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.processor;\r
@@ -27,16 +30,16 @@ import com.att.eelf.configuration.EELFManager;
 \r
 public class ResourceAssignmentProcessor {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentProcessor.class);\r
-    \r
+\r
     private List<ResourceAssignment> assignments;\r
     private Map<String, ResourceAssignment> resourceAssignmentMap;\r
-    \r
+\r
     @SuppressWarnings("squid:S1172")\r
     public ResourceAssignmentProcessor(List<ResourceAssignment> assignments, SvcLogicContext ctx) {\r
         this.assignments = assignments;\r
         this.resourceAssignmentMap = new HashMap<>();\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     public List<List<ResourceAssignment>> process() {\r
         List<List<ResourceAssignment>> sequenceBatchResourceAssignment = new ArrayList<>();\r
@@ -48,7 +51,7 @@ public class ResourceAssignmentProcessor {
                     resourceAssignmentMap.put(resourceMapping.getName(), resourceMapping);\r
                 }\r
             });\r
-            \r
+\r
             TopologicalSortingUtils<ResourceAssignment> topologySorting = new TopologicalSortingUtils<>();\r
             this.resourceAssignmentMap.forEach((mappingKey, mapping) -> {\r
                 if (mapping != null) {\r
@@ -61,30 +64,30 @@ public class ResourceAssignmentProcessor {
                     }\r
                 }\r
             });\r
-            \r
+\r
             List<ResourceAssignment> sequencedResourceAssignments = topologySorting.topSort();\r
             logger.info("Sorted Sequenced Assignments ({})", sequencedResourceAssignments);\r
-            \r
+\r
             List<ResourceAssignment> batchResourceAssignment = null;\r
             List<String> batchAssignmentName = null;\r
             for (int i = 0; i < sequencedResourceAssignments.size(); i++) {\r
                 ResourceAssignment resourceAssignment = sequencedResourceAssignments.get(i);\r
                 ResourceAssignment previousResourceAssignment = null;\r
-                \r
+\r
                 if (i > 0) {\r
                     previousResourceAssignment = sequencedResourceAssignments.get(i - 1);\r
                 }\r
                 if (resourceAssignment != null) {\r
-                    \r
+\r
                     boolean dependencyPresence = false;\r
                     if (batchAssignmentName != null && resourceAssignment.getDependencies() != null) {\r
                         dependencyPresence =\r
                                 CollectionUtils.containsAny(batchAssignmentName, resourceAssignment.getDependencies());\r
                     }\r
-                    \r
+\r
                     logger.trace("({}) -> Checking ({}), with ({}), result ({})", resourceAssignment.getName(),\r
                             batchAssignmentName, resourceAssignment.getDependencies(), dependencyPresence);\r
-                    \r
+\r
                     if (previousResourceAssignment != null && resourceAssignment.getDictionarySource() != null\r
                             && resourceAssignment.getDictionarySource()\r
                                     .equalsIgnoreCase(previousResourceAssignment.getDictionarySource())\r
@@ -98,12 +101,12 @@ public class ResourceAssignmentProcessor {
                         }\r
                         batchResourceAssignment = new ArrayList<>();\r
                         batchResourceAssignment.add(resourceAssignment);\r
-                        \r
+\r
                         batchAssignmentName = new ArrayList<>();\r
                         batchAssignmentName.add(resourceAssignment.getName());\r
                     }\r
                 }\r
-                \r
+\r
                 if (i == (sequencedResourceAssignments.size() - 1)) {\r
                     logger.trace("Created old Set ({})", batchAssignmentName);\r
                     sequenceBatchResourceAssignment.add(batchResourceAssignment);\r
@@ -113,5 +116,5 @@ public class ResourceAssignmentProcessor {
         }\r
         return sequenceBatchResourceAssignment;\r
     }\r
-    \r
+\r
 }\r
index e27d57a..320f436 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -31,59 +34,59 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ConfigAssignmentPersistService {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentPersistService.class);\r
-    \r
+\r
     private ConfigResourceService configResourceService;\r
-    \r
+\r
     public ConfigAssignmentPersistService(ConfigResourceService configResourceService) {\r
         this.configResourceService = configResourceService;\r
     }\r
-    \r
+\r
     public void saveResourceMapping(org.onap.ccsdk.config.assignment.data.ResourceAssignmentData resourceAssignmentData,\r
             String templateName, List<ResourceAssignment> resourceAssignments) throws SvcLogicException {\r
         try {\r
-            \r
+\r
             if (resourceAssignmentData == null) {\r
                 throw new SvcLogicException("Resource assignment data is missing");\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(resourceAssignmentData.getRequestId())) {\r
                 logger.warn("Request Id ({}) is missing, may be getting request for resource update.",\r
                         resourceAssignmentData.getRequestId());\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(resourceAssignmentData.getResourceId())) {\r
                 throw new SvcLogicException("Resource Id is missing");\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(resourceAssignmentData.getResourceType())) {\r
                 throw new SvcLogicException("Resource type is missing");\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(resourceAssignmentData.getActionName())) {\r
                 throw new SvcLogicException("Action name is missing");\r
             }\r
-            \r
+\r
             if (StringUtils.isBlank(templateName)) {\r
                 throw new SvcLogicException("template name is missing");\r
             }\r
-            \r
+\r
             StringBuilder builder = new StringBuilder();\r
             builder.append("Resource Assignment for Template Name :");\r
             builder.append(templateName);\r
             builder.append("\n");\r
             builder.append(TransformationUtils.getJson(resourceAssignments, true));\r
-            \r
+\r
             configResourceService.save(new TransactionLog(resourceAssignmentData.getRequestId(),\r
                     DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, builder.toString()));\r
-            \r
+\r
             // Resource Data should be Regenerated based on the new Updates\r
             String resourceData = ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments);\r
-            \r
+\r
             List<ResourceAssignmentData> resourceAssignmentDataList =\r
                     ConfigAssignmentUtils.convertResoureAssignmentList(resourceAssignments);\r
-            \r
+\r
             ConfigResource configResource = new ConfigResource();\r
             configResource.setRequestId(resourceAssignmentData.getRequestId());\r
             configResource.setServiceTemplateName(resourceAssignmentData.getServiceTemplateName());\r
@@ -95,14 +98,14 @@ public class ConfigAssignmentPersistService {
             configResource.setTemplateName(templateName);\r
             configResource.setStatus(ConfigModelConstant.STATUS_SUCCESS);\r
             configResource.setUpdatedBy(ConfigModelConstant.USER_SYSTEM);\r
-            \r
+\r
             if (CollectionUtils.isNotEmpty(resourceAssignmentDataList)) {\r
                 configResource.setResourceAssignments(resourceAssignmentDataList);\r
             }\r
             configResource = configResourceService.saveConfigResource(configResource);\r
             logger.info("Resource data saved successfully for the template ({}) with resource id ({})", templateName,\r
                     configResource.getResourceId());\r
-            \r
+\r
             builder = new StringBuilder();\r
             builder.append("Resource Data Template Name :");\r
             builder.append(templateName);\r
@@ -110,11 +113,11 @@ public class ConfigAssignmentPersistService {
             builder.append(resourceData);\r
             configResourceService.save(new TransactionLog(resourceAssignmentData.getRequestId(),\r
                     DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, builder.toString()));\r
-            \r
+\r
         } catch (Exception e) {\r
             throw new SvcLogicException("ConfigAssignmentPersistService : " + e.getMessage(), e);\r
         }\r
-        \r
+\r
     }\r
-    \r
+\r
 }\r
index 81e7689..85ff82d 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -40,15 +43,15 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ConfigAssignmentProcessService {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentProcessService.class);\r
-    \r
+\r
     private ComponentNodeService componentNodeService;\r
     private ConfigResourceService configResourceService;\r
     private ConfigModelService configModelService;\r
     private ConfigRestAdaptorService configRestAdaptorService;\r
     private ConfigGeneratorService configGeneratorService;\r
-    \r
+\r
     public ConfigAssignmentProcessService(ConfigResourceService configResourceService,\r
             ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,\r
             ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {\r
@@ -58,19 +61,19 @@ public class ConfigAssignmentProcessService {
         this.configRestAdaptorService = configRestAdaptorService;\r
         this.configGeneratorService = configGeneratorService;\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S1141")\r
     public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {\r
         try {\r
             validateInputParams(resourceAssignmentData);\r
-            \r
+\r
             String serviceTemplateName = resourceAssignmentData.getServiceTemplateName();\r
             String serviceTemplateVersion = resourceAssignmentData.getServiceTemplateVersion();\r
             String actionName = resourceAssignmentData.getActionName();\r
             String inputData = resourceAssignmentData.getInputData();\r
             SvcLogicContext svcLogicContext = resourceAssignmentData.getSvcLogicContext();\r
             List<String> templateNames = resourceAssignmentData.getTemplateNames();\r
-            \r
+\r
             if (resourceAssignmentData.isReloadModel()) {\r
                 Map<String, String> context = new HashMap<>();\r
                 context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, actionName);\r
@@ -79,21 +82,21 @@ public class ConfigAssignmentProcessService {
                 context.forEach((key, value) -> svcLogicContext.setAttribute(key, value));\r
                 logger.info("List of Resources provided in input: {}", svcLogicContext.toProperties());\r
             }\r
-            \r
+\r
             Map<String, Object> componentContext = resourceAssignmentData.getContext();\r
-            \r
+\r
             if (CollectionUtils.isNotEmpty(templateNames)) {\r
                 // Get the Resource Assignments for templates and Validate the mappings\r
                 ResourceModelService resourceModelService = new ResourceModelService(configModelService);\r
-                \r
+\r
                 // Get the Resource Assignment\r
                 Map<String, List<ResourceAssignment>> templatesResourceAssignments =\r
                         resourceModelService.getTemplatesResourceAssignments(svcLogicContext, templateNames);\r
-                \r
+\r
                 // Get the Template Contents\r
                 Map<String, String> templatesContents =\r
                         resourceModelService.getTemplatesContents(svcLogicContext, templateNames);\r
-                \r
+\r
                 // Process each template\r
                 for (String templateName : templateNames) {\r
                     List<ResourceAssignment> resourceAssignments = templatesResourceAssignments.get(templateName);\r
@@ -106,67 +109,67 @@ public class ConfigAssignmentProcessService {
                                     new ResourceDictionaryService(configRestAdaptorService);\r
                             Map<String, ResourceDefinition> dictionaries =\r
                                     resourceDictionaryService.getDataDictionaryDefinitions(resourceAssignments);\r
-                            \r
+\r
                             processResourceAssignments(resourceAssignmentData, svcLogicContext, componentContext,\r
                                     templateName, resourceAssignments, dictionaries);\r
-                            \r
+\r
                             logger.info("decrypting config data for templateName {}", templateName);\r
                             templateData =\r
                                     ResourceAssignmentUtils.generateResourceDataForAssignments(resourceAssignments);\r
                         } finally {\r
                             saveResourceMapping(resourceAssignmentData, templateName, resourceAssignments);\r
                         }\r
-                        \r
+\r
                         logger.info("generating config preview for templateName {}", templateName);\r
                         ConfigPreviewService configPreviewService = new ConfigPreviewService(configResourceService,\r
                                 configModelService, configGeneratorService);\r
                         String mashedData = configPreviewService.generatePreview(templateContent, templateData);\r
                         resourceAssignmentData.getTemplatesMashedContents().put(templateName, mashedData);\r
                         resourceAssignmentData.getTemplatesData().put(templateName, templateData);\r
-                        \r
+\r
                     } else {\r
                         // Do nothing for Mapping not found\r
                         logger.warn("No resource Assignment mappings to resolve for templateName {}", templateName);\r
                     }\r
                 }\r
             }\r
-            \r
+\r
         } catch (Exception e) {\r
             throw new SvcLogicException(e.getMessage(), e);\r
         }\r
     }\r
-    \r
+\r
     private void processResourceAssignments(ResourceAssignmentData resourceAssignmentData, SvcLogicContext ctx,\r
             Map<String, Object> componentContext, String templateName, List<ResourceAssignment> resourceAssignments,\r
             Map<String, ResourceDefinition> dictionaries) throws SvcLogicException {\r
-        \r
+\r
         String recipeName = resourceAssignmentData.getActionName();\r
-        \r
+\r
         ResourceAssignmentProcessor resourceAssignmentProcessor =\r
                 new ResourceAssignmentProcessor(resourceAssignments, ctx);\r
         List<List<ResourceAssignment>> sequenceBatchResourceAssignment = resourceAssignmentProcessor.process();\r
-        \r
+\r
         logger.debug("Resource dictionary Info  ({})", dictionaries);\r
-        \r
+\r
         if (sequenceBatchResourceAssignment != null) {\r
             componentContext.put(ConfigModelConstant.PROPERTY_ACTION_NAME, recipeName);\r
             componentContext.put(ConfigModelConstant.PROPERTY_TEMPLATE_NAME, templateName);\r
             componentContext.put(ConfigModelConstant.PROPERTY_DICTIONARIES, dictionaries);\r
             for (List<ResourceAssignment> batchResourceAssignment : sequenceBatchResourceAssignment) {\r
-                \r
+\r
                 processBatchResourceAssignments(resourceAssignmentData, ctx, componentContext, batchResourceAssignment);\r
-                \r
+\r
                 logger.debug("Batch Resource data status ({})", TransformationUtils.getJson(batchResourceAssignment));\r
             }\r
         }\r
     }\r
-    \r
+\r
     private void processBatchResourceAssignments(ResourceAssignmentData resourceAssignmentData, SvcLogicContext ctx,\r
             Map<String, Object> componentContext, List<ResourceAssignment> batchResourceAssignment)\r
             throws SvcLogicException {\r
-        \r
+\r
         if (CollectionUtils.isNotEmpty(batchResourceAssignment)) {\r
-            \r
+\r
             ResourceAssignment batchFirstResourceAssignment = batchResourceAssignment.get(0);\r
             if (batchFirstResourceAssignment != null\r
                     && StringUtils.isNotBlank(batchFirstResourceAssignment.getDictionarySource())) {\r
@@ -174,12 +177,12 @@ public class ConfigAssignmentProcessService {
                 // Processing their Source\r
                 logger.info("Processing source ({})  with batch ({}) ", source, batchResourceAssignment);\r
                 componentContext.put(ConfigModelConstant.PROPERTY_RESOURCE_ASSIGNMENTS, batchResourceAssignment);\r
-                \r
+\r
                 ProcessorFactory factory =\r
                         new ProcessorFactory(configResourceService, configRestAdaptorService, componentNodeService);\r
-                \r
+\r
                 ComponentNode processor = factory.getInstance(source);\r
-                \r
+\r
                 Map<String, String> inParams = new HashMap<>();\r
                 inParams.put(ConfigAssignmentConstants.INPUT_PARAM_REQUEST_ID, resourceAssignmentData.getRequestId());\r
                 inParams.put(ConfigAssignmentConstants.INPUT_PARAM_RESOURCE_ID, resourceAssignmentData.getResourceId());\r
@@ -192,23 +195,23 @@ public class ConfigAssignmentProcessService {
             }\r
         }\r
     }\r
-    \r
+\r
     private void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,\r
             List<ResourceAssignment> resourceAssignments) throws SvcLogicException {\r
         if (resourceAssignmentData != null && StringUtils.isNotBlank(templateName)) {\r
-            \r
+\r
             ConfigAssignmentPersistService configAssignmentPersistService =\r
                     new ConfigAssignmentPersistService(configResourceService);\r
             configAssignmentPersistService.saveResourceMapping(resourceAssignmentData, templateName,\r
                     resourceAssignments);\r
         }\r
     }\r
-    \r
+\r
     private void validateInputParams(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {\r
         if (resourceAssignmentData == null) {\r
             throw new SvcLogicException("Input parameters missing");\r
         }\r
-        \r
+\r
         String requestId = resourceAssignmentData.getRequestId();\r
         if (StringUtils.isBlank(requestId)) {\r
             throw new SvcLogicException("Request id parameters missing");\r
@@ -225,11 +228,11 @@ public class ConfigAssignmentProcessService {
         if (StringUtils.isBlank(actionName)) {\r
             throw new SvcLogicException("Action name is parameter is missing");\r
         }\r
-        \r
+\r
         List<String> templatesNames = resourceAssignmentData.getTemplateNames();\r
         if (CollectionUtils.isEmpty(templatesNames)) {\r
             throw new SvcLogicException("Template names parameter missing");\r
         }\r
     }\r
-    \r
+\r
 }\r
index e0fcc91..4866f25 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -20,13 +23,13 @@ import org.onap.ccsdk.config.model.data.ResourceAssignment;
 import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
 \r
 public interface ConfigAssignmentService {\r
-    \r
+\r
     public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException;\r
-    \r
+\r
     public void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,\r
             List<ResourceAssignment> resourceAssignments) throws SvcLogicException;\r
-    \r
+\r
     public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)\r
             throws SvcLogicException;\r
-    \r
+\r
 }\r
index 48e15b1..9e2bdcf 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -27,17 +30,17 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentServiceImpl.class);\r
-    \r
+\r
     private ComponentNodeService componentNodeService;\r
     private ConfigResourceService configResourceService;\r
     private ConfigModelService configModelService;\r
     private ConfigRestAdaptorService configRestAdaptorService;\r
     private ConfigGeneratorService configGeneratorService;\r
-    \r
+\r
     private static final String CLASS_NAME = "ConfigAssignmentServiceImpl";\r
-    \r
+\r
     public ConfigAssignmentServiceImpl(ConfigResourceService configResourceService,\r
             ConfigRestAdaptorService configRestAdaptorService, ConfigModelService configModelService,\r
             ComponentNodeService componentNodeService, ConfigGeneratorService configGeneratorService) {\r
@@ -48,7 +51,7 @@ public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
         this.configRestAdaptorService = configRestAdaptorService;\r
         this.configGeneratorService = configGeneratorService;\r
     }\r
-    \r
+\r
     @Override\r
     public void resolveResources(ResourceAssignmentData resourceAssignmentData) throws SvcLogicException {\r
         ConfigAssignmentProcessService configAssignmentProcessService =\r
@@ -56,7 +59,7 @@ public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
                         componentNodeService, configGeneratorService);\r
         configAssignmentProcessService.resolveResources(resourceAssignmentData);\r
     }\r
-    \r
+\r
     @Override\r
     public void saveResourceMapping(ResourceAssignmentData resourceAssignmentData, String templateName,\r
             List<ResourceAssignment> resourceAssignments) throws SvcLogicException {\r
@@ -64,7 +67,7 @@ public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
                 new ConfigAssignmentPersistService(configResourceService);\r
         configAssignmentPersistService.saveResourceMapping(resourceAssignmentData, templateName, resourceAssignments);\r
     }\r
-    \r
+\r
     @Override\r
     public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)\r
             throws SvcLogicException {\r
@@ -72,5 +75,5 @@ public class ConfigAssignmentServiceImpl implements ConfigAssignmentService {
                 new ConfigPreviewService(configResourceService, configModelService, configGeneratorService);\r
         return configPreviewService.generateTemplateResourceMash(resourceAssignmentData);\r
     }\r
-    \r
+\r
 }\r
index 1f74b71..32adbe2 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -44,13 +47,13 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;\r
 \r
 public class ConfigAssignmentUtils {\r
-    \r
+\r
     private ConfigAssignmentUtils() {\r
-        \r
+\r
     }\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigAssignmentUtils.class);\r
-    \r
+\r
     public static synchronized Object getContextKeyValue(SvcLogicContext context, String key) {\r
         Object value = null;\r
         if (context != null && key != null) {\r
@@ -65,7 +68,7 @@ public class ConfigAssignmentUtils {
         }\r
         return value;\r
     }\r
-    \r
+\r
     /*\r
      * Populate the Field property type for the Data type\r
      */\r
@@ -98,7 +101,7 @@ public class ConfigAssignmentUtils {
         }\r
         return type;\r
     }\r
-    \r
+\r
     /*\r
      * Populate the Field property type for the Data type\r
      */\r
@@ -126,7 +129,7 @@ public class ConfigAssignmentUtils {
         }\r
         return propertyDefinition;\r
     }\r
-    \r
+\r
     public static synchronized ResourceDefinition getDictionaryDefinition(Map<String, ResourceDictionary> dictionaries,\r
             String dictionaryName) {\r
         ResourceDefinition resourceDefinition = null;\r
@@ -139,7 +142,7 @@ public class ConfigAssignmentUtils {
         }\r
         return resourceDefinition;\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     public static synchronized void populateValueForOutputMapping(SvcLogicContext ctx,\r
             Map<String, Object> componentContext, ResourceAssignment resourceAssignment,\r
@@ -148,19 +151,19 @@ public class ConfigAssignmentUtils {
         if (resourceAssignment == null) {\r
             throw new SvcLogicException("resourceAssignment is null.");\r
         }\r
-        \r
+\r
         if (ctx == null) {\r
             throw new SvcLogicException("service logic context is null.");\r
         }\r
-        \r
+\r
         if (componentContext == null) {\r
             throw new SvcLogicException("component context is null.");\r
         }\r
-        \r
+\r
         logger.info("populating value for output mapping ({}), from json ({})", outputKeyMapping, responseNode);\r
         String dictionaryName = resourceAssignment.getDictionaryName();\r
         String type = resourceAssignment.getProperty().getType();\r
-        \r
+\r
         String entrySchema = null;\r
         if (ValidTypes.getPrimitivePropertType().contains(type)) {\r
             ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, responseNode);\r
@@ -169,7 +172,7 @@ public class ConfigAssignmentUtils {
             if (resourceAssignment.getProperty().getEntrySchema() != null) {\r
                 entrySchema = resourceAssignment.getProperty().getEntrySchema().getType();\r
             }\r
-            \r
+\r
             if (StringUtils.isNotBlank(entrySchema)) {\r
                 ArrayNode arrayNode = JsonNodeFactory.instance.arrayNode();\r
                 if (ValidTypes.getPrimitivePropertType().contains(entrySchema)) {\r
@@ -181,7 +184,7 @@ public class ConfigAssignmentUtils {
                             ObjectNode arrayChildNode = JsonNodeFactory.instance.objectNode();\r
                             for (Map.Entry<String, String> mapping : outputKeyMapping.entrySet()) {\r
                                 JsonNode responseKeyValue = responseSingleJsonNode.get(mapping.getKey());\r
-                                \r
+\r
                                 String propertyTypeForDataType =\r
                                         ConfigAssignmentUtils.getPropertyType(ctx, entrySchema, mapping.getKey());\r
                                 logger.info("For List Type Resource: key ({}), value ({}), type  ({})",\r
@@ -221,7 +224,7 @@ public class ConfigAssignmentUtils {
             ResourceAssignmentUtils.setResourceDataValue(componentContext, resourceAssignment, objectNode);\r
         }\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     public static synchronized List<ResourceAssignment> convertResoureAssignmentDataList(\r
             List<ResourceAssignmentData> resourceAssignmentDataList) {\r
@@ -240,7 +243,7 @@ public class ConfigAssignmentUtils {
                     resourceAssignment.setMessage(resourceAssignmentData.getMessage());\r
                     PropertyDefinition property = new PropertyDefinition();\r
                     property.setType(resourceAssignmentData.getDataType());\r
-                    \r
+\r
                     if (StringUtils.isNotBlank(resourceAssignmentData.getResourceValue())) {\r
                         if (ValidTypes.getPrimitivePropertType().contains(resourceAssignmentData.getDataType())) {\r
                             property.setValue(resourceAssignmentData.getResourceValue());\r
@@ -261,11 +264,11 @@ public class ConfigAssignmentUtils {
                     assignments.add(resourceAssignment);\r
                 }\r
             }\r
-            \r
+\r
         }\r
         return assignments;\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     public static synchronized List<ResourceAssignmentData> convertResoureAssignmentList(\r
             List<ResourceAssignment> assignments) {\r
@@ -298,5 +301,5 @@ public class ConfigAssignmentUtils {
         }\r
         return resourceAssignmentDataList;\r
     }\r
-    \r
+\r
 }\r
index 7aa2d43..ae5c01c 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -35,14 +38,14 @@ public class ConfigPreviewService {
     private ConfigResourceService configResourceService;\r
     private ConfigModelService configModelService;\r
     private ConfigGeneratorService configGeneratorService;\r
-    \r
+\r
     public ConfigPreviewService(ConfigResourceService configResourceService, ConfigModelService configModelService,\r
             ConfigGeneratorService configGeneratorService) {\r
         this.configResourceService = configResourceService;\r
         this.configModelService = configModelService;\r
         this.configGeneratorService = configGeneratorService;\r
     }\r
-    \r
+\r
     public String generatePreview(String templateContent, String templateData) throws SvcLogicException {\r
         String mashedData = "";\r
         ConfigGeneratorInfo configGeneratorInfo =\r
@@ -52,7 +55,7 @@ public class ConfigPreviewService {
         }\r
         return mashedData;\r
     }\r
-    \r
+\r
     public ResourceAssignmentData generateTemplateResourceMash(ResourceAssignmentData resourceAssignmentData)\r
             throws SvcLogicException {\r
         if (resourceAssignmentData == null) {\r
@@ -73,25 +76,25 @@ public class ConfigPreviewService {
         if (StringUtils.isBlank(resourceAssignmentData.getActionName())) {\r
             throw new SvcLogicException("Action name is missing");\r
         }\r
-        \r
+\r
         String serviceTemplateName = resourceAssignmentData.getServiceTemplateName();\r
         String serviceTemplateVersion = resourceAssignmentData.getServiceTemplateVersion();\r
         String actionName = resourceAssignmentData.getActionName();\r
         String resourceId = resourceAssignmentData.getResourceId();\r
         String resourceType = resourceAssignmentData.getResourceType();\r
         String inputData = "{}";\r
-        \r
+\r
         Map<String, String> context = new HashMap<>();\r
         context.put(ConfigModelConstant.PROPERTY_ACTION_NAME, actionName);\r
         context = configModelService.prepareContext(context, inputData, serviceTemplateName, serviceTemplateVersion);\r
-        \r
+\r
         ConfigResource configResourceQuery = new ConfigResource();\r
         configResourceQuery.setServiceTemplateVersion(serviceTemplateName);\r
         configResourceQuery.setServiceTemplateVersion(serviceTemplateVersion);\r
         configResourceQuery.setRecipeName(actionName);\r
         configResourceQuery.setResourceId(resourceId);\r
         configResourceQuery.setResourceType(resourceType);\r
-        \r
+\r
         List<ConfigResource> configResources = configResourceService.getConfigResource(configResourceQuery);\r
         if (CollectionUtils.isNotEmpty(configResources)) {\r
             for (ConfigResource cr : configResources) {\r
@@ -110,7 +113,7 @@ public class ConfigPreviewService {
                     serviceTemplateName, serviceTemplateVersion, actionName, resourceId, resourceType);\r
         }\r
         return resourceAssignmentData;\r
-        \r
+\r
     }\r
-    \r
+\r
 }\r
index 97a4dd4..50562b0 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -31,14 +34,14 @@ import com.att.eelf.configuration.EELFLogger;
 import com.att.eelf.configuration.EELFManager;\r
 \r
 public class ResourceDictionaryService {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceDictionaryService.class);\r
     private ConfigRestAdaptorService configRestAdaptorService;\r
-    \r
+\r
     public ResourceDictionaryService(ConfigRestAdaptorService configRestAdaptorService) {\r
         this.configRestAdaptorService = configRestAdaptorService;\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     public Map<String, ResourceDefinition> getDataDictionaryDefinitions(List<ResourceAssignment> resourceAssignments)\r
             throws SvcLogicException {\r
@@ -48,11 +51,11 @@ public class ResourceDictionaryService {
                 List<String> names = new ArrayList<>();\r
                 for (ResourceAssignment resourceAssignment : resourceAssignments) {\r
                     if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {\r
-                        \r
+\r
                         if (!names.contains(resourceAssignment.getDictionaryName())) {\r
                             names.add(resourceAssignment.getDictionaryName());\r
                         }\r
-                        \r
+\r
                         if (resourceAssignment.getDependencies() != null\r
                                 && !resourceAssignment.getDependencies().isEmpty()) {\r
                             List<String> dependencieNames = resourceAssignment.getDependencies();\r
@@ -70,18 +73,18 @@ public class ResourceDictionaryService {
         } catch (Exception e) {\r
             throw new SvcLogicException("Failed in getting resource data dictionary : " + e.getMessage());\r
         }\r
-        \r
+\r
     }\r
-    \r
+\r
     @SuppressWarnings("squid:S3776")\r
     private void queryResourceDictionaryDefinitions(Map<String, ResourceDefinition> dictionaries, List<String> names)\r
             throws SvcLogicException, ConfigRestAdaptorException {\r
         logger.info("Getting resource dictionary definition for the names ({})", names);\r
         if (!names.isEmpty()) {\r
-            \r
+\r
             String dictionaryContents = configRestAdaptorService.postResource(\r
                     ConfigRestAdaptorConstants.SELECTOR_MODEL_SERVICE, "dictionarybynames", names, String.class);\r
-            \r
+\r
             if (StringUtils.isNotBlank(dictionaryContents)) {\r
                 List<ResourceDictionary> dataDictionaries =\r
                         TransformationUtils.getListfromJson(dictionaryContents, ResourceDictionary.class);\r
index 7eb2196..9f3013b 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -30,13 +33,13 @@ import com.att.eelf.configuration.EELFManager;
 \r
 public class ResourceModelService {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceModelService.class);\r
-    \r
+\r
     private ConfigModelService configModelService;\r
-    \r
+\r
     public ResourceModelService(ConfigModelService configModelService) {\r
         this.configModelService = configModelService;\r
     }\r
-    \r
+\r
     public Map<String, String> getTemplatesContents(SvcLogicContext ctx, List<String> templateNames)\r
             throws SvcLogicException {\r
         Map<String, String> templatesContents = new HashMap<>();\r
@@ -53,7 +56,7 @@ public class ResourceModelService {
         }\r
         return templatesContents;\r
     }\r
-    \r
+\r
     public Map<String, List<ResourceAssignment>> getTemplatesResourceAssignments(SvcLogicContext ctx,\r
             List<String> templateNames) throws SvcLogicException {\r
         Map<String, List<ResourceAssignment>> templatesResourceAssignments = new HashMap<>();\r
@@ -63,12 +66,12 @@ public class ResourceModelService {
                     String resourceMappingContent = this.configModelService.getNodeTemplateMapping(ctx, templateName);\r
                     logger.info("Processing template ({}) with resource assignment content : {}", templateName,\r
                             resourceMappingContent);\r
-                    \r
+\r
                     if (StringUtils.isNotBlank(resourceMappingContent)) {\r
-                        \r
+\r
                         List<ResourceAssignment> resourceAssignments =\r
                                 TransformationUtils.getListfromJson(resourceMappingContent, ResourceAssignment.class);\r
-                        \r
+\r
                         if (resourceAssignments != null) {\r
                             ResourceAssignmentValidator resourceAssignmentValidator =\r
                                     new ResourceAssignmentValidator(resourceAssignments);\r
@@ -88,7 +91,7 @@ public class ResourceModelService {
         } catch (Exception e) {\r
             throw new SvcLogicException(e.getMessage());\r
         }\r
-        \r
+\r
         return templatesResourceAssignments;\r
     }\r
 }\r
index ebefd64..c880c8d 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
   Copyright © 2017-2018 AT&T Intellectual Property.\r
+  Modifications Copyright © 2018 IBM.\r
   \r
   Licensed under the Apache License, Version 2.0 (the "License");\r
   you may not use this file except in compliance with the License.\r
index 4696fd2..75b7f2e 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -39,37 +42,37 @@ import com.att.eelf.configuration.EELFManager;
 \r
 @RunWith(MockitoJUnitRunner.class)\r
 public class ConfigPreviewServiceTest {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigPreviewServiceTest.class);\r
-    \r
+\r
     @Rule\r
     public ExpectedException thrown = ExpectedException.none();\r
-    \r
+\r
     @Mock\r
     private ConfigResourceService configResourceService;\r
-    \r
+\r
     @Mock\r
     private ConfigRestAdaptorService configRestAdaptorService;\r
-    \r
+\r
     private ConfigModelService configModelService;\r
     private ConfigGeneratorService configGeneratorService;\r
-    \r
+\r
     @SuppressWarnings("unchecked")\r
     @Before\r
     public void before() throws Exception {\r
         MockitoAnnotations.initMocks(this);\r
     }\r
-    \r
+\r
     @Test\r
     public void testGenerateTemplateResourceMash() throws Exception {\r
-        \r
+\r
         ConfigResourceAssignmentTestUtils.injectTransactionLogSaveMock(configResourceService);\r
-        \r
+\r
         ConfigResourceAssignmentTestUtils.injectConfigModelMock(configRestAdaptorService, "resource_assignment");\r
-        \r
+\r
         ConfigResourceAssignmentTestUtils.injectResourceDictionaryMock(configRestAdaptorService,\r
                 "assignments/empty-dictionary.json");\r
-        \r
+\r
         ConfigResource configResourceQuery = new ConfigResource();\r
         configResourceQuery.setServiceTemplateVersion("sample-serviceTemplateName");\r
         configResourceQuery.setServiceTemplateVersion("1.0.0");\r
@@ -80,28 +83,28 @@ public class ConfigPreviewServiceTest {
         String inputContent = FileUtils.readFileToString(\r
                 new File("src/test/resources/service_templates/input/input.json"), Charset.defaultCharset());\r
         configResourceQuery.setResourceData(inputContent);\r
-        \r
+\r
         ConfigResourceAssignmentTestUtils.injectGetConfigResourceMock(configResourceService, configResourceQuery);\r
-        \r
+\r
         configModelService = new ConfigModelServiceImpl(configRestAdaptorService);\r
         configGeneratorService = new ConfigGeneratorServiceImpl(configResourceService);\r
-        \r
+\r
         ConfigPreviewService configPreviewService =\r
                 new ConfigPreviewService(configResourceService, configModelService, configGeneratorService);\r
-        \r
+\r
         ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();\r
         resourceAssignmentData.setResourceId("123-resourceId");\r
         resourceAssignmentData.setResourceType("sample-resourceType");\r
         resourceAssignmentData.setServiceTemplateName("sample-serviceTemplateName");\r
         resourceAssignmentData.setServiceTemplateVersion("1.0.0");\r
         resourceAssignmentData.setActionName("sample-action");\r
-        \r
+\r
         resourceAssignmentData = configPreviewService.generateTemplateResourceMash(resourceAssignmentData);\r
-        \r
+\r
         Assert.assertNotNull("Failed to get GenerateTemplateResourceMash response.", resourceAssignmentData);\r
         Assert.assertNotNull("Failed to get template mashed contents.",\r
                 resourceAssignmentData.getTemplatesMashedContents());\r
-        \r
+\r
         Assert.assertNotNull("Failed to get base-config template mashed contents.",\r
                 resourceAssignmentData.getTemplatesMashedContents().get("base-config-template"));\r
     }\r
index f4ee969..ee1c076 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -44,9 +47,9 @@ import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;\r
 \r
 public class ConfigResourceAssignmentTestUtils {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceAssignmentTestUtils.class);\r
-    \r
+\r
     public static void injectTransactionLogSaveMock(ConfigResourceService configResourceService) throws Exception {\r
         Mockito.doAnswer(new Answer<Void>() {\r
             @Override\r
@@ -59,10 +62,10 @@ public class ConfigResourceAssignmentTestUtils {
             }\r
         }).when(configResourceService).save(any(TransactionLog.class));\r
     }\r
-    \r
+\r
     public static void injectConfigModelMock(ConfigRestAdaptorService configRestAdaptorService,\r
             String serviceTemplateName) throws Exception {\r
-        \r
+\r
         Mockito.doAnswer(new Answer<ConfigModel>() {\r
             @Override\r
             public org.onap.ccsdk.config.model.domain.ConfigModel answer(InvocationOnMock invocationOnMock)\r
@@ -70,23 +73,23 @@ public class ConfigResourceAssignmentTestUtils {
                 Object[] args = invocationOnMock.getArguments();\r
                 org.onap.ccsdk.config.model.domain.ConfigModel serviceArtifact = null;\r
                 if (args != null && args.length == 3) {\r
-                    \r
+\r
                     logger.info("Artifact info " + Arrays.asList(args));\r
                     String modelContent = IOUtils.toString(\r
                             ConfigResourceAssignmentTestUtils.class.getClassLoader().getResourceAsStream(\r
                                     "service_templates/" + serviceTemplateName + "/" + serviceTemplateName + ".json"),\r
                             Charset.defaultCharset());\r
-                    \r
+\r
                     ConfigModelContent configModelContent = new ConfigModelContent();\r
                     configModelContent.setContent(modelContent);\r
                     configModelContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TOSCA_JSON);\r
-                    \r
+\r
                     List<ConfigModelContent> configModelContents = new ArrayList<>();\r
                     configModelContents.add(configModelContent);\r
-                    \r
+\r
                     String velocityDir = ConfigResourceAssignmentTestUtils.class.getClassLoader()\r
                             .getResource("service_templates/" + serviceTemplateName + "/velocity").getPath();\r
-                    \r
+\r
                     Collection<File> templateFiles =\r
                             FileUtils.listFiles(new File(velocityDir), new String[] {"vtl"}, true);\r
                     logger.info("Template Files info " + templateFiles);\r
@@ -98,22 +101,22 @@ public class ConfigResourceAssignmentTestUtils {
                         configModelTemplateContent.setContentType(ConfigModelConstant.MODEL_CONTENT_TYPE_TEMPLATE);\r
                         configModelContents.add(configModelTemplateContent);\r
                     }\r
-                    \r
+\r
                     serviceArtifact = new org.onap.ccsdk.config.model.domain.ConfigModel();\r
                     serviceArtifact.setArtifactName(String.valueOf(args[0]));\r
                     serviceArtifact.setArtifactVersion(String.valueOf(args[1]));\r
                     serviceArtifact.setPublished("Y");\r
                     serviceArtifact.setConfigModelContents(configModelContents);\r
                 }\r
-                \r
+\r
                 return serviceArtifact;\r
             }\r
         }).when(configRestAdaptorService).getResource(anyString(), anyString(), Matchers.any(Class.class));\r
     }\r
-    \r
+\r
     public static void injectResourceDictionaryMock(ConfigRestAdaptorService configRestAdaptorService,\r
             String dictionaryFileName) throws Exception {\r
-        \r
+\r
         Mockito.doAnswer(new Answer<String>() {\r
             @Override\r
             public String answer(InvocationOnMock invocationOnMock) throws Throwable {\r
@@ -130,7 +133,7 @@ public class ConfigResourceAssignmentTestUtils {
         }).when(configRestAdaptorService).postResource(Matchers.any(), Matchers.any(), Matchers.any(),\r
                 Matchers.any(Class.class));\r
     }\r
-    \r
+\r
     public static void injectConfigResourceSaveMock(ConfigResourceService configResourceService) throws Exception {\r
         Mockito.doAnswer(new Answer<ConfigResource>() {\r
             @Override\r
@@ -146,7 +149,7 @@ public class ConfigResourceAssignmentTestUtils {
             }\r
         }).when(configResourceService).saveConfigResource(any(ConfigResource.class));\r
     }\r
-    \r
+\r
     public static void injectGetConfigResourceMock(ConfigResourceService configResourceService,\r
             ConfigResource configResource) throws Exception {\r
         Mockito.doAnswer(new Answer<List<ConfigResource>>() {\r
@@ -161,12 +164,12 @@ public class ConfigResourceAssignmentTestUtils {
             }\r
         }).when(configResourceService).getConfigResource(any(ConfigResource.class));\r
     }\r
-    \r
+\r
     public static String getFileContent(String filePath) throws Exception {\r
         return IOUtils.toString(ConfigResourceAssignmentTestUtils.class.getClassLoader().getResourceAsStream(filePath),\r
                 Charset.defaultCharset());\r
     }\r
-    \r
+\r
     public static Map<String, ResourceDefinition> getMapfromJson(String content) {\r
         try {\r
             ObjectMapper mapper = new ObjectMapper();\r
index e979ea3..3dc7da7 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -31,16 +34,16 @@ import com.att.eelf.configuration.EELFManager;
 import com.fasterxml.jackson.databind.JsonNode;\r
 \r
 public class ResourceAssignmentGenerationTest {\r
-    \r
+\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentGenerationTest.class);\r
-    \r
+\r
     @Test\r
     public void testResourceDataSetting() {\r
         try {\r
             logger.info(" **************** testResourceDataSetting *****************");\r
             String resourceAssignmentContents = IOUtils.toString(TopologicalSortingTest.class.getClassLoader()\r
                     .getResourceAsStream("assignments/alltype-empty-value-mapping.json"), Charset.defaultCharset());\r
-            \r
+\r
             List<ResourceAssignment> assignments =\r
                     TransformationUtils.getListfromJson(resourceAssignmentContents, ResourceAssignment.class);\r
             if (assignments != null) {\r
@@ -75,33 +78,33 @@ public class ResourceAssignmentGenerationTest {
                 }\r
                 String generatedData = ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);\r
                 logger.trace("Generated Data " + generatedData);\r
-                \r
+\r
                 Assert.assertNotNull("Failed to generate resource data", generatedData);\r
             }\r
         } catch (Exception e) {\r
             e.printStackTrace();\r
         }\r
     }\r
-    \r
+\r
     @Test\r
     public void testGenerateResourceData() {\r
         try {\r
             logger.info(" **************** testGenerateResourceData *****************");\r
             String resourceAssignmentContents = IOUtils.toString(TopologicalSortingTest.class.getClassLoader()\r
                     .getResourceAsStream("assignments/alltype-mapping.json"), Charset.defaultCharset());\r
-            \r
+\r
             List<ResourceAssignment> assignments =\r
                     TransformationUtils.getListfromJson(resourceAssignmentContents, ResourceAssignment.class);\r
             if (assignments != null) {\r
-                \r
+\r
                 String generatedData = ResourceAssignmentUtils.generateResourceDataForAssignments(assignments);\r
                 logger.trace("Generated Data " + generatedData);\r
-                \r
+\r
                 Assert.assertNotNull("Failed to generate resource data", generatedData);\r
             }\r
         } catch (Exception e) {\r
             e.printStackTrace();\r
         }\r
     }\r
-    \r
+\r
 }\r
index 0bf74b4..d708404 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -31,10 +34,10 @@ import com.att.eelf.configuration.EELFManager;
 \r
 public class ResourceAssignmentValidation {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(ResourceAssignmentValidation.class);\r
-    \r
+\r
     @Rule\r
     public final ExpectedException exception = ExpectedException.none();\r
-    \r
+\r
     @Test\r
     public void testValidateSuccess() {\r
         try {\r
@@ -42,12 +45,12 @@ public class ResourceAssignmentValidation {
             String resourceMapping = IOUtils.toString(\r
                     TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/success.json"),\r
                     Charset.defaultCharset());\r
-            \r
+\r
             List<ResourceAssignment> assignments =\r
                     TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);\r
             if (assignments != null) {\r
                 ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);\r
-                \r
+\r
                 boolean result = resourceAssignmentValidator.validateResourceAssignment();\r
                 Assert.assertTrue("Failed to Validate", result);\r
             }\r
@@ -55,37 +58,37 @@ public class ResourceAssignmentValidation {
             e.printStackTrace();\r
         }\r
     }\r
-    \r
+\r
     @Test(expected = ConfigModelException.class)\r
     public void testValidateDuplicate() throws IOException, ConfigModelException {\r
         logger.info(" **************** testValidateDuplicate *****************");\r
         String resourceMapping = IOUtils.toString(\r
                 TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/duplicate.json"),\r
                 Charset.defaultCharset());\r
-        \r
+\r
         List<ResourceAssignment> assignments =\r
                 TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);\r
         if (assignments != null) {\r
             ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);\r
             resourceAssignmentValidator.validateResourceAssignment();\r
         }\r
-        \r
+\r
     }\r
-    \r
+\r
     @Test(expected = ConfigModelException.class)\r
     public void testValidateCyclic() throws IOException, ConfigModelException {\r
         logger.info(" ****************  testValidateCyclic *****************");\r
         String resourceMapping = IOUtils.toString(\r
                 TopologicalSortingTest.class.getClassLoader().getResourceAsStream("validation/cyclic.json"),\r
                 Charset.defaultCharset());\r
-        \r
+\r
         List<ResourceAssignment> assignments =\r
                 TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);\r
         if (assignments != null) {\r
             ResourceAssignmentValidator resourceAssignmentValidator = new ResourceAssignmentValidator(assignments);\r
-            \r
+\r
             resourceAssignmentValidator.validateResourceAssignment();\r
         }\r
-        \r
+\r
     }\r
 }\r
index 1b05e4b..e4b7f5d 100644 (file)
@@ -1,15 +1,18 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
  * \r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
- * in compliance with the License. You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
  * \r
  * http://www.apache.org/licenses/LICENSE-2.0\r
  * \r
- * Unless required by applicable law or agreed to in writing, software distributed under the License\r
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
- * or implied. See the License for the specific language governing permissions and limitations under\r
- * the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
  */\r
 \r
 package org.onap.ccsdk.config.assignment.service;\r
@@ -28,7 +31,7 @@ import com.att.eelf.configuration.EELFManager;
 \r
 public class TopologicalSortingTest {\r
     private static EELFLogger logger = EELFManager.getInstance().getLogger(TopologicalSortingTest.class);\r
-    \r
+\r
     @Test\r
     public void testBulkSequencingMapping() {\r
         try {\r
@@ -36,7 +39,7 @@ public class TopologicalSortingTest {
             String resourceMapping = IOUtils.toString(\r
                     TopologicalSortingTest.class.getClassLoader().getResourceAsStream("mapping/dependency.json"),\r
                     Charset.defaultCharset());\r
-            \r
+\r
             List<ResourceAssignment> assignments =\r
                     TransformationUtils.getListfromJson(resourceMapping, ResourceAssignment.class);\r
             if (assignments != null) {\r
@@ -44,7 +47,7 @@ public class TopologicalSortingTest {
                 ResourceAssignmentProcessor resourceAssignmentProcessor =\r
                         new ResourceAssignmentProcessor(assignments, ctx);\r
                 List<List<ResourceAssignment>> sequenceBatchResourceAssignment = resourceAssignmentProcessor.process();\r
-                \r
+\r
                 Assert.assertNotNull("Failed to populate Sequence Bulk Mappings", sequenceBatchResourceAssignment);\r
                 Assert.assertNotEquals("Failed to populate Sequence Bulk Mappings size ",\r
                         (sequenceBatchResourceAssignment.size() > 0));\r
@@ -53,5 +56,5 @@ public class TopologicalSortingTest {
             e.printStackTrace();\r
         }\r
     }\r
-    \r
+\r
 }\r