diff options
Diffstat (limited to 'sdnr/wt/data-provider/setup/src/test/java')
6 files changed, 483 insertions, 0 deletions
diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java new file mode 100644 index 000000000..c17ef8b2d --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestData.java @@ -0,0 +1,171 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.common.test.JSONAssert; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentData; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ConfigData; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ConfigName; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataContainer; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataMigrationReport; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.MavenDatabasePluginInitFile; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release; + +/** + * @author Michael Dürre + * + */ +public class TestData { + private static final JSONObject EVENTLOG_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n" + + "\"_type\": \"eventlog\",\n" + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n" + "\"_version\": 1,\n" + + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"event\": {\n" + + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n" + "\"counter\": \"1\",\n" + + "\"timeStamp\": \"2020-02-25T08:22:19.8Z\",\n" + "\"objectId\": \"sim2230\",\n" + + "\"attributeName\": \"ConnectionStatus\",\n" + "\"newValue\": \"connecting\",\n" + + "\"type\": \"AttributeValueChangedNotificationXml\"\n" + "}\n" + "}\n" + "}"); + private static final JSONObject EVENTLOG_SEARCHHIT2= new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n" + + "\"_type\": \"eventlog\",\n" + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n" + "\"_version\": 1,\n" + + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"event\": {\n" + + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n" + "\"counter\": \"3\",\n" + + "\"timeStamp\": \"2020-02-22T08:22:19.8Z\",\n" + "\"objectId\": \"sim2230\",\n" + + "\"attributeName\": \"ConnectionStatus\",\n" + "\"newValue\": \"connected\",\n" + + "\"type\": \"AttributeValueChangedNotificationXml\"\n" + "}\n" + "}\n" + "}"); + private static final String CONFIG_CONTENT = "[dcae]\n" + + "dcaeUserCredentials=admin:admin\n" + + "dcaeUrl=off\n" + + "dcaeHeartbeatPeriodSeconds=120\n" + + "dcaeTestCollector=no\n" + + "\n" + + "[es]\n" + + "esCluster=sendateodl5\n" + + "#time limit to keep increasing data in database [in seconds]\n" + + "#60*60*24*30 (30days)\n" + + "esArchiveLimit=2592000\n" + + "#folder where removed data will be stored\n" + + "esArchiveFolder=./backup\n" + + "#interval to archive database [in seconds]\n" + + "#60*60*24 (1day)\n" + + "esArchiveInterval=86400\n" + + "\n" + + "[aai]\n" + + "#keep comment\n" + + "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + + "aaiUrl=http://localhost:81\n" + + "aaiUserCredentials=AAI:AAI\n" + + "aaiDeleteOnMountpointRemove=false\n" + + "aaiTrustAllCerts=false\n" + + "aaiApiVersion=aai/v13\n" + + "aaiPropertiesFile=aaiclient.properties\n" + + "aaiApplicationId=SDNR\n" + + "aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12\n" + + "aaiPcks12ClientCertPassphrase=adminadmin\n" + + "aaiClientConnectionTimeout=30000\n" + + "\n" + + "[pm]\n" + + "pmCluster=sendateodl5\n" + + "pmEnabled=true\n" + + ""; + @Test + public void testComponentData() { + JSONArray hits = new JSONArray(); + hits.put(EVENTLOG_SEARCHHIT); + hits.put(EVENTLOG_SEARCHHIT2); + ComponentData data = new ComponentData(ComponentName.EVENTLOG,hits); + JSONArray out = data.toJsonArray(); + assertEquals(ComponentName.EVENTLOG, data.getName()); + JSONAssert.assertEquals(EVENTLOG_SEARCHHIT.toString(),out.getJSONObject(0).toString(),false); + JSONAssert.assertEquals(EVENTLOG_SEARCHHIT2.toString(),out.getJSONObject(1).toString(),false); + + } + @Test + public void testConfigData() { + ConfigData data = new ConfigData(CONFIG_CONTENT); + assertTrue(data.getLines().length>10); + } + @Test + public void testConfigName() { + ConfigName name = ConfigName.APIGATEWAY; + assertEquals("apigateway", name.getValue()); + try { + assertEquals(ConfigName.APIGATEWAY,ConfigName.getValueOf("apigateway")); + } catch (Exception e) { + fail(e.getMessage()); + } + + } + @Test + public void testDataContainer() { + DataContainer container = new DataContainer(); + assertEquals(Release.CURRENT_RELEASE,container.getRelease()); + assertNotNull(container.getCreated()); + + try { + container = DataContainer.load(new File("src/test/resources/test.bak.json")); + } catch (Exception e) { + fail(e.getMessage()); + } + assertNotNull(container); + assertEquals(Release.EL_ALTO,container.getRelease()); + assertNotNull(container.getCreated()); + assertTrue(container.getComponents().size()>0); + assertTrue(container.getConfigs().size()==0); + } + @Test + public void testReport() { + DataMigrationReport report = new DataMigrationReport(); + + assertFalse(report.completed()); + long myvar = 42; + String myvar2 = "come"; + report.log("%d was wrong",myvar); + report.error("%s to me",myvar2); + assertTrue(report.toString().contains("42 was wrong")); + assertTrue(report.toString().contains("come to me")); + report.setCompleted(true); + assertTrue(report.completed()); + + } + @Test + public void TestPluginFileCreation() { + + final String TESTFILE = "asi324po.sa"; + try { + MavenDatabasePluginInitFile.create(Release.FRANKFURT_R1, TESTFILE); + } catch (IOException e) { + fail(e.getMessage()); + } + File f = new File(TESTFILE); + if(f.exists()) { + f.delete(); + } + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoReleaseInformation.java new file mode 100644 index 000000000..6c949df51 --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoReleaseInformation.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk features + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Set; + +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.elalto.ElAltoReleaseInformation; + +public class TestElAltoReleaseInformation { + + @Test + public void test() { + ElAltoReleaseInformation ri = new ElAltoReleaseInformation(); + Set<ComponentName> components = ri.getComponents(); + assertFalse(components.contains(ComponentName.CONNECTIONLOG)); + assertTrue(components.contains(ComponentName.EVENTLOG)); + assertEquals("sdnevents",ri.getAlias(ComponentName.FAULTLOG)); + assertEquals("sdnevents_v1",ri.getIndex(ComponentName.FAULTLOG)); + assertNull(ri.getConverter(Release.EL_ALTO,ComponentName.CONNECTIONLOG)); + assertNotNull(ri.getConverter(Release.EL_ALTO, ComponentName.FAULTCURRENT)); + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoToFrankfurtConversion.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoToFrankfurtConversion.java new file mode 100644 index 000000000..3770cea67 --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestElAltoToFrankfurtConversion.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import org.json.JSONObject; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.SearchHitConverter; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.elalto.ElAltoReleaseInformation; + +/** + * @author Michael Dürre + * + */ +public class TestElAltoToFrankfurtConversion { + + private static final JSONObject FAULTLOG_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n" + + "\"_type\": \"faultlog\",\n" + "\"_id\": \"sim12600/LP-MWS-TTP-01/unknownProblem1\",\n" + + "\"_version\": 1,\n" + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"fault\": {\n" + + "\"nodeName\": \"sim12600\",\n" + "\"counter\": \"1\",\n" + "\"timeStamp\": \"2017-01-01T00:00:00.0Z\",\n" + + "\"objectId\": \"LP-MWS-TTP-01\",\n" + "\"problem\": \"unknownProblem1\",\n" + + "\"severity\": \"Critical\",\n" + "\"type\": \"ProblemNotificationXml\"\n" + "}\n" + "}\n" + "}"); + private static final JSONObject FAULTCURRENT_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n" + + "\"_type\": \"faultcurrent\",\n" + "\"_id\": \"sim12600/LP-MWS-TTP-01/unknownProblem1\",\n" + + "\"_version\": 1,\n" + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"faultCurrent\": {\n" + + "\"nodeName\": \"sim12600\",\n" + "\"counter\": \"1\",\n" + "\"timeStamp\": \"2017-01-01T00:00:00.0Z\",\n" + + "\"objectId\": \"LP-MWS-TTP-01\",\n" + "\"problem\": \"unknownProblem1\",\n" + + "\"severity\": \"Critical\",\n" + "\"type\": \"ProblemNotificationXml\"\n" + "}\n" + "}\n" + "}"); + private static final JSONObject INVENTORY_SEARCHHIT = new JSONObject( + "{\n" + "\"_index\": \"sdnevents_v1\",\n" + "\"_type\": \"inventoryequipment\",\n" + + "\"_id\": \"sim12600/a2.module-1.1.5.5\",\n" + "\"_version\": 1,\n" + "\"_score\": 1,\n" + + "\"_source\": {\n" + "\"treeLevel\": 2,\n" + "\"parentUuid\": \"CARD-1.1.5.0\",\n" + + "\"mountpoint\": \"sim12600\",\n" + "\"uuid\": \"a2.module-1.1.5.5\",\n" + + "\"containedHolder\": [\n" + "\"SUBRACK-1.55.0.0\"\n" + "],\n" + "\"manufacturerName\": null,\n" + + "\"manufacturerIdentifier\": \"ONF-Wireless-Transport\",\n" + "\"serial\": \"310330015\",\n" + + "\"date\": \"2013-04-13T00:00:00.0Z\",\n" + "\"version\": \"a2.module-newest\",\n" + + "\"description\": \"WS/p8.module/a2.module#5\",\n" + "\"partTypeId\": \"3EM23141AD01\",\n" + + "\"modelIdentifier\": \"CRPQABVFAA\",\n" + "\"typeName\": \"a2.module\"\n" + "}\n" + "}"); + private static final JSONObject REQUIREDNE_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"mwtn_v1\",\n" + + "\"_type\": \"required-networkelement\",\n" + "\"_id\": \"sim2230\",\n" + "\"_version\": 1,\n" + + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"mountId\": \"sim2230\",\n" + "\"host\": \"10.20.5.2\",\n" + + "\"port\": 2230,\n" + "\"username\": \"adsa\",\n" + "\"password\": \"asda\"\n" + "}\n" + "}"); + private static final JSONObject EVENTLOG_SEARCHHIT = new JSONObject("{\n" + "\"_index\": \"sdnevents_v1\",\n" + + "\"_type\": \"eventlog\",\n" + "\"_id\": \"AXB7cJHlZ_FApnwi29xq\",\n" + "\"_version\": 1,\n" + + "\"_score\": 1,\n" + "\"_source\": {\n" + "\"event\": {\n" + + "\"nodeName\": \"SDN-Controller-465e2ae306ca\",\n" + "\"counter\": \"1\",\n" + + "\"timeStamp\": \"2020-02-25T08:22:19.8Z\",\n" + "\"objectId\": \"sim2230\",\n" + + "\"attributeName\": \"ConnectionStatus\",\n" + "\"newValue\": \"connecting\",\n" + + "\"type\": \"AttributeValueChangedNotificationXml\"\n" + "}\n" + "}\n" + "}"); + private static final JSONObject MAINTENANCE_SEARCHHIT = new JSONObject("{\n" + + "\"_index\": \"mwtn_v1\",\n" + + "\"_type\": \"maintenancemode\",\n" + + "\"_id\": \"sim2230\",\n" + + "\"_version\": 1,\n" + + "\"_score\": 1,\n" + + "\"_source\": {\n" + + "\"node\": \"sim2230\",\n" + + "\"filter\": [\n" + + "{\n" + + "\"definition\": {\n" + + "\"object-id-ref\": \"\",\n" + + "\"problem\": \"\"\n" + + "},\n" + + "\"description\": \"\",\n" + + "\"start\": \"\",\n" + + "\"end\": \"\"\n" + + "}\n" + + "],\n" + + "\"active\": false\n" + + "}\n" + + "}"); + @Test + public void test() { + ElAltoReleaseInformation ri = new ElAltoReleaseInformation(); + //faultlog + SearchHitConverter faultlogConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.FAULTLOG); + assertNotNull(faultlogConverter); + SearchHit frankfurtFaultlogEntry = faultlogConverter.convert(new SearchHit(FAULTLOG_SEARCHHIT)); + assertNotNull(frankfurtFaultlogEntry); + //faultcurrent + SearchHitConverter faultcurrentConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.FAULTCURRENT); + assertNotNull(faultcurrentConverter); + SearchHit frankfurtFaultcurrentEntry = faultcurrentConverter.convert(new SearchHit(FAULTCURRENT_SEARCHHIT)); + assertNotNull(frankfurtFaultcurrentEntry); + //inventory + SearchHitConverter inventoryConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.INVENTORY); + assertNotNull(inventoryConverter); + SearchHit frankfurtInventory = inventoryConverter.convert(new SearchHit(INVENTORY_SEARCHHIT)); + assertNotNull(frankfurtInventory); + //inventory + SearchHitConverter neConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.REQUIRED_NETWORKELEMENT); + assertNotNull(neConverter); + SearchHit frankfurtNE = neConverter.convert(new SearchHit(REQUIREDNE_SEARCHHIT)); + assertNotNull(frankfurtNE); + //eventlog + SearchHitConverter eventlogConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.EVENTLOG); + assertNotNull(eventlogConverter); + SearchHit frankfurtEvent = eventlogConverter.convert(new SearchHit(EVENTLOG_SEARCHHIT)); + assertNull(frankfurtEvent); + //eventlog->connectionlog + SearchHitConverter conlogConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.CONNECTIONLOG); + assertNotNull(conlogConverter); + SearchHit frankfurtconlog = conlogConverter.convert(new SearchHit(EVENTLOG_SEARCHHIT)); + assertNotNull(frankfurtconlog); + //maintenance + SearchHitConverter maintenanceConverter = ri.getConverter(Release.FRANKFURT_R1, ComponentName.MAINTENANCE); + assertNotNull(maintenanceConverter); + SearchHit frankfurtmaint = maintenanceConverter.convert(new SearchHit(MAINTENANCE_SEARCHHIT)); + assertNotNull(frankfurtmaint); + + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestFrankfurtReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestFrankfurtReleaseInformation.java new file mode 100644 index 000000000..6cdde651a --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestFrankfurtReleaseInformation.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.Set; + +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.ComponentName; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.frankfurt.FrankfurtReleaseInformation; + +public class TestFrankfurtReleaseInformation { + + @Test + public void test() { + FrankfurtReleaseInformation ri = new FrankfurtReleaseInformation(); + Set<ComponentName> components = ri.getComponents(); + assertFalse(components.contains(ComponentName.INVENTORYTOPLEVEL)); + assertTrue(components.contains(ComponentName.EVENTLOG)); + assertEquals("faultlog",ri.getAlias(ComponentName.FAULTLOG)); + assertEquals("faultlog-v2",ri.getIndex(ComponentName.FAULTLOG)); + assertNull(ri.getConverter(Release.FRANKFURT_R1,ComponentName.INVENTORYTOPLEVEL)); + assertNotNull(ri.getConverter(Release.FRANKFURT_R1, ComponentName.FAULTCURRENT)); + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestGuilinReleaseInformation.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestGuilinReleaseInformation.java new file mode 100644 index 000000000..a376facc7 --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestGuilinReleaseInformation.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk features + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.guilin.GuilinReleaseInformation; + +public class TestGuilinReleaseInformation { + + @Test + public void test() { + new GuilinReleaseInformation(); + } + +} diff --git a/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java new file mode 100644 index 000000000..82283f5a3 --- /dev/null +++ b/sdnr/wt/data-provider/setup/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/setup/TestMigrationProvider.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * 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. + * ============LICENSE_END========================================================================== + ******************************************************************************/ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.setup; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.DataMigrationProviderImpl; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.DataMigrationReport; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.setup.data.Release; + +/** + * @author Michael Dürre + * + */ +public class TestMigrationProvider { + + private static final String FRANKFURT_BACKUP_FILE = "src/test/resources/test2.bak.json"; + public static HostInfo[] hosts = new HostInfo[] { new HostInfo("localhost", Integer + .valueOf(System.getProperty("databaseport") != null ? System.getProperty("databaseport") : "49200")) }; + + @Test + public void testCreateImport() { + DataMigrationProviderImpl provider = new DataMigrationProviderImpl(hosts, null, null,true); + + try { + //create el alto db infrastructure + provider.initDatabase(Release.FRANKFURT_R1, 5, 1, "", true); + //import data into database + DataMigrationReport report = provider.importData(FRANKFURT_BACKUP_FILE, false, Release.FRANKFURT_R1); + assertTrue(report.completed()); + assertEquals(Release.FRANKFURT_R1, provider.autoDetectRelease()); + } catch (Exception e) { + fail(e.getMessage()); + } + } +} |