2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup;
24 import static org.junit.Assert.assertTrue;
25 import static org.junit.Assert.fail;
26 import java.sql.SQLException;
27 import java.util.concurrent.TimeUnit;
28 import org.junit.AfterClass;
29 import org.junit.BeforeClass;
30 import org.junit.Test;
31 import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient;
32 import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.SqlDBDataProvider;
33 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.SdnrDbType;
34 import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release;
35 import ch.vorburger.exec.ManagedProcessException;
37 public class TestMariaDBIstanbul {
39 private static final String MARIADB_USERNAME = "sdnrdb";
40 private static final String MARIADB_PASSWORD = "sdnrdb";
41 // private static final String MARIADB_HOST = "10.20.11.159";
42 private static final String MARIADB_HOST = "sdnrdb";
43 private static final int MARIADB_PORT = 3306;
44 private static final String MARIADB_DATABASENAME = "sdnrdb";
46 private static SqlDBClient dbService;
48 private static MariaDBTestBase testBase;
49 private static SqlDBDataProvider dbProvider;
52 public static void init() throws Exception {
54 //testBase = new MariaDBTestBase(MARIADB_HOST,MARIADB_PORT, MARIADB_DATABASENAME);
55 testBase = new MariaDBTestBase();
56 dbProvider = testBase.getDbProvider();
57 dbProvider.waitForDatabaseReady(30, TimeUnit.SECONDS);
58 // dbProvider.setControllerId();
63 public static void close() {
66 } catch (ManagedProcessException e) {
72 public void testCreate() {
73 DataMigrationProviderImpl provider = null;
75 provider = new DataMigrationProviderImpl(SdnrDbType.MARIADB, testBase.getDBUrl(), testBase.getDBUsername(),
76 testBase.getDBPassword(), true, 30000);
77 } catch (Exception e) {
81 boolean success = provider.initDatabase(Release.ISTANBUL_R1, 1, 1, "", false, 1000);
82 assertTrue("init database failed",success);
84 dbProvider.setControllerId();
85 } catch (SQLException e) {