aboutsummaryrefslogtreecommitdiffstats
path: root/blueprints-processor/adaptors/data-adaptor-provider
diff options
context:
space:
mode:
authorSingal, Kapil (ks220y) <ks220y@att.com>2020-01-30 11:23:57 -0500
committerKAPIL SINGAL <ks220y@att.com>2020-01-30 16:38:18 +0000
commit032ce4ec7c3d7ac138555dfe980ca53ebbf39f01 (patch)
tree97ead4fa03fbc4e31900fcc39adf5c1fd4594d39 /blueprints-processor/adaptors/data-adaptor-provider
parent4903545aae48b6b8169b8716ba5bce7f0cd8d7ba (diff)
Removing blueprints-processor
Blueprints-Processor is deprecated, use CCSDK/CDS instead Change-Id: I0abc96061c3c5edc6c5d02bcd6f35e18e31882a7 Issue-ID: CCSDK-2051 Signed-off-by: Singal, Kapil (ks220y) <ks220y@att.com>
Diffstat (limited to 'blueprints-processor/adaptors/data-adaptor-provider')
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/pom.xml119
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/ConfigDataAdaptorException.java50
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/DataAdaptorConstants.java76
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDao.java58
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoImpl.java415
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDao.java57
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDaoImpl.java56
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDao.java54
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoImpl.java53
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDao.java61
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDaoImpl.java90
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/db/DataSourceWrap.java91
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigResource.java171
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ResourceAssignmentData.java157
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/TransactionLog.java98
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNode.java61
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceService.java143
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceImpl.java104
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml70
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml70
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/sql/001_init_ddl.sql96
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoTest.java125
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigTransactionLogDaoTest.java79
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoTest.java81
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNodeTest.java82
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceTest.java188
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/log4j.properties21
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/mappings/service-mapping.json11
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/reference/resource_data.json3
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/sql/schema.sql42
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context-h2db.xml70
-rw-r--r--blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context.xml91
32 files changed, 0 insertions, 2943 deletions
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/pom.xml b/blueprints-processor/adaptors/data-adaptor-provider/pom.xml
deleted file mode 100644
index 486fa93cc..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/pom.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright
- © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
- OR CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onap.ccsdk.parent</groupId>
- <artifactId>binding-parent</artifactId>
- <version>1.5.2-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.onap.ccsdk.features</groupId>
- <artifactId>blueprints-data-adaptor-provider</artifactId>
- <version>0.7.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <name>ccsdk-features :: blueprints-processor-adaptor :: ${project.artifactId}</name>
- <url>http://maven.apache.org</url>
-
- <properties>
- <ccsdk.sli.core.version>${project.version}</ccsdk.sli.core.version>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-core-artifacts</artifactId>
- <version>${ccsdk.sli.core.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- </dependency>
- <dependency>
- <groupId>com.att.eelf</groupId>
- <artifactId>eelf-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <additionalparam>-Xdoclint:none</additionalparam>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>org.onap.ccsdk.features.data.adaptor,
- org.onap.ccsdk.features.data.adaptor.dao,
- org.onap.ccsdk.features.data.adaptor.db,
- org.onap.ccsdk.features.data.adaptor.domain,
- org.onap.ccsdk.features.data.adaptor.service
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/ConfigDataAdaptorException.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/ConfigDataAdaptorException.java
deleted file mode 100644
index d76ee4ef9..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/ConfigDataAdaptorException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor;
-
-/**
- * ConfigDataAdaptorException.java Purpose: Provide Configuration Data Adaptor Exception
- *
- * @version 1.0
- */
-public class ConfigDataAdaptorException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * This is a ConfigDataAdaptorException constructor
- *
- * @param message
- */
- public ConfigDataAdaptorException(String message) {
- super(message);
- }
-
- /**
- * This is a ConfigDataAdaptorException constructor
- *
- * @param message
- */
- public ConfigDataAdaptorException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/DataAdaptorConstants.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/DataAdaptorConstants.java
deleted file mode 100644
index d88acca9c..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/DataAdaptorConstants.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor;
-
-@SuppressWarnings("squid:S1118")
-public class DataAdaptorConstants {
-
- public static final String OUTPUT_STATUS_SUCCESS = "success";
- public static final String OUTPUT_STATUS_FAILURE = "failure";
-
- public static final String PROPERTY_ENV_TYPE = "org.onap.ccsdk.features.blueprints.adaptors.envtype";
- public static final String PROPERTY_ENV_PROD = "field";
- public static final String PROPERTY_ENV_SOLO = "solo";
-
- public static final String INPUT_PARAM_TAGS = "tags";
- public static final String INPUT_PARAM_CAPABILITY_NAME = "capabilityName";
- public static final String INPUT_PARAM_MESSAGE = "message";
- public static final String INPUT_PARAM_MESSAGE_TYPE = "messageType";
- public static final String OUTPUT_PARAM_STATUS = "status";
- public static final String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
- public static final String INPUT_PARAM_FILE_CATEGORY = "fileCategory";
- public static final String INPUT_PARAM_VM_INSTANCE = "vmInstance";
- public static final String INPUT_PARAM_ASDC_ARTIFACT_IND = "asdcArtifactInd";
- public static final Object INPUT_PARAM_VNF_ID = "vnfId";
- public static final Object INPUT_PARAM_VM_NAME = "vmName";
-
- public static final Object INPUT_PARAM_CONFIG_CONTENT_TYPE = "configContentType";
-
- public static final Object INPUT_PARAM_CONFIG_CONTENT = "configContent";
- public static final Object INPUT_PARAM_CONFIG_INDICATOR = "configIndicator";
-
- public static final Object CONFIG_CONTENT_TYPE_CONFIGURATION = "Configuration";
- public static final Object CONFIG_CONTENT_TYPE_PARAMETERS = "Parameters";
- public static final Object CONFIG_INDICATOR_PREPARE = "Prepare";
- public static final Object CONFIG_INDICATOR_ACTIVE = "Active";
-
- public static final String INPUT_PARAM_RESPONSE_PRIFIX = "response-prefix";
- public static final String INPUT_PARAM_VNF_TYPE = "vnfType";
- public static final String INPUT_PARAM_VNFC_TYPE = "vnfcType";
- public static final String INPUT_PARAM_ACTION = "action";
- public static final String INPUT_PARAM_API_VERSION = "apiVersion";
-
- public static final String INPUT_PARAM_FILE_ID = "fileId";
- public static final String INPUT_PARAM_UPLOAD_CONFIG_ID = "uploadConfigId";
- public static final String FILE_CATEGORY_SERVICE_TEMPLATE = "service_template";
-
- public static final String ARTIFACT_TYPE_SDNC_MODEL = "SDNC_MODEL";
-
- public static final String LOG_MESSAGE_TYPE_LOG = "Log";
- public static final String LOG_MESSAGE_TYPE_COMPONENT = "Component";
- public static final String LOG_MESSAGE_TYPE_REQUEST = "Request";
- public static final String LOG_MESSAGE_TYPE_MODEL = "Model";
- public static final String LOG_MESSAGE_TYPE_DATA = "Data";
- public static final String LOG_MESSAGE_TYPE_CONFIG = "Config";
-
- public static final String SELF_SERVICE_STATUS_RECEIVED = "Received";
- public static final String SELF_SERVICE_STATUS_ACKNOWLEDGED = "Acknowledged";
- public static final String SELF_SERVICE_STATUS_REPLIED = "Replied";
- public static final String SELF_SERVICE_STATUS_FAILED = "Failed";
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDao.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDao.java
deleted file mode 100644
index bc33d51a3..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDao.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface ConfigResourceDao {
-
- /**
- * Issue a single SQL Insert operation for CONFIG_RESOURCE table via a prepared statement, binding
- * the given arguments.
- *
- * @param transactionLog arguments to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert
- */
- public ConfigResource save(ConfigResource configResourceInput) throws SvcLogicException;
-
- /**
- * Issue a single SQL Delete operation for CONFIG_RESOURCE table via a prepared statement, binding
- * the given arguments.
- *
- * @param configResource arguments to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert
- */
- public void deleteByConfigResource(ConfigResource configResourceInput) throws SvcLogicException;
-
- /**
- * Query CONFIG_RESOURCE table for given input param to create a prepared statement to bind to the
- * query, mapping each row to a Java object via a ConfigResource RowMapper.
- *
- * @param configResource argument to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<ConfigResource> findByConfigResource(ConfigResource configResourceInput) throws SvcLogicException;
-
- public ConfigResource getConfigResource(ConfigResource configResource) throws SvcLogicException;
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoImpl.java
deleted file mode 100644
index 7661e96ee..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoImpl.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.ResourceAssignmentData;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.jdbc.core.RowMapperResultSetExtractor;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigResourceDaoImpl implements ConfigResourceDao {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceDaoImpl.class);
-
- private JdbcTemplate jdbcTemplate;
-
- public ConfigResourceDaoImpl(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- @Override
- public ConfigResource save(ConfigResource configResource) throws SvcLogicException {
-
- ConfigResource dbConfigResource = checkConfigResource(configResource);
-
- if (dbConfigResource != null && StringUtils.isNotBlank(dbConfigResource.getConfigResourceId())) {
- configResource.setConfigResourceId(dbConfigResource.getConfigResourceId());
-
- validateConfigResource(configResource);
-
- update(configResource);
-
- saveConfigResourceAssignmentData(configResource);
- } else {
- String addQuery = "INSERT INTO CONFIG_RESOURCE "
- + "( config_resource_id, resource_id, resource_type, service_template_name, service_template_version,"
- + "template_name, recipe_name, request_id, resource_data, mask_data, status, created_date, updated_by ) "
- + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
-
- configResource.setConfigResourceId(configResource.getUniqueId());
-
- validateConfigResource(configResource);
-
- logger.info("saving config resource ({}) ...", configResource);
- jdbcTemplate.update(addQuery, configResource.getConfigResourceId(), configResource.getResourceId(),
- configResource.getResourceType(), configResource.getServiceTemplateName(),
- configResource.getServiceTemplateVersion(), configResource.getTemplateName(),
- configResource.getRecipeName(), configResource.getRequestId(), configResource.getResourceData(),
- configResource.getMaskData(), configResource.getStatus(), configResource.getCreatedDate(),
- configResource.getUpdatedBy());
-
- saveConfigResourceAssignmentData(configResource);
- }
- dbConfigResource = getConfigResource(configResource);
- return dbConfigResource;
- }
-
- private void update(ConfigResource configResource) throws SvcLogicException {
- if (StringUtils.isNotBlank(configResource.getConfigResourceId())) {
- logger.info("updating config resource ({}) ...", configResource);
- // Added service_template_name and version in update query to update with 1802 data.
- String updateQuery = "UPDATE CONFIG_RESOURCE SET "
- + "resource_data = ?, mask_data = ?, created_date = ?, updated_by = ? ,service_template_name = ?, service_template_version = ? "
- + "where config_resource_id = ?";
-
- jdbcTemplate.update(updateQuery, configResource.getResourceData(), configResource.getMaskData(),
- configResource.getCreatedDate(), configResource.getUpdatedBy(),
- configResource.getServiceTemplateName(), configResource.getServiceTemplateVersion(),
- configResource.getConfigResourceId());
- } else {
- throw new SvcLogicException("missing config resource id to update.");
- }
- }
-
- private void saveConfigResourceAssignmentData(ConfigResource configResource) {
- if (configResource != null && StringUtils.isNotBlank(configResource.getConfigResourceId())) {
- List<Object> listOfArguments = new ArrayList<>();
- String deleteQuery = "DELETE FROM CONFIG_RESOURCE_ASSIGNMENT_DATA WHERE config_resource_id = ? ";
- listOfArguments.add(configResource.getConfigResourceId());
- this.jdbcTemplate.update(deleteQuery, listOfArguments.toArray());
- logger.info("config resource assignment data deleted successfully for the config_resource_id ({})",
- configResource.getConfigResourceId());
-
- if (configResource.getResourceAssignments() != null) {
- List<ResourceAssignmentData> resourceAssignments = configResource.getResourceAssignments();
- for (ResourceAssignmentData resourceAssignmentData : resourceAssignments) {
- if (resourceAssignmentData != null) {
- resourceAssignmentData.setConfigResourceId(configResource.getConfigResourceId());
- saveResourceAssignmentData(resourceAssignmentData);
- }
- }
- }
- }
- }
-
- private ResourceAssignmentData saveResourceAssignmentData(ResourceAssignmentData resourceAssignmentData) {
- String addQuery = "INSERT INTO CONFIG_RESOURCE_ASSIGNMENT_DATA "
- + "( config_resource_assignment_data_id, config_resource_id, version, updated_by, template_key_name, "
- + "resource_name, data_type, entry_schema, resource_value, source, status, message ) "
- + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
-
- logger.debug("saving config resource assignment data ({}) ... ", resourceAssignmentData);
- jdbcTemplate.update(addQuery, resourceAssignmentData.getId(), resourceAssignmentData.getConfigResourceId(),
- resourceAssignmentData.getVersion(), resourceAssignmentData.getUpdatedBy(),
- resourceAssignmentData.getTemplateKeyName(), resourceAssignmentData.getResourceName(),
- resourceAssignmentData.getDataType(), resourceAssignmentData.getEntrySchema(),
- resourceAssignmentData.getResourceValue(), resourceAssignmentData.getSource(),
- resourceAssignmentData.getStatus(), resourceAssignmentData.getMessage());
-
- return resourceAssignmentData;
- }
-
- @Override
- public void deleteByConfigResource(ConfigResource configResourceInput) throws SvcLogicException {
- StringBuilder selectArtifactBuffer = new StringBuilder();
- List<Object> listOfArguments = new ArrayList<>();
-
- selectArtifactBuffer.append("DELETE FROM CONFIG_RESOURCE WHERE config_resource_id = ? ");
- listOfArguments.add(configResourceInput.getConfigResourceId());
-
- String queryString = selectArtifactBuffer.toString();
- this.jdbcTemplate.update(queryString, listOfArguments.toArray());
- logger.info("config resource ({}) deleted successfully ", configResourceInput);
- }
-
- @SuppressWarnings("squid:S3776")
- @Override
- public List<ConfigResource> findByConfigResource(ConfigResource configResourceInput) throws SvcLogicException {
- StringBuilder selectArtifactBuffer = new StringBuilder();
- List<Object> listOfArguments = new ArrayList<>();
-
- selectArtifactBuffer.append("SELECT * FROM CONFIG_RESOURCE WHERE ");
-
- StringBuilder whereClauseRemaining = new StringBuilder();
-
- if (configResourceInput.getServiceTemplateName() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("service_template_name = ? ");
- listOfArguments.add(configResourceInput.getServiceTemplateName());
- }
-
- if (configResourceInput.getServiceTemplateVersion() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("service_template_version = ? ");
- listOfArguments.add(configResourceInput.getServiceTemplateVersion());
- }
-
- if (configResourceInput.getResourceId() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("resource_id = ? ");
- listOfArguments.add(configResourceInput.getResourceId());
- }
-
- if (configResourceInput.getResourceType() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("resource_type = ? ");
- listOfArguments.add(configResourceInput.getResourceType());
- }
-
- if (configResourceInput.getRequestId() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("request_id = ? ");
- listOfArguments.add(configResourceInput.getRequestId());
- }
-
- if (configResourceInput.getTemplateName() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("template_name = ? ");
- listOfArguments.add(configResourceInput.getTemplateName());
- }
-
- if (configResourceInput.getRecipeName() != null) {
- if (whereClauseRemaining.length() != 0) {
- whereClauseRemaining.append("AND ");
- }
- whereClauseRemaining.append("recipe_name = ? ");
- listOfArguments.add(configResourceInput.getRecipeName());
- }
-
- String queryString = selectArtifactBuffer.toString() + whereClauseRemaining.toString();
- logger.info("config resource queryString ({})", queryString);
- List<ConfigResource> configResources =
- this.jdbcTemplate.query(queryString, listOfArguments.toArray(), new ConfigResourceMapper());
-
- List<ConfigResource> returnConfigResources = new ArrayList<>();
-
- if (configResources != null) {
- for (ConfigResource configResource : configResources) {
- if (configResource != null) {
- returnConfigResources.add(getConfigResource(configResource));
- }
- }
- }
- return returnConfigResources;
- }
-
- public ConfigResource checkConfigResource(ConfigResource configResource) {
- StringBuilder selectBuffer = new StringBuilder();
- List<Object> listOfArguments = new ArrayList<>();
-
- selectBuffer.append(
- "SELECT * FROM CONFIG_RESOURCE WHERE resource_id = ? AND resource_type = ? AND template_name = ? ");
- listOfArguments.add(configResource.getResourceId());
- listOfArguments.add(configResource.getResourceType());
- listOfArguments.add(configResource.getTemplateName());
- return queryOneForObject(selectBuffer.toString(), listOfArguments.toArray(), new ConfigResourceMapper());
- }
-
- @Override
- public ConfigResource getConfigResource(ConfigResource configResource) throws SvcLogicException {
- ConfigResource dbConfigResource = checkConfigResource(configResource);
- if (dbConfigResource != null && StringUtils.isNotBlank(dbConfigResource.getConfigResourceId())) {
- List<ResourceAssignmentData> resourceAssignments =
- getResourceAssignmentdata(dbConfigResource.getConfigResourceId());
- configResource.setResourceAssignments(resourceAssignments);
- }
- return configResource;
- }
-
- private List<ResourceAssignmentData> getResourceAssignmentdata(String configResourceId) {
- List<Object> listOfArguments = new ArrayList<>();
- String queryString = "SELECT * FROM CONFIG_RESOURCE_ASSIGNMENT_DATA WHERE config_resource_id = ? ";
- logger.info("getResourceAssignmentdata queryString ({}), query inputs ({})", queryString, configResourceId);
- listOfArguments.add(configResourceId);
- return this.jdbcTemplate.query(queryString, listOfArguments.toArray(), new ResourceAssignmentDataMapper());
- }
-
- @SuppressWarnings("squid:S3776")
- private boolean validateConfigResource(ConfigResource configResource) throws SvcLogicException {
- if (configResource == null) {
- throw new SvcLogicException("config resource information is missing.");
- }
-
- if (StringUtils.isBlank(configResource.getConfigResourceId())) {
- throw new SvcLogicException("config resource id is missing.");
- }
-
- if (StringUtils.isBlank(configResource.getResourceType())) {
- throw new SvcLogicException("config resource type is missing.");
- }
- if (StringUtils.isBlank(configResource.getResourceId())) {
- throw new SvcLogicException("config resource resource id is missing.");
- }
-
- if (StringUtils.isBlank(configResource.getRecipeName())) {
- throw new SvcLogicException("config resource action name is missing.");
- }
-
- if (StringUtils.isBlank(configResource.getTemplateName())) {
- throw new SvcLogicException("config resource template name is missing.");
- }
-
- if (configResource.getResourceAssignments() != null) {
- List<ResourceAssignmentData> resourceAssignments = configResource.getResourceAssignments();
- for (ResourceAssignmentData resourceAssignmentData : resourceAssignments) {
- if (resourceAssignmentData != null) {
- resourceAssignmentData.setConfigResourceId(configResource.getConfigResourceId());
- if (StringUtils.isBlank(resourceAssignmentData.getId())) {
- resourceAssignmentData.setId(resourceAssignmentData.getUniqueId());
- }
- if (resourceAssignmentData.getVersion() == null || resourceAssignmentData.getVersion() == 0) {
- resourceAssignmentData.setVersion(1);
- }
- if (StringUtils.isBlank(resourceAssignmentData.getUpdatedBy())) {
- resourceAssignmentData.setUpdatedBy("System");
- }
- if (resourceAssignmentData.getStatus() == null) {
- logger.warn("{} status is missing and setting to undefined", resourceAssignmentData);
- resourceAssignmentData.setStatus("undefined");
- }
- if (resourceAssignmentData.getMessage() == null) {
- resourceAssignmentData.setMessage("");
- }
- if (resourceAssignmentData.getResourceValue() == null) {
- resourceAssignmentData.setResourceValue("");
- }
-
- validateResourceAssignmentData(resourceAssignmentData);
- }
- }
- }
-
- return true;
- }
-
- private boolean validateResourceAssignmentData(ResourceAssignmentData resourceAssignmentData)
- throws SvcLogicException {
- if (resourceAssignmentData == null) {
- throw new SvcLogicException("resource assignment data information is missing.");
- }
- if (StringUtils.isBlank(resourceAssignmentData.getConfigResourceId())) {
- throw new SvcLogicException("resource assignment data config resource id is missing.");
- }
- if (resourceAssignmentData.getVersion() == null) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) version is missing", resourceAssignmentData));
- }
- if (StringUtils.isBlank(resourceAssignmentData.getTemplateKeyName())) {
- throw new SvcLogicException(String.format("resource assignment data (%s) template key name is missing",
- resourceAssignmentData));
- }
- if (StringUtils.isBlank(resourceAssignmentData.getResourceName())) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) resource name is missing", resourceAssignmentData));
- }
- if (resourceAssignmentData.getResourceValue() == null) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) resource value is missing", resourceAssignmentData));
- }
- if (StringUtils.isBlank(resourceAssignmentData.getSource())) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) source is missing", resourceAssignmentData));
- }
- if (StringUtils.isBlank(resourceAssignmentData.getDataType())) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) data type is missing", resourceAssignmentData));
- }
- if (StringUtils.isBlank(resourceAssignmentData.getStatus())) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) status is missing", resourceAssignmentData));
- }
- if (resourceAssignmentData.getMessage() == null) {
- throw new SvcLogicException(
- String.format("resource assignment data (%s) message is missing", resourceAssignmentData));
- }
- return true;
- }
-
- private <T> T queryOneForObject(String sql, Object[] args, RowMapper<T> rowMapper) {
- List<T> results = this.jdbcTemplate.query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
- if (results != null && !results.isEmpty()) {
- return results.get(0);
- } else {
- return null;
- }
- }
-
- class ConfigResourceMapper implements RowMapper<ConfigResource> {
- @Override
- public ConfigResource mapRow(ResultSet rs, int rowNum) throws SQLException {
- ConfigResource configResource = new ConfigResource();
- configResource.setConfigResourceId(rs.getString("config_resource_id"));
- configResource.setResourceId(rs.getString("resource_id"));
- configResource.setResourceType(rs.getString("resource_type"));
- configResource.setServiceTemplateName(rs.getString("service_template_name"));
- configResource.setServiceTemplateVersion(rs.getString("service_template_version"));
- configResource.setTemplateName(rs.getString("template_name"));
- configResource.setRecipeName(rs.getString("recipe_name"));
- configResource.setRequestId(rs.getString("request_id"));
- configResource.setResourceData(rs.getString("resource_data"));
- configResource.setMaskData(rs.getString("mask_data"));
- configResource.setStatus(rs.getString("status"));
- configResource.setCreatedDate(rs.getDate("created_date"));
- configResource.setUpdatedBy(rs.getString("updated_by"));
- return configResource;
- }
- }
-
- class ResourceAssignmentDataMapper implements RowMapper<ResourceAssignmentData> {
- @Override
- public ResourceAssignmentData mapRow(ResultSet rs, int rowNum) throws SQLException {
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setConfigResourceId(rs.getString("config_resource_id"));
- resourceAssignmentData.setDataType(rs.getString("data_type"));
- resourceAssignmentData.setEntrySchema(rs.getString("entry_schema"));
- resourceAssignmentData.setId(rs.getString("config_resource_assignment_data_id"));
- resourceAssignmentData.setMessage(rs.getString("message"));
- resourceAssignmentData.setResourceName(rs.getString("resource_name"));
- resourceAssignmentData.setResourceValue(rs.getString("resource_value"));
- resourceAssignmentData.setSource(rs.getString("source"));
- resourceAssignmentData.setStatus(rs.getString("status"));
- resourceAssignmentData.setTemplateKeyName(rs.getString("template_key_name"));
- resourceAssignmentData.setUpdatedBy(rs.getString("updated_by"));
- resourceAssignmentData.setUpdatedDate(rs.getTimestamp("updated_date"));
- resourceAssignmentData.setVersion(rs.getInt("version"));
- return resourceAssignmentData;
- }
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDao.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDao.java
deleted file mode 100644
index 7a06e234a..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDao.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-
-public interface NamedQueryExecutorDao {
- /**
- * Return NamedParameterJdbcTemplate object.
- */
- public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the
- * query, expecting a result list.
- * <p>
- * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,
- * using the column name as the key).
- *
- * @param sql SQL query to execute
- * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return a List that contains a Map per row
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException;
-
- /**
- * Issue an update via a prepared statement, binding the given arguments.
- *
- * @param sql SQL containing named parameters
- * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return the number of rows affected
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update
- */
- public int update(String sql, Map<String, Object> parameters) throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDaoImpl.java
deleted file mode 100644
index ac59c5149..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/NamedQueryExecutorDaoImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class NamedQueryExecutorDaoImpl implements NamedQueryExecutorDao {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);
- private static final String CLASS_NAME = "NamedQueryExecutorDaoImpl";
-
- @Autowired(required = true)
- private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
-
- public NamedQueryExecutorDaoImpl(NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
- this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
- logger.info("{} Constructor initialised..", CLASS_NAME);
- }
-
- @Override
- public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {
- logger.debug("Query ({}) with parameters ({})", sql, parameters);
- return namedParameterJdbcTemplate.queryForList(sql, parameters);
- }
-
- @Override
- public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
- return namedParameterJdbcTemplate;
- }
-
- @Override
- public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {
- logger.debug("update ({}) with parameters ({})", sql, parameters);
- return namedParameterJdbcTemplate.update(sql, parameters);
- }
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDao.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDao.java
deleted file mode 100644
index 9077d09f7..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDao.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface QueryExecutorDao {
-
- /**
- * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the
- * query, expecting a result list.
- * <p>
- * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,
- * using the column name as the key). Each element in the list will be of the form returned by this
- * interface's queryForMap() methods.
- *
- * @param sql SQL query to execute
- * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return a List that contains a Map per row
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException;
-
- /**
- * Issue a single SQL update operation (such as an insert, update or delete statement) via a
- * prepared statement, binding the given arguments.
- *
- * @param sql SQL containing bind parameters
- * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return the number of rows affected
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update
- */
- public int update(String sql, Object[] data) throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoImpl.java
deleted file mode 100644
index f52c4c50f..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class QueryExecutorDaoImpl implements QueryExecutorDao {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoImpl.class);
- private static final String CLASS_NAME = "QueryExecutorDaoImpl";
-
- @Autowired(required = true)
- private JdbcTemplate jdbcTemplate;
-
- public QueryExecutorDaoImpl(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- logger.info("{} Constructor initialised..", CLASS_NAME);
- }
-
- @Override
- public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {
- logger.debug("Query ({}) with data ({})", sql, data);
- return jdbcTemplate.queryForList(sql, data);
- }
-
- @Override
- public int update(String sql, Object[] data) throws SvcLogicException {
- logger.debug("Query ({}) with data ({})", sql, data);
- return jdbcTemplate.update(sql, data);
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDao.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDao.java
deleted file mode 100644
index c0381a989..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDao.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.List;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-
-public interface TransactionLogDao {
-
- /**
- * Issue a single SQL Insert operation for CONFIG_TRANSACTION_LOG table via a prepared statement,
- * binding the given arguments.
- *
- * @param transactionLog arguments to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert
- */
- public void save(TransactionLog transactionLog) throws SvcLogicException;
-
- /**
- * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a
- * TransactionLog RowMapper.
- *
- * @param requestId argument to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException;
-
- /**
- * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a
- * TransactionLog RowMapper.
- *
- * @param requestId argument to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @param messageType argument to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
- throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDaoImpl.java
deleted file mode 100644
index ea6567e1e..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/TransactionLogDaoImpl.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class TransactionLogDaoImpl implements TransactionLogDao {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(TransactionLogDaoImpl.class);
-
- private JdbcTemplate jdbcTemplate;
-
- public TransactionLogDaoImpl(JdbcTemplate jdbcTemplate) {
- this.jdbcTemplate = jdbcTemplate;
- }
-
- @Override
- public void save(TransactionLog transactionLog) throws SvcLogicException {
- if (transactionLog != null && StringUtils.isNotBlank(transactionLog.getRequestId())) {
- String addSql =
- "INSERT INTO CONFIG_TRANSACTION_LOG ( config_transaction_log_id, request_id, message_type, message ) VALUES (?, ?, ?, ?) ";
- jdbcTemplate.update(addSql, transactionLog.getUniqueId(), transactionLog.getRequestId(),
- transactionLog.getMessageType(), transactionLog.getMessage());
- logger.trace("TransactionLog Updated Successfully for message_type {}", transactionLog.getMessageType());
- }
-
- }
-
- @Override
- public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {
- if (StringUtils.isNotBlank(requestId)) {
- String selectByRequestIdSql =
- "SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = ? ORDER BY creation_date DESC";
- return this.jdbcTemplate.query(selectByRequestIdSql, new Object[] {requestId}, new TransactionLogMapper());
- } else {
- throw new SvcLogicException("TransactionLog Request id (" + requestId + ")is missing ");
- }
- }
-
- @Override
- public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
- throws SvcLogicException {
- if (StringUtils.isNotBlank(requestId)) {
- String selectByRequestIdSql =
- "SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = ? and message_type = ? ORDER BY creation_date DESC";
- return this.jdbcTemplate.query(selectByRequestIdSql, new Object[] {requestId, messageType},
- new TransactionLogMapper());
- } else {
- throw new SvcLogicException("TransactionLog Request id (" + requestId + ")is missing ");
- }
- }
-
- private static final class TransactionLogMapper implements RowMapper<TransactionLog> {
- @Override
- public TransactionLog mapRow(ResultSet rs, int rowNum) throws SQLException {
- TransactionLog transactionLog = new TransactionLog();
- transactionLog.setCreationDate(rs.getDate("creation_date"));
- transactionLog.setMessage(rs.getString("message"));
- transactionLog.setMessageType(rs.getString("message_type"));
- transactionLog.setRequestId(rs.getString("request_id"));
- transactionLog.setTransactionLogId(rs.getString("config_transaction_log_id"));
- return transactionLog;
- }
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/db/DataSourceWrap.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/db/DataSourceWrap.java
deleted file mode 100644
index 5ec3eddca..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/db/DataSourceWrap.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.db;
-
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import javax.sql.DataSource;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class DataSourceWrap implements DataSource {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(DataSourceWrap.class);
-
- private DataSource dataSource;
-
- public DataSourceWrap(DataSource dataSource) {
- logger.info("Setting Data Source {} ", dataSource);
- this.dataSource = dataSource;
- }
-
- @Override
- public PrintWriter getLogWriter() throws SQLException {
- return dataSource.getLogWriter();
- }
-
- @Override
- public void setLogWriter(PrintWriter out) throws SQLException {
- dataSource.setLogWriter(out);
- }
-
- @Override
- public void setLoginTimeout(int seconds) throws SQLException {
- dataSource.setLoginTimeout(seconds);
- }
-
- @Override
- public int getLoginTimeout() throws SQLException {
- return dataSource.getLoginTimeout();
- }
-
- @Override
- public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {
- return dataSource.getParentLogger();
- }
-
- @Override
- public <T> T unwrap(Class<T> iface) throws SQLException {
- return dataSource.unwrap(iface);
- }
-
- @Override
- public boolean isWrapperFor(Class<?> iface) throws SQLException {
- return dataSource.isWrapperFor(iface);
- }
-
- @SuppressWarnings("squid:S2095")
- @Override
- public Connection getConnection() throws SQLException {
- Connection c = dataSource.getConnection();
- logger.trace("getConnection: ({})", c.getClass().getName());
- c.setAutoCommit(true);
- return c;
- }
-
- @SuppressWarnings("squid:S2095")
- @Override
- public Connection getConnection(String username, String pass) throws SQLException {
- Connection c = dataSource.getConnection(username, pass);
- c.setAutoCommit(true);
- return c;
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigResource.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigResource.java
deleted file mode 100644
index 501027021..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigResource.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-public class ConfigResource implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private String configResourceId;
- private String resourceId;
- private String resourceType;
- private String serviceTemplateName;
- private String serviceTemplateVersion;
- private String templateName;
- private String recipeName;
- private String requestId;
- private String resourceData;
- private String maskData;
- private Date createdDate = new Date();
- private String status;
- private String updatedBy;
- private List<ResourceAssignmentData> resourceAssignments;
-
- public String getConfigResourceId() {
- return configResourceId;
- }
-
- public void setConfigResourceId(String configResourceId) {
- this.configResourceId = configResourceId;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getServiceTemplateName() {
- return serviceTemplateName;
- }
-
- public void setServiceTemplateName(String serviceTemplateName) {
- this.serviceTemplateName = serviceTemplateName;
- }
-
- public String getServiceTemplateVersion() {
- return serviceTemplateVersion;
- }
-
- public void setServiceTemplateVersion(String serviceTemplateVersion) {
- this.serviceTemplateVersion = serviceTemplateVersion;
- }
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public String getRecipeName() {
- return recipeName;
- }
-
- public void setRecipeName(String recipeName) {
- this.recipeName = recipeName;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getResourceData() {
- return resourceData;
- }
-
- public void setResourceData(String resourceData) {
- this.resourceData = resourceData;
- }
-
- public String getMaskData() {
- return maskData;
- }
-
- public void setMaskData(String maskData) {
- this.maskData = maskData;
- }
-
- public Date getCreatedDate() {
- return createdDate;
- }
-
- public void setCreatedDate(Date createdDate) {
- this.createdDate = createdDate;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public List<ResourceAssignmentData> getResourceAssignments() {
- return resourceAssignments;
- }
-
- public void setResourceAssignments(List<ResourceAssignmentData> resourceAssignments) {
- this.resourceAssignments = resourceAssignments;
- }
-
- @Override
- public String toString() {
- return "ConfigResource [configResourceId=" + configResourceId + ", resourceId=" + resourceId
- + ", serviceTemplateName=" + serviceTemplateName + ", serviceTemplateVersion=" + serviceTemplateVersion
- + ", resourceType=" + resourceType + ", templateName=" + templateName + ", recipeName=" + recipeName
- + ", requestId=" + requestId + ", resourceData= ******** , maskData=" + maskData + ", createdDate="
- + createdDate + ", updatedBy=" + updatedBy + "]";
- }
-
- public String getUniqueId() {
- return UUID.randomUUID().toString();
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ResourceAssignmentData.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ResourceAssignmentData.java
deleted file mode 100644
index 45e83c27e..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ResourceAssignmentData.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-
-public class ResourceAssignmentData implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private String id;
- private String configResourceId;
- private Integer version;
- private Date updatedDate = new Date();
- private String updatedBy;
- private String templateKeyName;
- private String resourceName;
- private String dataType;
- private String entrySchema;
- private String resourceValue;
- private String source;
- private String status;
- private String message;
-
- public String getUniqueId() {
- return UUID.randomUUID().toString();
- }
-
- @Override
- public String toString() {
- return "ResourceAssignmentData [id=" + id + ", configResourceId=" + configResourceId + ", version=" + version
- + ", updatedDate=" + updatedDate + ", updatedBy=" + updatedBy + ", templateKeyName=" + templateKeyName
- + ", resourceName=" + resourceName + ", dataType=" + dataType + ", source=" + source + ", status="
- + status + "]";
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getConfigResourceId() {
- return configResourceId;
- }
-
- public void setConfigResourceId(String configResourceId) {
- this.configResourceId = configResourceId;
- }
-
- public Integer getVersion() {
- return version;
- }
-
- public void setVersion(Integer version) {
- this.version = version;
- }
-
- public Date getUpdatedDate() {
- return updatedDate;
- }
-
- public void setUpdatedDate(Date updatedDate) {
- this.updatedDate = updatedDate;
- }
-
- public String getUpdatedBy() {
- return updatedBy;
- }
-
- public void setUpdatedBy(String updatedBy) {
- this.updatedBy = updatedBy;
- }
-
- public String getTemplateKeyName() {
- return templateKeyName;
- }
-
- public void setTemplateKeyName(String templateKeyName) {
- this.templateKeyName = templateKeyName;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getDataType() {
- return dataType;
- }
-
- public void setDataType(String dataType) {
- this.dataType = dataType;
- }
-
- public String getEntrySchema() {
- return entrySchema;
- }
-
- public void setEntrySchema(String entrySchema) {
- this.entrySchema = entrySchema;
- }
-
- public String getResourceValue() {
- return resourceValue;
- }
-
- public void setResourceValue(String resourceValue) {
- this.resourceValue = resourceValue;
- }
-
- public String getSource() {
- return source;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/TransactionLog.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/TransactionLog.java
deleted file mode 100644
index f45fdc64c..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/TransactionLog.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.domain;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.UUID;
-
-public class TransactionLog implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private String transactionLogId;
- private String requestId;
- private String messageType;
- private Date creationDate;
- private String message;
-
- public TransactionLog() {
-
- }
-
- public TransactionLog(String requestId, String messageType, String message) {
- this.requestId = requestId;
- this.messageType = messageType;
- this.message = message;
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder("[");
- buffer.append("transactionLogId =" + transactionLogId);
- buffer.append(", requestId =" + requestId);
- buffer.append(", messageType =" + messageType);
- buffer.append(", creationDate =" + creationDate);
- buffer.append("]");
- return buffer.toString();
- }
-
- public String getTransactionLogId() {
- return transactionLogId;
- }
-
- public void setTransactionLogId(String transactionLogId) {
- this.transactionLogId = transactionLogId;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getMessageType() {
- return messageType;
- }
-
- public void setMessageType(String messageType) {
- this.messageType = messageType;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Date creationDate) {
- this.creationDate = creationDate;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getUniqueId() {
- return UUID.randomUUID().toString();
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNode.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNode.java
deleted file mode 100644
index 2eca20731..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNode.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.service;
-
-import java.util.Map;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-public class ConfigResourceNode implements SvcLogicJavaPlugin {
-
- private ConfigResourceService configResourceService;
-
- public ConfigResourceNode(ConfigResourceService configResourceService) {
- this.configResourceService = configResourceService;
- }
-
- public void saveConfigTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
- String responsePrefix = inParams.get(DataAdaptorConstants.INPUT_PARAM_RESPONSE_PRIFIX);
- try {
- responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : "";
-
- String messageType = inParams.get(DataAdaptorConstants.INPUT_PARAM_MESSAGE_TYPE);
- String message = inParams.get(DataAdaptorConstants.INPUT_PARAM_MESSAGE);
- String requestId = ctx.getAttribute("request-id");
-
- TransactionLog transactionLog = new TransactionLog();
-
- transactionLog.setMessage(message);
- transactionLog.setMessageType(messageType);
- transactionLog.setRequestId(requestId);
-
- configResourceService.save(transactionLog);
-
- } catch (Exception e) {
- ctx.setAttribute(responsePrefix + DataAdaptorConstants.OUTPUT_PARAM_STATUS,
- DataAdaptorConstants.OUTPUT_STATUS_FAILURE);
- ctx.setAttribute(responsePrefix + DataAdaptorConstants.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage());
- throw new SvcLogicException("Failed in saveConfigTransactionLog :" + e.getMessage());
- }
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceService.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceService.java
deleted file mode 100644
index cbd9e9279..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceService.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.service;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-
-public interface ConfigResourceService {
-
- /**
- * Return NamedParameterJdbcTemplate object.
- */
- public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the
- * query, expecting a result list.
- * <p>
- * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,
- * using the column name as the key).
- *
- * @param sql SQL query to execute
- * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return a List that contains a Map per row
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<Map<String, Object>> query(String sql, Map<String, Object> param) throws SvcLogicException;
-
- /**
- * Issue an update via a prepared statement, binding the given arguments.
- *
- * @param sql SQL containing named parameters
- * @param param map of parameters to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return the number of rows affected
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update
- */
- public int update(String sql, Map<String, Object> param) throws SvcLogicException;
-
- /**
- * Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the
- * query, expecting a result list.
- * <p>
- * The results will be mapped to a List (one entry for each row) of Maps (one entry for each column,
- * using the column name as the key).
- *
- * @param sql SQL query to execute
- * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return a List that contains a Map per row
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException;
-
- /**
- * Issue a single SQL update operation (such as an insert, update or delete statement) via a
- * prepared statement, binding the given arguments.
- *
- * @param sql SQL containing bind parameters
- * @param data arguments to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return the number of rows affected
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the update
- */
- public int update(String sql, Object[] data) throws SvcLogicException;
-
- /**
- * Issue a single SQL Insert operation for CONFIG_TRANSACTION_LOG table via a prepared statement,
- * binding the given arguments.
- *
- * @param transactionLog arguments to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert
- */
- public void save(TransactionLog transactionLog) throws SvcLogicException;
-
- /**
- * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a
- * TransactionLog RowMapper.
- *
- * @param requestId argument to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException;
-
- /**
- * Query CONFIG_RESOURCE table for given input param to create a prepared statement to bind to the
- * query, mapping each row to a Java object via a ConfigResource RowMapper.
- *
- * @param configResource argument to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException;
-
- /**
- * Issue a single SQL update operation (insert or update statement) for CONFIG_RESOURCE table via a
- * prepared statement, binding the given arguments.
- *
- * @param configResource arguments to bind to the query (mapping it to the PreparedStatement to the
- * corresponding SQL type)
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if there is any problem issuing the insert
- */
- public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException;
-
- /**
- * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a
- * TransactionLog RowMapper.
- *
- * @param requestId argument to bind to the query (leaving it to the PreparedStatement to guess the
- * corresponding SQL type)
- * @param messageType argument to bind to the query (leaving it to the PreparedStatement to guess
- * the corresponding SQL type)
- * @return the result List, containing mapped objects
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if the query fails
- */
- public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
- throws SvcLogicException;
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceImpl.java
deleted file mode 100644
index ab24f16c7..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceImpl.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.service;
-
-import java.util.List;
-import java.util.Map;
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;
-import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDao;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ConfigResourceServiceImpl implements ConfigResourceService {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceServiceImpl.class);
- private static final String CLASS_NAME = "ConfigResourceServiceImpl";
-
- private TransactionLogDao transactionLogDao;
- private ConfigResourceDao configResourceDao;
- private QueryExecutorDao queryExecutorDao;
- private NamedQueryExecutorDao namedQueryExecutorDao;
-
- @SuppressWarnings("squid:S00107")
- public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao,
- QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao) {
-
- logger.info("{} Constuctor Initated...", CLASS_NAME);
- this.transactionLogDao = transactionLogDao;
- this.configResourceDao = configResourceDao;
- this.queryExecutorDao = queryExecutorDao;
- this.namedQueryExecutorDao = namedQueryExecutorDao;
- }
-
- @Override
- public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() throws SvcLogicException {
- return namedQueryExecutorDao.getNamedParameterJdbcTemplate();
- }
-
- @Override
- public List<Map<String, Object>> query(String sql, Map<String, Object> parameters) throws SvcLogicException {
- return namedQueryExecutorDao.query(sql, parameters);
- }
-
- @Override
- public int update(String sql, Map<String, Object> parameters) throws SvcLogicException {
- return namedQueryExecutorDao.update(sql, parameters);
- }
-
- @Override
- public List<Map<String, Object>> query(String sql, Object[] data) throws SvcLogicException {
- return queryExecutorDao.query(sql, data);
- }
-
- @Override
- public int update(String sql, Object[] data) throws SvcLogicException {
- return queryExecutorDao.update(sql, data);
- }
-
- @Override
- public void save(TransactionLog transactionLog) throws SvcLogicException {
- transactionLogDao.save(transactionLog);
- }
-
- @Override
- public List<TransactionLog> getTransactionsByRequestId(String requestId) throws SvcLogicException {
- return transactionLogDao.getTransactionsByRequestId(requestId);
- }
-
- @Override
- public List<TransactionLog> getTransactionsByRequestId(String requestId, String messageType)
- throws SvcLogicException {
- return transactionLogDao.getTransactionsByRequestId(requestId, messageType);
- }
-
- @Override
- public List<ConfigResource> getConfigResource(ConfigResource configResource) throws SvcLogicException {
- return configResourceDao.findByConfigResource(configResource);
- }
-
- @Override
- public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException {
- return configResourceDao.save(configResource);
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
deleted file mode 100644
index 76459d51d..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright
- © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
- OR CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the License. -->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependencies -->
-
- <reference id="dataSource" interface="javax.sql.DataSource" />
-
- <!-- Data SourceInitialisation -->
-
- <bean id="config.dataSource"
- class="org.onap.ccsdk.features.data.adaptor.db.DataSourceWrap">
- <argument ref="dataSource" />
- </bean>
-
- <bean id="jdbcTemplate"
- class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="config.dataSource" />
- </bean>
-
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <argument ref="config.dataSource" />
- </bean>
-
- <!-- DAO Initialisation -->
- <bean id="transactionLogDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="configResourceDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="queryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="namedQueryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDaoImpl">
- <argument ref="namedParameterJdbcTemplate" />
- </bean>
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configResourceService"
- class="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceServiceImpl">
- <argument ref="transactionLogDao" />
- <argument ref="configResourceDao" />
- <argument ref="queryExecutorDao" />
- <argument ref="namedQueryExecutorDao" />
- </bean>
-
- <service ref="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
-</blueprint>
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
deleted file mode 100644
index 76459d51d..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright
- © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
- OR CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the License. -->
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
-
- <!-- Dependencies -->
-
- <reference id="dataSource" interface="javax.sql.DataSource" />
-
- <!-- Data SourceInitialisation -->
-
- <bean id="config.dataSource"
- class="org.onap.ccsdk.features.data.adaptor.db.DataSourceWrap">
- <argument ref="dataSource" />
- </bean>
-
- <bean id="jdbcTemplate"
- class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="config.dataSource" />
- </bean>
-
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <argument ref="config.dataSource" />
- </bean>
-
- <!-- DAO Initialisation -->
- <bean id="transactionLogDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="configResourceDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="queryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">
- <argument ref="jdbcTemplate" />
- </bean>
-
- <bean id="namedQueryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDaoImpl">
- <argument ref="namedParameterJdbcTemplate" />
- </bean>
-
- <!-- Expose the Common Component Bean -->
-
- <bean id="configResourceService"
- class="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceServiceImpl">
- <argument ref="transactionLogDao" />
- <argument ref="configResourceDao" />
- <argument ref="queryExecutorDao" />
- <argument ref="namedQueryExecutorDao" />
- </bean>
-
- <service ref="configResourceService"
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />
-
-</blueprint>
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/sql/001_init_ddl.sql b/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/sql/001_init_ddl.sql
deleted file mode 100644
index efcd415e3..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/sql/001_init_ddl.sql
+++ /dev/null
@@ -1,96 +0,0 @@
--- -----------------------------------------------------
--- Dropping tables ( One time )
--- -----------------------------------------------------
-
-DROP TABLE sdnctl.CONFIG_RESOURCE_ASSIGNMENT_DATA;
-DROP TABLE sdnctl.CONFIG_RESOURCE;
-DROP TABLE sdnctl.CONFIG_RESOURCE_RELATION;
-DROP TABLE sdnctl.CONFIG_TRANSACTION_LOG
-
-
--- -----------------------------------------------------
--- table sdnctl.CONFIG_TRANSACTION_LOG
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_TRANSACTION_LOG (
- config_transaction_log_id VARCHAR(50) NOT NULL,
- request_id VARCHAR(50) NULL DEFAULT NULL,
- message_type VARCHAR(100) NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- message LONGTEXT NULL DEFAULT NULL,
- PRIMARY KEY PK_CONFIG_TRANSACTION_LOG (config_transaction_log_id)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
--- -----------------------------------------------------
--- table sdnctl.CONFIG_RESOURCE
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_RESOURCE (
- config_resource_id VARCHAR(50) NOT NULL,
- resource_id VARCHAR(50) NOT NULL,
- resource_type VARCHAR(50) NOT NULL,
- service_template_name VARCHAR(50) NULL DEFAULT NULL,
- service_template_version VARCHAR(50) NULL DEFAULT NULL,
- template_name VARCHAR(50) NOT NULL,
- recipe_name VARCHAR(50) NOT NULL,
- request_id VARCHAR(50) NOT NULL,
- resource_data LONGTEXT NULL DEFAULT NULL,
- mask_data LONGTEXT NULL DEFAULT NULL,
- created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- status VARCHAR(20) NOT NULL,
- updated_by VARCHAR(50) NOT NULL,
- PRIMARY KEY PK_CONFIG_RESOURCE (config_resource_id),
- INDEX IX_CONFIG_RESOURCE (created_date desc)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
--- -----------------------------------------------------
--- table sdnctl.CONFIG_RESOURCE_RELATION
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_RESOURCE_RELATION (
- config_resource_relation_id VARCHAR(50) NOT NULL,
- resource_id VARCHAR(50) NOT NULL,
- related_resource_id VARCHAR(50) NOT NULL,
- relation_type VARCHAR(50) NOT NULL DEFAULT 'children',
- created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(50) NOT NULL,
- PRIMARY KEY PK_CONFIG_RESOURCE_RELATION (config_resource_relation_id),
- INDEX IX_CONFIG_RESOURCE_RELATION (created_date desc),
- CONSTRAINT FK_CONFIG_RESOURCE_RELATION_TO_CONFIG_RESOURCE1
- FOREIGN KEY (resource_id)
- REFERENCES sdnctl.CONFIG_RESOURCE (config_resource_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION,
- CONSTRAINT FK_CONFIG_RESOURCE_RELATION_TO_CONFIG_RESOURCE2
- FOREIGN KEY (related_resource_id)
- REFERENCES sdnctl.CONFIG_RESOURCE (config_resource_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
-
--- -----------------------------------------------------
--- table sdnctl.CONFIG_RESOURCE_ASSIGNMENT_DATA
--- -----------------------------------------------------
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_RESOURCE_ASSIGNMENT_DATA (
- config_resource_assignment_data_id VARCHAR(50) NOT NULL,
- config_resource_id VARCHAR(50) NOT NULL,
- version INT(11) NOT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(50) NOT NULL,
- template_key_name VARCHAR(50) NOT NULL,
- resource_name VARCHAR(50) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- resource_value LONGTEXT NOT NULL,
- source VARCHAR(50) NOT NULL,
- status VARCHAR(50) NOT NULL,
- message LONGTEXT NOT NULL,
- PRIMARY KEY PK_CONFIG_RESOURCE (config_resource_assignment_data_id),
- INDEX IX_CONFIG_RESOURCE (updated_date desc),
- CONSTRAINT FK_CONFIG_RESOURCE_ASSIGNMENT_DATA
- FOREIGN KEY (config_resource_id)
- REFERENCES sdnctl.CONFIG_RESOURCE (config_resource_id)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoTest.java
deleted file mode 100644
index 99b0c0b7e..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigResourceDaoTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.ResourceAssignmentData;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ConfigResourceDaoTest {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigResourceDaoTest.class);
-
- @Autowired
- private ConfigResourceDao configResourceDao;
-
- @Before
- public void initialise() {
-
- }
-
- @Test
- public void testAssignmentResourceData() throws Exception {
- ConfigResource configResource = new ConfigResource();
- String resourceData = IOUtils.toString(
- ConfigResourceDaoTest.class.getClassLoader().getResourceAsStream("reference/resource_data.json"),
- Charset.defaultCharset());
-
- logger.trace("resourceData = " + resourceData);
- configResource.setResourceData(resourceData);
- configResource.setServiceTemplateName("sample-name");
- configResource.setServiceTemplateVersion("1.0.0");
- configResource.setResourceId("123456");
- configResource.setResourceType("vUSP - vDBE-IPX HUB");
- configResource.setRequestId("123456");
- configResource.setRecipeName("activate-action");
- configResource.setTemplateName("vrr-service-template");
- configResource.setMaskData(null);
- configResource.setStatus("success");
- configResource.setCreatedDate(new Date(System.currentTimeMillis()));
- configResource.setUpdatedBy("an188a");
-
- List<ResourceAssignmentData> resourceAssignments = new ArrayList<>();
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setDataType("string");
- resourceAssignmentData.setStatus("success");
- resourceAssignmentData.setMessage("success");
- resourceAssignmentData.setTemplateKeyName("sample");
- resourceAssignmentData.setResourceName("sample");
- // resourceAssignmentData.setResourceValue("sample123");
- resourceAssignmentData.setSource("input");
- resourceAssignments.add(resourceAssignmentData);
- configResource.setResourceAssignments(resourceAssignments);
-
- ConfigResource dbConfigResource = configResourceDao.save(configResource);
- logger.info("Saved sucessfully : " + dbConfigResource.toString());
- Assert.assertNotNull("ConfigResource is null", dbConfigResource);
- Assert.assertNotNull("Resource Assignment Data is null", dbConfigResource.getResourceAssignments());
- Assert.assertEquals("Resource Assignment Data count missmatch", true,
- dbConfigResource.getResourceAssignments().size() > 0);
- }
-
- @Test
- public void testConfigResourcesData() throws Exception {
- ConfigResource configResourceInput = new ConfigResource();
- configResourceInput.setResourceId("123456");
- List<ConfigResource> dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);
- Assert.assertNotNull("ConfigResources is null", dbConfigResources);
- Assert.assertEquals("ConfigResources size missmatch", true, dbConfigResources.size() > 0);
-
- for (ConfigResource configResource : dbConfigResources) {
- Assert.assertNotNull("ConfigResources Assignments is null", configResource.getResourceAssignments());
- Assert.assertTrue("ConfigResources Assignments size miss mathch ",
- configResource.getResourceAssignments().size() > 0);
- logger.trace("ResourceAssignments = " + configResource.getResourceAssignments());
- }
- }
-
- @Test
- public void testDeleteByConfigResource() throws Exception {
- ConfigResource configResourceInput = new ConfigResource();
- configResourceInput.setResourceId("123456");
-
- List<ConfigResource> dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);
- Assert.assertTrue("ConfigResources is null", !dbConfigResources.isEmpty());
-
- configResourceInput.setConfigResourceId(dbConfigResources.get(0).getConfigResourceId());
- configResourceDao.deleteByConfigResource(configResourceInput);
-
- dbConfigResources = configResourceDao.findByConfigResource(configResourceInput);
- Assert.assertTrue("ConfigResources is not null", dbConfigResources.isEmpty());
- }
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigTransactionLogDaoTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigTransactionLogDaoTest.java
deleted file mode 100644
index 38cd1b20d..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigTransactionLogDaoTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ConfigTransactionLogDaoTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigTransactionLogDaoTest.class);
-
- @Autowired
- private TransactionLogDao transactionLogDao;
-
- @Autowired
- private NamedQueryExecutorDao namedQueryExecutorDao;
-
- @Before
- public void initialise() {
-
- }
-
- @Test
- public void testQueryExecution() throws Exception {
- String requestId = "12345";
-
- transactionLogDao
- .save(new TransactionLog(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG, "Received Request"));
-
- List<TransactionLog> result = transactionLogDao.getTransactionsByRequestId(requestId);
- logger.info("DB ArtifactReference :" + result);
- Assert.assertNotNull("Failed to get Query Result", result);
-
- List<TransactionLog> result2 =
- transactionLogDao.getTransactionsByRequestId(requestId, DataAdaptorConstants.LOG_MESSAGE_TYPE_LOG);
- logger.info("DB ArtifactReference :" + result2);
- Assert.assertNotNull("Failed to get Query Result", result2);
-
- String namedsql = "SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = :request_id";
- Map<String, Object> parameters = new HashMap<>();
- parameters.put("request_id", "12345");
- List<Map<String, Object>> namedresult = namedQueryExecutorDao.query(namedsql, parameters);
- logger.info("DB ArtifactReference :" + namedresult);
- Assert.assertNotNull("Failed to get Query Result", namedresult);
-
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoTest.java
deleted file mode 100644
index ddc9495a7..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/QueryExecutorDaoTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.dao;
-
-import java.util.Date;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.FixMethodOrder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.MethodSorters;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class QueryExecutorDaoTest {
- private static EELFLogger logger = EELFManager.getInstance().getLogger(QueryExecutorDaoTest.class);
-
- @Autowired
- private QueryExecutorDao queryExecutorDao;
-
- @Before
- public void initialise() {
-
- }
-
- @Test
- public void testInsertQueryExecution() throws Exception {
-
- String sql = "INSERT INTO CONFIG_RESOURCE"
- + "(config_resource_id, resource_id, resource_type, template_name, recipe_name, request_id, resource_data, mask_data, created_date, updated_by) "
- + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
- Object[] data =
- new Object[] {"12345", "vUSP - vDBE-IPX HUB", "1234567", "activate-action", "vrr-service-template",
- "resource-data", "mask-data", null, new Date(System.currentTimeMillis()), "ab1234"};
- int result = queryExecutorDao.update(sql, data);
- logger.info("Updated successfully rows :" + result);
- Assert.assertNotNull("Failed to get Query Result", result);
- }
-
- @Test
- public void testUpdateQueryExecution() throws Exception {
-
- String sql = "UPDATE CONFIG_RESOURCE set recipe_name=? where config_resource_id=?";
- Object[] data = new Object[] {"vce-service-template", "12345"};
- int result = queryExecutorDao.update(sql, data);
- logger.info("Updated successfully rows :" + result);
- Assert.assertNotNull("Failed to get Query Result", result);
- }
-
- @Test
- public void testDeleteQueryExecution() throws Exception {
-
- String sql = "DELETE FROM CONFIG_RESOURCE where config_resource_id=?";
- Object[] data = new Object[] {"12345"};
- int result = queryExecutorDao.update(sql, data);
- logger.info("Updated successfully rows :" + result);
- Assert.assertNotNull("Failed to get Query Result", result);
- }
-
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNodeTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNodeTest.java
deleted file mode 100644
index 05df76ce4..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceNodeTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;
-import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDao;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})
-public class ConfigResourceNodeTest {
-
- ConfigResourceNode configResourceNode;
-
- ConfigResourceService configResourceService;
-
- @Autowired
- TransactionLogDao transactionLogDao;
-
- @Autowired
- ConfigResourceDao configResourceDao;
-
- @Autowired
- QueryExecutorDao queryExecutorDao;
-
- @Autowired
- NamedQueryExecutorDao namedQueryExecutorDao;
-
- @Before
- public void before() {
- configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,
- namedQueryExecutorDao);
- configResourceNode = new ConfigResourceNode(configResourceService);
- }
-
- @Test
- public void testSaveConfigTransactionLog() throws Exception {
- Map<String, String> inParams = new HashMap<>();
- inParams.put(DataAdaptorConstants.INPUT_PARAM_MESSAGE_TYPE, "messageType");
- inParams.put(DataAdaptorConstants.INPUT_PARAM_MESSAGE, "message");
- SvcLogicContext ctx = new SvcLogicContext();
- ctx.setAttribute("request-id", "requestId12345");
-
- configResourceNode.saveConfigTransactionLog(inParams, ctx);
-
- Assert.assertTrue(!transactionLogDao.getTransactionsByRequestId("requestId12345").isEmpty());
- }
-
- @Test(expected = SvcLogicException.class)
- public void testSaveConfigTransactionLogException() throws Exception {
- configResourceNode = new ConfigResourceNode(null);
- configResourceNode.saveConfigTransactionLog(new HashMap<>(), new SvcLogicContext());
- }
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceTest.java
deleted file mode 100644
index 76d28d1c5..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/service/ConfigResourceServiceTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.features.data.adaptor.service;
-
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import org.apache.commons.io.IOUtils;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoTest;
-import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;
-import org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDao;
-import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;
-import org.onap.ccsdk.features.data.adaptor.domain.ResourceAssignmentData;
-import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})
-public class ConfigResourceServiceTest {
-
- ConfigResourceService configResourceService;
-
- @Autowired
- TransactionLogDao transactionLogDao;
-
- @Autowired
- ConfigResourceDao configResourceDao;
-
- @Autowired
- QueryExecutorDao queryExecutorDao;
-
- @Autowired
- NamedQueryExecutorDao namedQueryExecutorDao;
-
- @Before
- public void before() {
- configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,
- namedQueryExecutorDao);
- }
-
- @Test
- public void testUpdate() throws Exception {
- String sql = "INSERT INTO CONFIG_RESOURCE"
- + "(config_resource_id, resource_id, resource_type, template_name, recipe_name, request_id, resource_data, mask_data, created_date, updated_by) "
- + "VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
- Object[] data =
- new Object[] {"54321", "vUSP - vDBE-IPX HUB", "1234567", "activate-action", "vrr-service-template",
- "resource-data", "mask-data", null, new Date(System.currentTimeMillis()), "ab1234"};
- int result = configResourceService.update(sql, data);
- Assert.assertTrue(result == 1);
-
- sql = "SELECT * FROM CONFIG_RESOURCE WHERE config_resource_id = ?";
- data = new Object[] {"54321"};
- List<Map<String, Object>> queryResult = configResourceService.query(sql, data);
- Assert.assertTrue(queryResult.size() == 1);
- }
-
- @Test
- public void testSaveAndGetConfigResource() throws Exception {
- ConfigResource configResource = new ConfigResource();
- String resourceData = IOUtils.toString(
- ConfigResourceDaoTest.class.getClassLoader().getResourceAsStream("reference/resource_data.json"),
- Charset.defaultCharset());
-
- configResource.setResourceData(resourceData);
- configResource.setServiceTemplateName("sample-name");
- configResource.setServiceTemplateVersion("1.0.0");
- configResource.setResourceId("123456");
- configResource.setResourceType("vUSP - vDBE-IPX HUB");
- configResource.setRequestId("123456");
- configResource.setRecipeName("activate-action");
- configResource.setTemplateName("vrr-service-template");
- configResource.setMaskData(null);
- configResource.setStatus("success");
- configResource.setCreatedDate(new Date(System.currentTimeMillis()));
- configResource.setUpdatedBy("an188a");
-
- List<ResourceAssignmentData> resourceAssignments = new ArrayList<>();
- ResourceAssignmentData resourceAssignmentData = new ResourceAssignmentData();
- resourceAssignmentData.setDataType("string");
- resourceAssignmentData.setStatus("success");
- resourceAssignmentData.setMessage("success");
- resourceAssignmentData.setTemplateKeyName("sample");
- resourceAssignmentData.setResourceName("sample");
- // resourceAssignmentData.setResourceValue("sample123");
- resourceAssignmentData.setSource("input");
- resourceAssignments.add(resourceAssignmentData);
- configResource.setResourceAssignments(resourceAssignments);
-
- // save
- ConfigResource dbConfigResource = configResourceService.saveConfigResource(configResource);
- Assert.assertNotNull("ConfigResource is null", dbConfigResource);
- Assert.assertNotNull("Resource Assignment Data is null", dbConfigResource.getResourceAssignments());
- Assert.assertEquals("Resource Assignment Data count missmatch", true,
- dbConfigResource.getResourceAssignments().size() > 0);
- Assert.assertEquals(configResource.getServiceTemplateVersion(), dbConfigResource.getServiceTemplateVersion());
-
- // update
- configResource.setServiceTemplateVersion("1.0.1");
- dbConfigResource = configResourceService.saveConfigResource(configResource);
- Assert.assertNotNull("ConfigResource is null", dbConfigResource);
- Assert.assertNotNull("Resource Assignment Data is null", dbConfigResource.getResourceAssignments());
- Assert.assertEquals("Resource Assignment Data count missmatch", true,
- dbConfigResource.getResourceAssignments().size() > 0);
- Assert.assertEquals(configResource.getServiceTemplateVersion(), dbConfigResource.getServiceTemplateVersion());
-
- // find
- ConfigResource configResourceInput = new ConfigResource();
- configResourceInput.setResourceId(configResource.getResourceId());
- configResourceInput.setTemplateName(configResource.getTemplateName());
- configResourceInput.setServiceTemplateName(configResource.getServiceTemplateName());
- configResourceInput.setServiceTemplateVersion(configResource.getServiceTemplateVersion());
- configResourceInput.setRequestId(configResource.getRequestId());
- configResourceInput.setRecipeName(configResource.getRecipeName());
- configResourceInput.setResourceType(configResource.getResourceType());
- List<ConfigResource> dbConfigResources = configResourceService.getConfigResource(configResourceInput);
- Assert.assertNotNull("ConfigResources is null", dbConfigResources);
- Assert.assertEquals("ConfigResources size missmatch", true, dbConfigResources.size() > 0);
-
- for (ConfigResource dbConfigResouce : dbConfigResources) {
- Assert.assertNotNull("ConfigResources Assignments is null", dbConfigResouce.getResourceAssignments());
- Assert.assertTrue("ConfigResources Assignments size miss mathch ",
- dbConfigResouce.getResourceAssignments().size() > 0);
- }
- }
-
- @Test
- public void testSaveAndGetTransactionLog() throws Exception {
- TransactionLog transactionLog = new TransactionLog();
- transactionLog.setMessage("message");
- transactionLog.setMessageType("messageType");
- transactionLog.setRequestId("requestId");
-
- configResourceService.save(transactionLog);
-
- List<TransactionLog> transactions =
- configResourceService.getTransactionsByRequestId(transactionLog.getRequestId());
- Assert.assertTrue(transactions.size() == 1);
- transactions = configResourceService.getTransactionsByRequestId(transactionLog.getRequestId(),
- transactionLog.getMessageType());
- Assert.assertTrue(transactions.size() == 1);
- }
-
- @Test
- public void testNamedQueryExecutorUpdateNQuery() throws Exception {
- Map<String, Object> parameters = new HashMap<>();
- parameters.put("config_transaction_log_id", UUID.randomUUID().toString());
- parameters.put("request_id", "requestId123");
- parameters.put("message_type", "messageType");
- parameters.put("message", "message");
- configResourceService.update(
- "INSERT INTO CONFIG_TRANSACTION_LOG ( config_transaction_log_id, request_id, message_type, message ) VALUES (:config_transaction_log_id, :request_id, :message_type, :message) ",
- parameters);
-
- List<Map<String, Object>> result = configResourceService
- .query("SELECT * FROM CONFIG_TRANSACTION_LOG WHERE request_id = :request_id", parameters);
-
- Assert.assertTrue(!result.isEmpty());
- Assert.assertNotNull(configResourceService.getNamedParameterJdbcTemplate());
- }
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/log4j.properties b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/log4j.properties
deleted file mode 100644
index 1f83d159a..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###
-# Copyright © 2017-2018 AT&T Intellectual Property.
-# Modifications Copyright © 2018 IBM.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-###
-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
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/mappings/service-mapping.json b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/mappings/service-mapping.json
deleted file mode 100644
index e595e1613..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/mappings/service-mapping.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "resource": {
- "name": "bundle-mac",
- "searchCriteriaDefintion": {
- "sourceSystemResourceResolution": {
- "searchCriteriaValue": "$ptnni_equip_name",
- "searchCriteriaType": "equipment"
- }
- }
- }
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/reference/resource_data.json b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/reference/resource_data.json
deleted file mode 100644
index 32162ecaf..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/reference/resource_data.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "group-name": "AG_AUTORP_NOOVERRIDE"
-}
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/sql/schema.sql b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/sql/schema.sql
deleted file mode 100644
index af7f02c51..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/sql/schema.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-
-CREATE TABLE IF NOT EXISTS CONFIG_RESOURCE (
- config_resource_id VARCHAR(50) PRIMARY KEY,
- resource_id VARCHAR(50) NOT NULL,
- resource_type VARCHAR(50) NOT NULL,
- service_template_name VARCHAR(50) NULL DEFAULT NULL,
- service_template_version VARCHAR(50) NULL DEFAULT NULL,
- template_name VARCHAR(50) NOT NULL,
- recipe_name VARCHAR(50) NOT NULL,
- request_id VARCHAR(50) NOT NULL,
- resource_data LONGTEXT NULL DEFAULT NULL,
- mask_data LONGTEXT NULL DEFAULT NULL,
- created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- status VARCHAR(20) NOT NULL,
- updated_by VARCHAR(50) NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS CONFIG_RESOURCE_ASSIGNMENT_DATA (
- config_resource_assignment_data_id VARCHAR(50) PRIMARY KEY,
- config_resource_id VARCHAR(50) NOT NULL,
- version INT(11) NOT NULL,
- updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- updated_by VARCHAR(50) NOT NULL,
- template_key_name VARCHAR(50) NOT NULL,
- resource_name VARCHAR(50) NOT NULL,
- data_type VARCHAR(100) NOT NULL,
- entry_schema VARCHAR(100) NULL DEFAULT NULL,
- resource_value LONGTEXT NOT NULL,
- source VARCHAR(50) NOT NULL,
- status VARCHAR(50) NOT NULL,
- message LONGTEXT NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS CONFIG_TRANSACTION_LOG (
- config_transaction_log_id VARCHAR(50) PRIMARY KEY,
- request_id VARCHAR(50) NULL DEFAULT NULL,
- message_type VARCHAR(100) NULL DEFAULT NULL,
- creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- message LONGTEXT NULL DEFAULT NULL
-);
-
-
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context-h2db.xml b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context-h2db.xml
deleted file mode 100644
index 9e413b099..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context-h2db.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright
- © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
- OR CONDITIONS OF ANY KIND, either express or implied. See the License for
- the specific language governing permissions and limitations under the License. -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:jdbc="http://www.springframework.org/schema/jdbc"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/jdbc
- http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.1.xsd">
-
- <context:annotation-config />
-
- <bean id="test.dataSource"
- class="org.springframework.jdbc.datasource.DriverManagerDataSource"
- lazy-init="false">
- <property name="driverClassName" value="org.h2.Driver" />
- <property name="url"
- value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL" />
- </bean>
-
- <jdbc:initialize-database
- data-source="test.dataSource">
- <jdbc:script location="sql/schema.sql" />
- </jdbc:initialize-database>
-
- <bean id="jdbcTemplate"
- class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="test.dataSource" />
- </bean>
-
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <constructor-arg ref="test.dataSource" />
- </bean>
-
- <bean id="configResourceDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoImpl">
- <constructor-arg ref="jdbcTemplate" />
- </bean>
-
- <bean id="queryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">
- <constructor-arg ref="jdbcTemplate" />
- </bean>
-
- <bean id="namedQueryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDaoImpl">
- <constructor-arg ref="namedParameterJdbcTemplate" />
- </bean>
-
- <bean id="transactionLogDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.TransactionLogDaoImpl">
- <constructor-arg ref="jdbcTemplate" />
- </bean>
-
- <context:component-scan
- base-package="org.onap.ccsdk.features.data.adaptor" />
-
-</beans>
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context.xml b/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context.xml
deleted file mode 100644
index 59af664b1..000000000
--- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/resources/test-context.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright © 2017-2018 AT&T Intellectual Property.
- Modifications Copyright © 2018 IBM.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:jdbc="http://www.springframework.org/schema/jdbc"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/jdbc
- http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.1.xsd
- ">
-
- <context:annotation-config />
-
- <bean id="test.dataSource"
- class="org.springframework.jdbc.datasource.DriverManagerDataSource"
- lazy-init="false">
- <property name="driverClassName"
- value="org.mariadb.jdbc.Driver" />
- <property name="url"
- value="jdbc:mysql://localhost:3306/sdnctl" />
- <property name="username" value="sdnctl" />
- <property name="password" value="sdnctl" />
- </bean>
-
-
- <!-- <bean id="test.dataSource" -->
- <!-- class="org.springframework.jdbc.datasource.DriverManagerDataSource" -->
- <!-- lazy-init="false"> -->
- <!-- <property name="driverClassName" value="org.h2.Driver" /> -->
- <!-- <property name="url" -->
- <!-- value="jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=MySQL" /> -->
- <!-- </bean> -->
- <!-- <jdbc:initialize-database data-source="test.dataSource"> -->
- <!-- <jdbc:script location="sql/schema.sql" /> -->
- <!-- </jdbc:initialize-database> -->
- <!-- <bean id="dataSetup" -->
- <!-- class="org.onap.ccsdk.features.data.adaptor.db.utils.DataSetup"> -->
- <!-- <property name="testDb" ref="testDb" /> -->
- <!-- </bean> -->
- <!-- <bean id="testDb" class="org.onap.ccsdk.features.data.adaptor.db.utils.TestDb"> -->
- <!-- <property name="jdbcTemplate" ref="jdbcTemplate" /> -->
- <!-- </bean> -->
-
- <bean id="jdbcTemplate"
- class="org.springframework.jdbc.core.JdbcTemplate">
- <property name="dataSource" ref="test.dataSource" />
- </bean>
-
- <bean id="namedParameterJdbcTemplate"
- class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
- <constructor-arg ref="test.dataSource" />
- </bean>
-
- <bean id="configResourcelDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoImpl">
- <constructor-arg ref="jdbcTemplate" />
- </bean>
-
- <bean id="queryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">
- <constructor-arg ref="jdbcTemplate" />
- </bean>
-
- <bean id="namedQueryExecutorDao"
- class="org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDaoImpl">
- <constructor-arg ref="namedParameterJdbcTemplate" />
- </bean>
-
- <context:component-scan
- base-package="org.onap.ccsdk.features.data.adaptor" />
-
-</beans>