aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-database/src/main/java
diff options
context:
space:
mode:
authorRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>2018-09-19 17:59:48 -0400
committerRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>2018-09-19 17:59:48 -0400
commite1ce86324a34a84436c229c214661f5a9a7f3928 (patch)
treea36d3c84b5dd06e4582f249355256116aae561c5 /cmso-database/src/main/java
parentfbe4bb98345727d190cefcfb3ec54ad9075fba9d (diff)
Change Management Schedule Optimization
Adding Database Project for Change Management Schedule Optimization Change-Id: I03370ea4d80ed0444f986b8c7e9e32dbad206106 Issue-ID: OPTFRA-351 Signed-off-by: RamaPrasad Amaranarayana (ra5425) <ra5425@att.com>
Diffstat (limited to 'cmso-database/src/main/java')
-rw-r--r--cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java47
-rw-r--r--cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java77
2 files changed, 124 insertions, 0 deletions
diff --git a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java
new file mode 100644
index 0000000..e3a581d
--- /dev/null
+++ b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseApplication.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.optf.cmso.liquibase;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.context.annotation.ComponentScan;
+
+@SpringBootApplication
+@ComponentScan(basePackages = "org.onap.optf.cmso.liquibase")
+public class LiquibaseApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(LiquibaseApplication.class, args);
+ }
+}
diff --git a/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java
new file mode 100644
index 0000000..842c70c
--- /dev/null
+++ b/cmso-database/src/main/java/org/onap/optf/cmso/liquibase/LiquibaseData.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.optf.cmso.liquibase;
+
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.stereotype.Component;
+import liquibase.integration.spring.SpringLiquibase;
+
+/*
+ * Make sure following exceptions before build:
+ * Build errors
+ * java.net.ConnectException: Connection refused: connect (DB Connection)
+ * Make sure SQL files syntax are correct
+ * Always place new SQL files in src\main\resources\dbchangelog folder
+ * Please dont delete previous scripts
+ * Make sure to follow naming convention for SQL file (1806-cmso-v2-schema.sql)
+ * Please make sure to give author name and id for new SQL scripts (eg: changeSet author="bg4702"
+ * id="unique id")
+ ** IMPORTANT: Always do testing in local before pushing changes to Env's**
+ */
+
+@Component
+@Configuration
+public class LiquibaseData {
+
+ @Value("${changeLogFile}")
+ private String changeLogFile;
+
+ @Bean
+ public SpringLiquibase liquibase() {
+ SpringLiquibase liquibase = new SpringLiquibase();
+ liquibase.setDataSource(dataSource());
+ liquibase.setChangeLog("classpath:" + changeLogFile);
+ return liquibase;
+ }
+
+ @Bean
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+}