From b1248f701a8428d9e0df45af18e306a7e4545669 Mon Sep 17 00:00:00 2001 From: "Singal, Kapil (ks220y)" Date: Fri, 14 Sep 2018 16:03:35 -0400 Subject: SDN Controller Blueprint Processor Removing Config Property Map Table and Dao Implementation Reformatting Codebase as per Onap Code Style Change-Id: I0841d5173aa40268e3451fd793826835c74fec77 Issue-ID: CCSDK-572 Signed-off-by: Singal, Kapil (ks220y) --- .../adaptors/data-adaptor-provider/pom.xml | 226 ++++++++++----------- .../data/adaptor/dao/ConfigPropertyMapDao.java | 33 --- .../data/adaptor/dao/ConfigPropertyMapDaoImpl.java | 74 ------- .../data/adaptor/dao/ConfigResourceDao.java | 1 - .../data/adaptor/dao/TransactionLogDao.java | 1 - .../data/adaptor/domain/ConfigPropertyMapData.java | 49 ----- .../adaptor/service/ConfigResourceService.java | 10 - .../adaptor/service/ConfigResourceServiceImpl.java | 12 +- .../org/opendaylight/blueprint/impl-blueprint.xml | 34 +--- .../src/main/resources/sql/001_init_ddl.sql | 10 - .../data/adaptor/dao/ConfigPropertyMapDaoTest.java | 53 ----- .../adaptor/service/ConfigResourceNodeTest.java | 6 +- .../adaptor/service/ConfigResourceServiceTest.java | 6 +- .../src/test/resources/sql/schema.sql | 88 ++++---- .../src/test/resources/test-context-h2db.xml | 29 +-- .../src/test/resources/test-context.xml | 5 - .../service/AbstractConfigRestClientAdapter.java | 6 +- .../service/ConfigRestAdaptorServiceImpl.java | 1 - .../adaptor/service/SSLRestClientAdapterImpl.java | 1 - .../utils/BasicAuthorizationInterceptor.java | 10 +- 20 files changed, 180 insertions(+), 475 deletions(-) delete mode 100644 blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDao.java delete mode 100644 blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoImpl.java delete mode 100644 blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigPropertyMapData.java delete mode 100644 blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoTest.java (limited to 'blueprints-processor/adaptors') diff --git a/blueprints-processor/adaptors/data-adaptor-provider/pom.xml b/blueprints-processor/adaptors/data-adaptor-provider/pom.xml index 0de0bab0a..99a1f923e 100644 --- a/blueprints-processor/adaptors/data-adaptor-provider/pom.xml +++ b/blueprints-processor/adaptors/data-adaptor-provider/pom.xml @@ -1,125 +1,117 @@ - + - 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"> + 4.0.0 - - org.onap.ccsdk.parent - binding-parent - 1.1.0-SNAPSHOT - - + + org.onap.ccsdk.parent + binding-parent + 1.1.0-SNAPSHOT + + - org.onap.ccsdk.features - 0.3.0-SNAPSHOT - blueprints-data-adaptor-provider - bundle - Blueprints Data Adaptor - Provider - http://maven.apache.org + org.onap.ccsdk.features + 0.3.0-SNAPSHOT + blueprints-data-adaptor-provider + bundle + Blueprints Data Adaptor - Provider + http://maven.apache.org - - - org.apache.commons - commons-lang3 - ${commons.lang3.version} - - - org.onap.ccsdk.sli.core - sli-provider - ${project.version} - compile - - - commons-io - commons-io - 2.5 - - - org.mariadb.jdbc - mariadb-java-client - ${mariadb.connector.version} - runtime - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-jdbc - ${spring.version} - - - com.att.eelf - eelf-core - ${eelf.version} - - - org.springframework - spring-test - ${spring.version} - test - - - com.h2database - h2 - ${h2database.version} - test - - - junit - junit - ${junit.version} - test - - + + + org.apache.commons + commons-lang3 + ${commons.lang3.version} + + + org.onap.ccsdk.sli.core + sli-provider + ${project.version} + compile + + + commons-io + commons-io + 2.5 + + + org.mariadb.jdbc + mariadb-java-client + ${mariadb.connector.version} + runtime + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + com.att.eelf + eelf-core + ${eelf.version} + + + org.springframework + spring-test + ${spring.version} + test + + + com.h2database + h2 + ${h2database.version} + test + + + junit + junit + ${junit.version} + test + + - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - org.apache.felix - maven-bundle-plugin - ${maven.bundle.version} - true - - - ${project.artifactId} - ${project.groupId}.${project.artifactId} - 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 - - - - - - + + + + org.apache.maven.plugins + maven-javadoc-plugin + + -Xdoclint:none + + + + org.apache.felix + maven-bundle-plugin + ${maven.bundle.version} + true + + + ${project.artifactId} + ${project.groupId}.${project.artifactId} + 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 + + + + + + diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDao.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDao.java deleted file mode 100644 index 4a77f7f05..000000000 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDao.java +++ /dev/null @@ -1,33 +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 org.onap.ccsdk.sli.core.sli.SvcLogicException; - -public interface ConfigPropertyMapDao { - - /** - * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key. - * - * @param key key mapped to a value - * @return the result string, containing mapped string value - * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails - */ - public String getConfigPropertyByKey(String key) throws SvcLogicException; - -} diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoImpl.java deleted file mode 100644 index 90f92ca27..000000000 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoImpl.java +++ /dev/null @@ -1,74 +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.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.apache.commons.lang3.StringUtils; -import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.springframework.jdbc.CannotGetJdbcConnectionException; -import org.springframework.jdbc.core.JdbcTemplate; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.base.Preconditions; - -public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao { - - private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigPropertyMapDaoImpl.class); - - private JdbcTemplate jdbcTemplate; - private Map configPropertyMap = new ConcurrentHashMap<>(); - - public ConfigPropertyMapDaoImpl(JdbcTemplate jdbcTemplate) { - this.jdbcTemplate = jdbcTemplate; - initializeMap(); - - String envType = configPropertyMap.get(DataAdaptorConstants.PROPERTY_ENV_TYPE); - if (!(DataAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType) - || DataAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) { - ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); - Runnable task = this::initializeMap; - executor.scheduleWithFixedDelay(task, 60, 15, TimeUnit.MINUTES); - } - } - - private void initializeMap() { - try { - String getPropQuery = "SELECT * FROM CONFIG_PROPERTY_MAP"; - jdbcTemplate.queryForList(getPropQuery).forEach(rows -> { - String key = StringUtils.trimToEmpty((String) rows.get("reference_key")); - String value = StringUtils.trimToEmpty((String) rows.get("reference_value")); - configPropertyMap.put(key, value); - }); - logger.trace("loaded configPropertyMap : ({})", configPropertyMap); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - - @Override - public String getConfigPropertyByKey(String key) throws SvcLogicException { - Preconditions.checkArgument(StringUtils.isNotBlank(key), "missing property key"); - return configPropertyMap.get(key); - } - -} 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 index 5e50d6f5f..bc33d51a3 100644 --- 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 @@ -18,7 +18,6 @@ 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; 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 index c9c5f8a73..c0381a989 100644 --- 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 @@ -18,7 +18,6 @@ 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; diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigPropertyMapData.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigPropertyMapData.java deleted file mode 100644 index d9503b3be..000000000 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/features/data/adaptor/domain/ConfigPropertyMapData.java +++ /dev/null @@ -1,49 +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; - -public class ConfigPropertyMapData implements Serializable { - private static final long serialVersionUID = 1L; - - private String referenceKey; - private String referenceValue; - - public String getReferenceKey() { - return referenceKey; - } - - public void setReferenceKey(String referenceKey) { - this.referenceKey = referenceKey; - } - - public String getReferenceValue() { - return referenceValue; - } - - public void setReferenceValue(String referenceValue) { - this.referenceValue = referenceValue; - } - - @Override - public String toString() { - return "ConfigPropertyMapData [referenceKey=" + referenceKey + ", referenceValue=" + referenceValue + "]"; - } - -} 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 index 2f01749a3..cbd9e9279 100644 --- 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 @@ -19,7 +19,6 @@ 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; @@ -127,15 +126,6 @@ public interface ConfigResourceService { */ public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException; - /** - * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key. - * - * @param key key mapped to a value - * @return the result string, containing mapped string value - * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails - */ - public String getConfigPropertyByKey(String key) throws SvcLogicException; - /** * Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a * TransactionLog RowMapper. 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 index bf1990377..ab24f16c7 100644 --- 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 @@ -19,8 +19,6 @@ package org.onap.ccsdk.features.data.adaptor.service; import java.util.List; import java.util.Map; - -import org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDao; 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; @@ -40,19 +38,16 @@ public class ConfigResourceServiceImpl implements ConfigResourceService { private ConfigResourceDao configResourceDao; private QueryExecutorDao queryExecutorDao; private NamedQueryExecutorDao namedQueryExecutorDao; - private ConfigPropertyMapDao configPropertyMapDao; @SuppressWarnings("squid:S00107") public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao, - QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao, - ConfigPropertyMapDao configPropertyMapDao) { + QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao) { logger.info("{} Constuctor Initated...", CLASS_NAME); this.transactionLogDao = transactionLogDao; this.configResourceDao = configResourceDao; this.queryExecutorDao = queryExecutorDao; this.namedQueryExecutorDao = namedQueryExecutorDao; - this.configPropertyMapDao = configPropertyMapDao; } @Override @@ -106,9 +101,4 @@ public class ConfigResourceServiceImpl implements ConfigResourceService { return configResourceDao.save(configResource); } - @Override - public String getConfigPropertyByKey(String key) throws SvcLogicException { - return configPropertyMapDao.getConfigPropertyByKey(key); - } - } 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 index e38bcd3ce..76459d51d 100644 --- 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 @@ -1,20 +1,12 @@ - + - - - - + class="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceServiceImpl"> - + interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" /> 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 index 593f347de..efcd415e3 100644 --- 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 @@ -6,7 +6,6 @@ DROP TABLE sdnctl.CONFIG_RESOURCE_ASSIGNMENT_DATA; DROP TABLE sdnctl.CONFIG_RESOURCE; DROP TABLE sdnctl.CONFIG_RESOURCE_RELATION; DROP TABLE sdnctl.CONFIG_TRANSACTION_LOG -DROP TABLE sdnctl.CONFIG_PROPERTY_MAP -- ----------------------------------------------------- @@ -95,12 +94,3 @@ CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_RESOURCE_ASSIGNMENT_DATA ( ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- ----------------------------------------------------- --- table sdnctl.CONFIG_PROPERTY_MAP --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_PROPERTY_MAP ( - reference_key VARCHAR(100) NOT NULL, - reference_value VARCHAR(250) NOT NULL, - CONSTRAINT PK_CONFIG_PROPERTY_MAP PRIMARY KEY (reference_key) - ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoTest.java b/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoTest.java deleted file mode 100644 index 1915017a6..000000000 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/test/java/org/onap/ccsdk/features/data/adaptor/dao/ConfigPropertyMapDaoTest.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 org.junit.Assert; -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.dao.ConfigPropertyMapDao; -import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao; -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"}) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class ConfigPropertyMapDaoTest { - - @Autowired - private ConfigPropertyMapDao configPropertyMapDao; - - @Autowired - private QueryExecutorDao queryExecutorDao; - - @Test - public void testConfigResourcesData() throws Exception { - String sql = "INSERT INTO CONFIG_PROPERTY_MAP (reference_key, reference_value) VALUES ( ?, ?)"; - Object[] data = new Object[] {"dummy123", "username123"}; - int result = queryExecutorDao.update(sql, data); - Assert.assertNotNull("Failed to get Query Result", result); - - String propKeyValye = configPropertyMapDao.getConfigPropertyByKey("org.onap.ccsdk.features.rest.adaptors.test"); - Assert.assertNull("propKeyValue is null", propKeyValye); - } - -} 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 index 53724c5c9..61a2e3196 100644 --- 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 @@ -24,7 +24,6 @@ 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.ConfigPropertyMapDao; 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; @@ -58,13 +57,10 @@ public class ConfigResourceNodeTest { @Autowired NamedQueryExecutorDao namedQueryExecutorDao; - @Autowired - ConfigPropertyMapDao configPropertyMapDao; - @Before public void before() { configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao, - namedQueryExecutorDao, configPropertyMapDao); + namedQueryExecutorDao); configResourceNode = new ConfigResourceNode(configResourceService); } 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 index 2d599e2f1..cecede810 100644 --- 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 @@ -29,7 +29,6 @@ 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.ConfigPropertyMapDao; 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; @@ -62,13 +61,10 @@ public class ConfigResourceServiceTest { @Autowired NamedQueryExecutorDao namedQueryExecutorDao; - @Autowired - ConfigPropertyMapDao configPropertyMapDao; - @Before public void before() { configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao, - namedQueryExecutorDao, configPropertyMapDao); + namedQueryExecutorDao); } @Test 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 index 15d22e242..af7f02c51 100644 --- 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 @@ -1,46 +1,42 @@ - -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 -); - -CREATE TABLE IF NOT EXISTS CONFIG_PROPERTY_MAP ( - reference_key VARCHAR(100) NOT NULL, - reference_value VARCHAR(250) NOT NULL -); - + +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 index baffb54e6..9e413b099 100644 --- 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 @@ -1,20 +1,12 @@ - + - - - - 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 index ee3d33120..59af664b1 100644 --- 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 @@ -75,11 +75,6 @@ - - - - diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java index 207e87fc3..6cc4bdabf 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/AbstractConfigRestClientAdapter.java @@ -147,8 +147,8 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic public T exchangeResource(HttpHeaders headers, String url, Object request, Class responseType, String method) throws ConfigRestAdaptorException { - ResponseEntity response = exchangeForEntity(headers, url, HttpMethod.valueOf(method), request, responseType); - return processResponse(response, url, HttpMethod.valueOf(method)); + ResponseEntity response = exchangeForEntity(headers, url, HttpMethod.valueOf(method), request, responseType); + return processResponse(response, url, HttpMethod.valueOf(method)); } public RestResponse getResource(HttpHeaders headers, String url) throws ConfigRestAdaptorException { @@ -162,7 +162,7 @@ abstract class AbstractConfigRestClientAdapter implements ConfigRestClientServic public RestResponse exchangeResource(HttpHeaders headers, String url, Object request, String method) throws ConfigRestAdaptorException { - return exchangeForEntity(headers, url, HttpMethod.valueOf(method), request); + return exchangeForEntity(headers, url, HttpMethod.valueOf(method), request); } private RestResponse exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request) diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java index c05d6979a..158123a65 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/ConfigRestAdaptorServiceImpl.java @@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils; import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants; import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException; import org.onap.ccsdk.features.rest.adaptor.data.RestResponse; - import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java index 44736deb1..f7ec439d5 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/service/SSLRestClientAdapterImpl.java @@ -19,7 +19,6 @@ package org.onap.ccsdk.features.rest.adaptor.service; import java.util.Map; import java.util.UUID; - import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants; import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException; import org.onap.ccsdk.features.rest.adaptor.data.RestResponse; diff --git a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java index 53b4ddf96..c3e2288d1 100644 --- a/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java +++ b/blueprints-processor/adaptors/rest-adaptor-provider/src/main/java/org/onap/ccsdk/features/rest/adaptor/utils/BasicAuthorizationInterceptor.java @@ -1,13 +1,13 @@ /* * 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. @@ -19,7 +19,7 @@ package org.onap.ccsdk.features.rest.adaptor.utils; import java.io.IOException; import java.nio.charset.Charset; -import java.util.Base64; +import java.util.Base64; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpRequestExecution; import org.springframework.http.client.ClientHttpRequestInterceptor; @@ -49,7 +49,7 @@ public class BasicAuthorizationInterceptor implements ClientHttpRequestIntercept public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { - String token = Base64.getEncoder().encodeToString((this.username + ":" + this.pass).getBytes(UTF_8)); + String token = Base64.getEncoder().encodeToString((this.username + ":" + this.pass).getBytes(UTF_8)); request.getHeaders().add("Authorization", "Basic " + token); return execution.execute(request, body); } -- cgit 1.2.3-korg