<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- Copyright © 2017-2018 AT&T Intellectual Property.\r
- Modifications Copyright © 2018 IBM.\r
- \r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
- \r
- http://www.apache.org/licenses/LICENSE-2.0\r
- \r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
+<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright \r
+ © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License"); \r
+ you may not use this file except in compliance with the License. You may \r
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+ Unless required by applicable law or agreed to in writing, software distributed \r
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+ OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+ the specific language governing permissions and limitations under the License. -->\r
\r
<project xmlns="http://maven.apache.org/POM/4.0.0"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
- <modelVersion>4.0.0</modelVersion>\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
\r
- <parent>\r
- <groupId>org.onap.ccsdk.parent</groupId>\r
- <artifactId>binding-parent</artifactId>\r
- <version>1.1.0-SNAPSHOT</version>\r
- <relativePath/>\r
- </parent>\r
+ <parent>\r
+ <groupId>org.onap.ccsdk.parent</groupId>\r
+ <artifactId>binding-parent</artifactId>\r
+ <version>1.1.0-SNAPSHOT</version>\r
+ <relativePath />\r
+ </parent>\r
\r
- <groupId>org.onap.ccsdk.features</groupId>\r
- <version>0.3.0-SNAPSHOT</version>\r
- <artifactId>blueprints-data-adaptor-provider</artifactId>\r
- <packaging>bundle</packaging>\r
- <name>Blueprints Data Adaptor - Provider</name>\r
- <url>http://maven.apache.org</url>\r
+ <groupId>org.onap.ccsdk.features</groupId>\r
+ <version>0.3.0-SNAPSHOT</version>\r
+ <artifactId>blueprints-data-adaptor-provider</artifactId>\r
+ <packaging>bundle</packaging>\r
+ <name>Blueprints Data Adaptor - Provider</name>\r
+ <url>http://maven.apache.org</url>\r
\r
- <dependencies>\r
- <dependency>\r
- <groupId>org.apache.commons</groupId>\r
- <artifactId>commons-lang3</artifactId>\r
- <version>${commons.lang3.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.onap.ccsdk.sli.core</groupId>\r
- <artifactId>sli-provider</artifactId>\r
- <version>${project.version}</version>\r
- <scope>compile</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-io</groupId>\r
- <artifactId>commons-io</artifactId>\r
- <version>2.5</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.mariadb.jdbc</groupId>\r
- <artifactId>mariadb-java-client</artifactId>\r
- <version>${mariadb.connector.version}</version>\r
- <scope>runtime</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.springframework</groupId>\r
- <artifactId>spring-context</artifactId>\r
- <version>${spring.version}</version>
- </dependency>\r
- <dependency>\r
- <groupId>org.springframework</groupId>\r
- <artifactId>spring-jdbc</artifactId>\r
- <version>${spring.version}</version>
- </dependency>\r
- <dependency>\r
- <groupId>com.att.eelf</groupId>\r
- <artifactId>eelf-core</artifactId>\r
- <version>${eelf.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.springframework</groupId>\r
- <artifactId>spring-test</artifactId>\r
- <version>${spring.version}</version>
- <scope>test</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.h2database</groupId>\r
- <artifactId>h2</artifactId>\r
- <version>${h2database.version}</version>\r
- <scope>test</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>junit</groupId>\r
- <artifactId>junit</artifactId>\r
- <version>${junit.version}</version>\r
- <scope>test</scope>\r
- </dependency>\r
- </dependencies>\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.apache.commons</groupId>\r
+ <artifactId>commons-lang3</artifactId>\r
+ <version>${commons.lang3.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.onap.ccsdk.sli.core</groupId>\r
+ <artifactId>sli-provider</artifactId>\r
+ <version>${project.version}</version>\r
+ <scope>compile</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-io</groupId>\r
+ <artifactId>commons-io</artifactId>\r
+ <version>2.5</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.mariadb.jdbc</groupId>\r
+ <artifactId>mariadb-java-client</artifactId>\r
+ <version>${mariadb.connector.version}</version>\r
+ <scope>runtime</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-context</artifactId>\r
+ <version>${spring.version}</version>
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-jdbc</artifactId>\r
+ <version>${spring.version}</version>
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.att.eelf</groupId>\r
+ <artifactId>eelf-core</artifactId>\r
+ <version>${eelf.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.springframework</groupId>\r
+ <artifactId>spring-test</artifactId>\r
+ <version>${spring.version}</version>
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.h2database</groupId>\r
+ <artifactId>h2</artifactId>\r
+ <version>${h2database.version}</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>${junit.version}</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ </dependencies>\r
\r
- <build>\r
- <plugins>\r
- <plugin>\r
- <groupId>org.apache.maven.plugins</groupId>\r
- <artifactId>maven-javadoc-plugin</artifactId>\r
- <configuration>\r
- <additionalparam>-Xdoclint:none</additionalparam>\r
- </configuration>\r
- </plugin>\r
- <plugin>\r
- <groupId>org.apache.felix</groupId>\r
- <artifactId>maven-bundle-plugin</artifactId>\r
- <version>${maven.bundle.version}</version>\r
- <extensions>true</extensions>\r
- <configuration>\r
- <instructions>\r
- <Bundle-Name>${project.artifactId}</Bundle-Name>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>org.onap.ccsdk.features.data.adaptor,\r
- org.onap.ccsdk.features.data.adaptor.dao,\r
- org.onap.ccsdk.features.data.adaptor.db,\r
- org.onap.ccsdk.features.data.adaptor.domain,\r
- org.onap.ccsdk.features.data.adaptor.service\r
- </Export-Package>\r
- </instructions>\r
- </configuration>\r
- </plugin>\r
- </plugins>\r
- </build>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-javadoc-plugin</artifactId>\r
+ <configuration>\r
+ <additionalparam>-Xdoclint:none</additionalparam>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.felix</groupId>\r
+ <artifactId>maven-bundle-plugin</artifactId>\r
+ <version>${maven.bundle.version}</version>\r
+ <extensions>true</extensions>\r
+ <configuration>\r
+ <instructions>\r
+ <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\r
+ </Export-Package>\r
+ </instructions>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
</project>\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.features.data.adaptor.dao;\r
-\r
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
-\r
-public interface ConfigPropertyMapDao {\r
-\r
- /**\r
- * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key.\r
- *\r
- * @param key key mapped to a value\r
- * @return the result string, containing mapped string value\r
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails\r
- */\r
- public String getConfigPropertyByKey(String key) throws SvcLogicException;\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.features.data.adaptor.dao;\r
-\r
-import java.util.Map;\r
-import java.util.concurrent.ConcurrentHashMap;\r
-import java.util.concurrent.Executors;\r
-import java.util.concurrent.ScheduledExecutorService;\r
-import java.util.concurrent.TimeUnit;\r
-import org.apache.commons.lang3.StringUtils;\r
-import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;\r
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
-import org.springframework.jdbc.CannotGetJdbcConnectionException;\r
-import org.springframework.jdbc.core.JdbcTemplate;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import com.google.common.base.Preconditions;\r
-\r
-public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao {\r
-\r
- private static EELFLogger logger = EELFManager.getInstance().getLogger(ConfigPropertyMapDaoImpl.class);\r
-\r
- private JdbcTemplate jdbcTemplate;\r
- private Map<String, String> configPropertyMap = new ConcurrentHashMap<>();\r
-\r
- public ConfigPropertyMapDaoImpl(JdbcTemplate jdbcTemplate) {\r
- this.jdbcTemplate = jdbcTemplate;\r
- initializeMap();\r
-\r
- String envType = configPropertyMap.get(DataAdaptorConstants.PROPERTY_ENV_TYPE);\r
- if (!(DataAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType)\r
- || DataAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) {\r
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);\r
- Runnable task = this::initializeMap;\r
- executor.scheduleWithFixedDelay(task, 60, 15, TimeUnit.MINUTES);\r
- }\r
- }\r
-\r
- private void initializeMap() {\r
- try {\r
- String getPropQuery = "SELECT * FROM CONFIG_PROPERTY_MAP";\r
- jdbcTemplate.queryForList(getPropQuery).forEach(rows -> {\r
- String key = StringUtils.trimToEmpty((String) rows.get("reference_key"));\r
- String value = StringUtils.trimToEmpty((String) rows.get("reference_value"));\r
- configPropertyMap.put(key, value);\r
- });\r
- logger.trace("loaded configPropertyMap : ({})", configPropertyMap);\r
- } catch (Exception e) {\r
- logger.error(e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public String getConfigPropertyByKey(String key) throws SvcLogicException {\r
- Preconditions.checkArgument(StringUtils.isNotBlank(key), "missing property key");\r
- return configPropertyMap.get(key);\r
- }\r
-\r
-}\r
package org.onap.ccsdk.features.data.adaptor.dao;\r
\r
import java.util.List;\r
-\r
import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
\r
package org.onap.ccsdk.features.data.adaptor.dao;\r
\r
import java.util.List;\r
-\r
import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.features.data.adaptor.domain;\r
-\r
-import java.io.Serializable;\r
-\r
-public class ConfigPropertyMapData implements Serializable {\r
- private static final long serialVersionUID = 1L;\r
-\r
- private String referenceKey;\r
- private String referenceValue;\r
-\r
- public String getReferenceKey() {\r
- return referenceKey;\r
- }\r
-\r
- public void setReferenceKey(String referenceKey) {\r
- this.referenceKey = referenceKey;\r
- }\r
-\r
- public String getReferenceValue() {\r
- return referenceValue;\r
- }\r
-\r
- public void setReferenceValue(String referenceValue) {\r
- this.referenceValue = referenceValue;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "ConfigPropertyMapData [referenceKey=" + referenceKey + ", referenceValue=" + referenceValue + "]";\r
- }\r
-\r
-}\r
\r
import java.util.List;\r
import java.util.Map;\r
-\r
import org.onap.ccsdk.features.data.adaptor.domain.ConfigResource;\r
import org.onap.ccsdk.features.data.adaptor.domain.TransactionLog;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
*/\r
public ConfigResource saveConfigResource(ConfigResource configResource) throws SvcLogicException;\r
\r
- /**\r
- * Query ConcurrentHashMap having CONFIG_PROPERTY_MAP table data for given key.\r
- *\r
- * @param key key mapped to a value\r
- * @return the result string, containing mapped string value\r
- * @throws org.onap.ccsdk.sli.core.sli.SvcLogicException if fails\r
- */\r
- public String getConfigPropertyByKey(String key) throws SvcLogicException;\r
-\r
/**\r
* Query CONFIG_TRANSACTION_LOG table for given request_id, mapping each row to a Java object via a\r
* TransactionLog RowMapper.\r
\r
import java.util.List;\r
import java.util.Map;\r
-\r
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;\r
private ConfigResourceDao configResourceDao;\r
private QueryExecutorDao queryExecutorDao;\r
private NamedQueryExecutorDao namedQueryExecutorDao;\r
- private ConfigPropertyMapDao configPropertyMapDao;\r
\r
@SuppressWarnings("squid:S00107")\r
public ConfigResourceServiceImpl(TransactionLogDao transactionLogDao, ConfigResourceDao configResourceDao,\r
- QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao,\r
- ConfigPropertyMapDao configPropertyMapDao) {\r
+ QueryExecutorDao queryExecutorDao, NamedQueryExecutorDao namedQueryExecutorDao) {\r
\r
logger.info("{} Constuctor Initated...", CLASS_NAME);\r
this.transactionLogDao = transactionLogDao;\r
this.configResourceDao = configResourceDao;\r
this.queryExecutorDao = queryExecutorDao;\r
this.namedQueryExecutorDao = namedQueryExecutorDao;\r
- this.configPropertyMapDao = configPropertyMapDao;\r
}\r
\r
@Override\r
return configResourceDao.save(configResource);\r
}\r
\r
- @Override\r
- public String getConfigPropertyByKey(String key) throws SvcLogicException {\r
- return configPropertyMapDao.getConfigPropertyByKey(key);\r
- }\r
-\r
}\r
<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- Copyright © 2017-2018 AT&T Intellectual Property.\r
- Modifications Copyright © 2018 IBM.\r
- \r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
- \r
- http://www.apache.org/licenses/LICENSE-2.0\r
- \r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
+<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright \r
+ © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License"); \r
+ you may not use this file except in compliance with the License. You may \r
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+ Unless required by applicable law or agreed to in writing, software distributed \r
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+ OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+ the specific language governing permissions and limitations under the License. -->\r
\r
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"\r
xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"\r
<argument ref="namedParameterJdbcTemplate" />\r
</bean>\r
\r
- <bean id="configPropertyMapDao"\r
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDaoImpl">\r
- <argument ref="jdbcTemplate" />\r
- </bean>\r
-\r
<!-- Expose the Common Component Bean -->\r
\r
<bean id="configResourceService"\r
- class="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceServiceImpl">\r
+ class="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceServiceImpl">\r
<argument ref="transactionLogDao" />\r
<argument ref="configResourceDao" />\r
<argument ref="queryExecutorDao" />\r
<argument ref="namedQueryExecutorDao" />\r
- <argument ref="configPropertyMapDao" />\r
</bean>\r
\r
<service ref="configResourceService"\r
- interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />\r
+ interface="org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService" />\r
\r
</blueprint>\r
DROP TABLE sdnctl.CONFIG_RESOURCE;\r
DROP TABLE sdnctl.CONFIG_RESOURCE_RELATION;\r
DROP TABLE sdnctl.CONFIG_TRANSACTION_LOG\r
-DROP TABLE sdnctl.CONFIG_PROPERTY_MAP\r
\r
\r
-- -----------------------------------------------------\r
ON UPDATE NO ACTION\r
) ENGINE=InnoDB DEFAULT CHARSET=latin1;\r
\r
-\r
--- -----------------------------------------------------\r
--- table sdnctl.CONFIG_PROPERTY_MAP\r
--- -----------------------------------------------------\r
-CREATE TABLE IF NOT EXISTS sdnctl.CONFIG_PROPERTY_MAP (\r
- reference_key VARCHAR(100) NOT NULL,\r
- reference_value VARCHAR(250) NOT NULL,\r
- CONSTRAINT PK_CONFIG_PROPERTY_MAP PRIMARY KEY (reference_key)\r
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.features.data.adaptor.dao;\r
-\r
-import org.junit.Assert;\r
-import org.junit.FixMethodOrder;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.junit.runners.MethodSorters;\r
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDao;\r
-import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.test.context.ContextConfiguration;\r
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;\r
-\r
-@RunWith(SpringJUnit4ClassRunner.class)\r
-@ContextConfiguration(locations = {"classpath:test-context-h2db.xml"})\r
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
-public class ConfigPropertyMapDaoTest {\r
-\r
- @Autowired\r
- private ConfigPropertyMapDao configPropertyMapDao;\r
-\r
- @Autowired\r
- private QueryExecutorDao queryExecutorDao;\r
-\r
- @Test\r
- public void testConfigResourcesData() throws Exception {\r
- String sql = "INSERT INTO CONFIG_PROPERTY_MAP (reference_key, reference_value) VALUES ( ?, ?)";\r
- Object[] data = new Object[] {"dummy123", "username123"};\r
- int result = queryExecutorDao.update(sql, data);\r
- Assert.assertNotNull("Failed to get Query Result", result);\r
-\r
- String propKeyValye = configPropertyMapDao.getConfigPropertyByKey("org.onap.ccsdk.features.rest.adaptors.test");\r
- Assert.assertNull("propKeyValue is null", propKeyValye);\r
- }\r
-\r
-}\r
import org.junit.Test;\r
import org.junit.runner.RunWith;\r
import org.onap.ccsdk.features.data.adaptor.DataAdaptorConstants;\r
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDao;\r
@Autowired\r
NamedQueryExecutorDao namedQueryExecutorDao;\r
\r
- @Autowired\r
- ConfigPropertyMapDao configPropertyMapDao;\r
-\r
@Before\r
public void before() {\r
configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,\r
- namedQueryExecutorDao, configPropertyMapDao);\r
+ namedQueryExecutorDao);\r
configResourceNode = new ConfigResourceNode(configResourceService);\r
}\r
\r
import org.junit.Before;\r
import org.junit.Test;\r
import org.junit.runner.RunWith;\r
-import org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDao;\r
import org.onap.ccsdk.features.data.adaptor.dao.ConfigResourceDaoTest;\r
import org.onap.ccsdk.features.data.adaptor.dao.NamedQueryExecutorDao;\r
@Autowired\r
NamedQueryExecutorDao namedQueryExecutorDao;\r
\r
- @Autowired\r
- ConfigPropertyMapDao configPropertyMapDao;\r
-\r
@Before\r
public void before() {\r
configResourceService = new ConfigResourceServiceImpl(transactionLogDao, configResourceDao, queryExecutorDao,\r
- namedQueryExecutorDao, configPropertyMapDao);\r
+ namedQueryExecutorDao);\r
}\r
\r
@Test\r
-
-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
-);
-
+\r
+CREATE TABLE IF NOT EXISTS CONFIG_RESOURCE (\r
+ config_resource_id VARCHAR(50) PRIMARY KEY,\r
+ resource_id VARCHAR(50) NOT NULL,\r
+ resource_type VARCHAR(50) NOT NULL,\r
+ service_template_name VARCHAR(50) NULL DEFAULT NULL,\r
+ service_template_version VARCHAR(50) NULL DEFAULT NULL,\r
+ template_name VARCHAR(50) NOT NULL,\r
+ recipe_name VARCHAR(50) NOT NULL,\r
+ request_id VARCHAR(50) NOT NULL,\r
+ resource_data LONGTEXT NULL DEFAULT NULL,\r
+ mask_data LONGTEXT NULL DEFAULT NULL,\r
+ created_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\r
+ status VARCHAR(20) NOT NULL,\r
+ updated_by VARCHAR(50) NOT NULL\r
+);\r
+\r
+CREATE TABLE IF NOT EXISTS CONFIG_RESOURCE_ASSIGNMENT_DATA (\r
+ config_resource_assignment_data_id VARCHAR(50) PRIMARY KEY,\r
+ config_resource_id VARCHAR(50) NOT NULL,\r
+ version INT(11) NOT NULL,\r
+ updated_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\r
+ updated_by VARCHAR(50) NOT NULL,\r
+ template_key_name VARCHAR(50) NOT NULL,\r
+ resource_name VARCHAR(50) NOT NULL,\r
+ data_type VARCHAR(100) NOT NULL,\r
+ entry_schema VARCHAR(100) NULL DEFAULT NULL,\r
+ resource_value LONGTEXT NOT NULL,\r
+ source VARCHAR(50) NOT NULL,\r
+ status VARCHAR(50) NOT NULL,\r
+ message LONGTEXT NOT NULL\r
+);\r
+\r
+CREATE TABLE IF NOT EXISTS CONFIG_TRANSACTION_LOG (\r
+ config_transaction_log_id VARCHAR(50) PRIMARY KEY,\r
+ request_id VARCHAR(50) NULL DEFAULT NULL,\r
+ message_type VARCHAR(100) NULL DEFAULT NULL,\r
+ creation_date DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,\r
+ message LONGTEXT NULL DEFAULT NULL\r
+);\r
+\r
+\r
<?xml version="1.0" encoding="utf-8"?>\r
-<!--\r
- Copyright © 2017-2018 AT&T Intellectual Property.\r
- Modifications Copyright © 2018 IBM.\r
- \r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
- \r
- http://www.apache.org/licenses/LICENSE-2.0\r
- \r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
+<!-- Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright \r
+ © 2018 IBM. Licensed under the Apache License, Version 2.0 (the "License"); \r
+ you may not use this file except in compliance with the License. You may \r
+ obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 \r
+ Unless required by applicable law or agreed to in writing, software distributed \r
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES \r
+ OR CONDITIONS OF ANY KIND, either express or implied. See the License for \r
+ the specific language governing permissions and limitations under the License. -->\r
\r
<beans xmlns="http://www.springframework.org/schema/beans"\r
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
<constructor-arg ref="jdbcTemplate" />\r
</bean>\r
\r
- <bean id="configPropertyMapDao"\r
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDaoImpl">\r
- <constructor-arg ref="jdbcTemplate" />\r
- </bean>\r
-\r
<bean id="queryExecutorDao"\r
class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">\r
<constructor-arg ref="jdbcTemplate" />\r
<constructor-arg ref="jdbcTemplate" />\r
</bean>\r
\r
- <bean id="ConfigPropertyMapDao"\r
- class="org.onap.ccsdk.features.data.adaptor.dao.ConfigPropertyMapDaoImpl">\r
- <constructor-arg ref="jdbcTemplate" />\r
- </bean>\r
-\r
<bean id="queryExecutorDao"\r
class="org.onap.ccsdk.features.data.adaptor.dao.QueryExecutorDaoImpl">\r
<constructor-arg ref="jdbcTemplate" />\r
\r
public <T> T exchangeResource(HttpHeaders headers, String url, Object request, Class<T> responseType, String method)\r
throws ConfigRestAdaptorException {\r
- ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.valueOf(method), request, responseType);
- return processResponse(response, url, HttpMethod.valueOf(method));
+ ResponseEntity<T> response = exchangeForEntity(headers, url, HttpMethod.valueOf(method), request, responseType);\r
+ return processResponse(response, url, HttpMethod.valueOf(method));\r
}\r
\r
public RestResponse getResource(HttpHeaders headers, String url) throws ConfigRestAdaptorException {\r
\r
public RestResponse exchangeResource(HttpHeaders headers, String url, Object request, String method)\r
throws ConfigRestAdaptorException {\r
- return exchangeForEntity(headers, url, HttpMethod.valueOf(method), request);
+ return exchangeForEntity(headers, url, HttpMethod.valueOf(method), request);\r
}\r
\r
private RestResponse exchangeForEntity(HttpHeaders headers, String url, HttpMethod httpMethod, Object request)\r
import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;\r
import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;\r
import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
\r
import java.util.Map;\r
import java.util.UUID;\r
-\r
import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorConstants;\r
import org.onap.ccsdk.features.rest.adaptor.ConfigRestAdaptorException;\r
import org.onap.ccsdk.features.rest.adaptor.data.RestResponse;\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- *
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- *
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- *
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
import java.io.IOException;\r
import java.nio.charset.Charset;\r
-import java.util.Base64;
+import java.util.Base64;\r
import org.springframework.http.HttpRequest;\r
import org.springframework.http.client.ClientHttpRequestExecution;\r
import org.springframework.http.client.ClientHttpRequestInterceptor;\r
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)\r
throws IOException {\r
\r
- String token = Base64.getEncoder().encodeToString((this.username + ":" + this.pass).getBytes(UTF_8));
+ String token = Base64.getEncoder().encodeToString((this.username + ":" + this.pass).getBytes(UTF_8));\r
request.getHeaders().add("Authorization", "Basic " + token);\r
return execution.execute(request, body);\r
}\r
import java.util.HashMap;\r
import java.util.List;\r
import java.util.Map;\r
-\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;\r
\r
this.configResourceService = configResourceService;\r
}\r
\r
- public void saveResourceMapping(org.onap.ccsdk.features.assignment.data.ResourceAssignmentData resourceAssignmentData,\r
- String templateName, List<ResourceAssignment> resourceAssignments) throws SvcLogicException {\r
+ public void saveResourceMapping(\r
+ org.onap.ccsdk.features.assignment.data.ResourceAssignmentData resourceAssignmentData, String templateName,\r
+ List<ResourceAssignment> resourceAssignments) throws SvcLogicException {\r
try {\r
\r
if (resourceAssignmentData == null) {\r
package org.onap.ccsdk.features.assignment.service;\r
\r
import java.util.List;\r
-\r
import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
package org.onap.ccsdk.features.assignment.service;\r
\r
import java.util.List;\r
-\r
import org.onap.ccsdk.features.assignment.data.ResourceAssignmentData;\r
import org.onap.ccsdk.features.data.adaptor.service.ConfigResourceService;\r
import org.onap.ccsdk.features.generator.service.ConfigGeneratorService;\r
import org.onap.ccsdk.features.model.service.ConfigModelService;\r
import org.onap.ccsdk.features.model.service.ConfigModelServiceImpl;\r
import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.domain.ConfigModel;\r
import org.onap.ccsdk.features.model.domain.ConfigModelContent;\r
import org.onap.ccsdk.features.rest.adaptor.service.ConfigRestAdaptorService;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
import com.fasterxml.jackson.core.type.TypeReference;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;\r
import org.onap.ccsdk.features.model.utils.TransformationUtils;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
import com.fasterxml.jackson.databind.JsonNode;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.utils.TransformationUtils;\r
import org.onap.ccsdk.features.model.validator.ResourceAssignmentValidator;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
public static final String EXPRESSION_GET_ATTRIBUTE = "get_attribute";\r
public static final String EXPRESSION_SET_VALUE = "set_value";\r
\r
- public static final String CONFIG_PROPERTY_MAP_KEY_PREFIX = "org.onap.ccsdk.sli.adaptors.";\r
-\r
}\r
package org.onap.ccsdk.features.model.data.dict;\r
\r
import java.util.Map;\r
-\r
import org.onap.ccsdk.features.model.data.PropertyDefinition;\r
-\r
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
\r
\r
import java.util.List;\r
import java.util.Map;\r
-\r
import org.onap.ccsdk.features.model.data.ServiceTemplate;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r
package org.onap.ccsdk.features.model.utils;\r
\r
import org.onap.ccsdk.features.model.ValidTypes;\r
-\r
import com.fasterxml.jackson.databind.JsonNode;\r
import com.fasterxml.jackson.databind.node.ArrayNode;\r
import com.fasterxml.jackson.databind.node.NullNode;\r
import java.util.Map;\r
import org.apache.commons.lang3.StringUtils;\r
import org.onap.ccsdk.features.model.ConfigModelConstant;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.ValidTypes;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
import com.fasterxml.jackson.databind.JsonNode;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;\r
import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.data.PropertyDefinition;\r
import org.onap.ccsdk.features.model.data.RequirementDefinition;\r
import org.onap.ccsdk.features.model.data.ServiceTemplate;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.utils.TopologicalSortingUtils;\r
import org.onap.ccsdk.features.model.utils.TransformationUtils;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.ConfigModelException;\r
import org.onap.ccsdk.features.model.data.ServiceTemplate;\r
import org.onap.ccsdk.features.model.utils.TransformationUtils;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.data.RequirementAssignment;\r
import org.onap.ccsdk.features.model.data.ServiceTemplate;\r
import org.onap.ccsdk.features.model.data.TopologyTemplate;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.onap.ccsdk.features.model.data.dict.SourcesDefinition;\r
import org.onap.ccsdk.features.model.data.dict.SourcesProperties;\r
import org.onap.ccsdk.features.model.utils.ResourceDictionaryUtils;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
import org.junit.Assert;\r
import org.junit.Test;\r
import org.onap.ccsdk.features.model.utils.JsonParserUtils;\r
-\r
import com.fasterxml.jackson.databind.JsonNode;\r
\r
public class JsonParserUtilsTest {\r
import org.junit.Test;\r
import org.onap.ccsdk.features.model.ValidTypes;\r
import org.onap.ccsdk.features.model.utils.JsonUtils;\r
-\r
import com.fasterxml.jackson.databind.node.ArrayNode;\r
import com.fasterxml.jackson.databind.node.JsonNodeFactory;\r
import com.fasterxml.jackson.databind.node.ObjectNode;\r
import org.onap.ccsdk.features.model.data.ResourceAssignment;\r
import org.onap.ccsdk.features.model.data.dict.ResourceDefinition;\r
import org.onap.ccsdk.features.model.utils.ResourceAssignmentUtils;\r
-\r
import com.fasterxml.jackson.core.type.TypeReference;\r
import com.fasterxml.jackson.databind.JsonNode;\r
import com.fasterxml.jackson.databind.ObjectMapper;\r
import java.util.Map;\r
import org.junit.Test;\r
import org.onap.ccsdk.features.model.utils.TransformationUtils;\r
-\r
import com.fasterxml.jackson.databind.JsonNode;\r
\r
public class TransformationUtilsTest {\r
import org.apache.commons.io.IOUtils;\r
import org.junit.Test;\r
import org.onap.ccsdk.features.model.validator.ServiceTemplateValidator;\r
-\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
\r
package org.onap.ccsdk.features.params.service;\r
\r
import java.util.Map;\r
-\r
import org.onap.ccsdk.features.model.service.ComponentNode;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;\r
import org.onap.ccsdk.sli.core.sli.SvcLogicException;\r