From da4fd6169717cfa04d644d0af0d23dd089a6e373 Mon Sep 17 00:00:00 2001 From: herbert Date: Sat, 14 Dec 2019 00:06:42 +0100 Subject: remove old version of devicemodel devicemanager oldux featureaggregator Issue-ID: SDNC-1004 Signed-off-by: herbert Change-Id: I5337643181e2398e5a8097e4ee14fa4ac96d0d4c --- .../aaiconnector/impl/URLParamEncoderTest.java | 38 -- .../base/netconf/container/AllPmTest.java | 104 ------ .../sdnr/wt/devicemanager/test/TestAai.java | 236 ------------ .../sdnr/wt/devicemanager/test/TestAkkaConfig.java | 144 -------- .../sdnr/wt/devicemanager/test/TestDcae.java | 206 ----------- .../test/TestDevMgrPropertiesFile.java | 301 --------------- .../test/TestDeviceManagerWithDatabase.java | 403 --------------------- .../sdnr/wt/devicemanager/test/TestEquipment.java | 43 --- .../sdnr/wt/devicemanager/test/TestGeoConfig.java | 63 ---- .../test/TestMaintenanceTimeFilter.java | 85 ----- .../sdnr/wt/devicemanager/test/TestMapper.java | 80 ---- .../wt/devicemanager/test/TestNotification.java | 40 -- .../devicemanager/test/TestPerformanceData12.java | 91 ----- .../test/TestPerformanceData1211.java | 91 ----- .../test/TestPerformanceData1211Ethernet.java | 54 --- .../test/TestPerformanceData1211p.java | 91 ----- .../test/TestPerformanceData1211pEthernet.java | 54 --- .../test/TestPerformanceData12Ethernet.java | 53 --- .../wt/devicemanager/test/TestsCapability.java | 58 --- .../devicemanager/test/TestsNectconfDateTime.java | 115 ------ .../mock/ClusterSingletonServiceProviderMock.java | 19 - .../test/mock/DataBrokerMountpointMock.java | 76 ---- .../test/mock/DataBrokerNetconfMock.java | 75 ---- .../wt/devicemanager/test/mock/MountPointMock.java | 90 ----- .../test/mock/MountPointServiceMock.java | 55 --- .../test/mock/NotificationPublishServiceMock.java | 50 --- .../test/mock/RpcConsumerRegistryMock.java | 39 -- .../test/mock/RpcProviderRegistryMock.java | 60 --- .../test/util/DBCleanServiceHelper.java | 91 ----- .../test/util/Model1211ObjectMock.java | 151 -------- .../test/util/Model1211pObjectMock.java | 138 ------- .../devicemanager/test/util/Model12ObjectMock.java | 160 -------- .../test/util/NetconfTimeStampOld.java | 285 --------------- .../wt/devicemanager/test/util/ObjectBuilder.java | 85 ----- .../ReadOnlyTransactionMountpoint1211Mock.java | 208 ----------- .../ReadOnlyTransactionMountpoint1211pMock.java | 209 ----------- .../util/ReadOnlyTransactionMountpoint12Mock.java | 199 ---------- .../sdnr/wt/devicemanager/test/util/ZipFile.java | 63 ---- .../src/test/resources/aaiclient.properties | 165 --------- .../provider/src/test/resources/captured-akka.conf | 72 ---- .../src/test/resources/mediator-server.json | 18 - .../src/test/resources/simplelogger.properties | 38 -- .../provider/src/test/resources/test.properties | 55 --- 43 files changed, 4751 deletions(-) delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoderTest.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPmTest.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java delete mode 100644 sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties delete mode 100644 sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf delete mode 100644 sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json delete mode 100644 sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties delete mode 100644 sdnr/wt/devicemanager/provider/src/test/resources/test.properties (limited to 'sdnr/wt/devicemanager/provider/src/test') diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoderTest.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoderTest.java deleted file mode 100644 index cc4a43677..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoderTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 Nokia 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.devicemanager.aaiconnector.impl; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - - -public class URLParamEncoderTest { - - @Test - public void shouldEncodeStringsToFormatAcceptableByURL(){ - assertEquals("test", URLParamEncoder.encode("test")); - assertEquals("test%20str", URLParamEncoder.encode("test str")); - assertEquals("test%23%24str", URLParamEncoder.encode("test#$str")); - assertEquals("test%20%25%24%26%2B%2C%2F%3A%3B%3D%3F%40%3C%3E%23%25str", URLParamEncoder.encode("test %$&+,/:;=?@<>#%str")); - - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPmTest.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPmTest.java deleted file mode 100644 index 538dcd47a..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPmTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 Nokia 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.devicemanager.base.netconf.container; - -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours; - -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; - - -public class AllPmTest { - - private AllPm allPm; - - @Before - public void setUp(){ - allPm = AllPm.getEmpty(); - } - - @Test - public void shouldCreateEmptyInstance() { - assertEquals(0, allPm.size()); - } - - - @Test - public void shouldBePossibleToAdd15MinutesPerformanceMeasurements() { - // given - final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes_1 = mock(EsHistoricalPerformance15Minutes.class); - final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes_2 = mock(EsHistoricalPerformance15Minutes.class); - - allPm.add(esHistoricalPerformance15Minutes_1); - allPm.add(esHistoricalPerformance15Minutes_2); - - - // when - final List pm15size = allPm.getPm15(); - final List pm24size = allPm.getPm24(); - - // then - assertEquals(2, pm15size.size()); - assertEquals(0, pm24size.size()); - } - - @Test - public void shouldBePossibleToAdd24HoursPerformanceMeasurements() { - // given - final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours_1 = mock(EsHistoricalPerformance24Hours.class); - final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours_2 = mock(EsHistoricalPerformance24Hours.class); - - allPm.add(esHistoricalPerformance24Hours_1); - allPm.add(esHistoricalPerformance24Hours_2); - - - // when - final List pm15size = allPm.getPm15(); - final List pm24size = allPm.getPm24(); - - // then - assertEquals(0, pm15size.size()); - assertEquals(2, pm24size.size()); - } - - @Test - public void shouldBePossibleToAddPerformanceMeasurements() { - // given - final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes = mock(EsHistoricalPerformance15Minutes.class); - final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours = mock(EsHistoricalPerformance24Hours.class); - - allPm.add(esHistoricalPerformance15Minutes); - allPm.add(esHistoricalPerformance24Hours); - - // when - final int size = allPm.size(); - - // then - assertEquals(2, size); - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java deleted file mode 100644 index c01685053..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAai.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.fail; -import com.google.common.io.Files; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.aaiconnector.impl.AaiProviderClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig; - -@SuppressWarnings("restriction") -public class TestAai { - - private static final String ENABLEDAAI_TESTCONFIG_FILENAME = "test2.properties"; - private static final File ENABLEDAAI_TESTCONFIG_FILE = new File(ENABLEDAAI_TESTCONFIG_FILENAME); - private static final int AAI_SERVER_PORT=45454; - private static final String TESTCONFIG_CONTENT="[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=off\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=http://localhost:"+AAI_SERVER_PORT+"\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\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" + - "\n" + - ""; - private HttpServer server; - private ExecutorService httpThreadPool; - private HtDevicemanagerConfiguration globalCfg; - - @Test - public void test() { - HtDevicemanagerConfiguration cfg=HtDevicemanagerConfiguration.getTestConfiguration(); - - AaiProviderClient provider = new AaiProviderClient(cfg, null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - InventoryInformation ii=new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName,ii); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); - System.out.println("finished"); - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Test - public void test2() { - try { - Thread.sleep(3000); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - AaiProviderClient provider = new AaiProviderClient(globalCfg, null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - InventoryInformation ii=new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - provider.onDeviceRegistered(mountPointName); - provider.onDeviceRegistered(mountPointName,ii); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println("unregistering device"); - provider.onDeviceUnregistered(mountPointName); - System.out.println("finished"); - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Before - public void initAaiTestWebserver() throws IOException { - try { - Files.asCharSink(ENABLEDAAI_TESTCONFIG_FILE, StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - } catch (IOException e1) { - fail(e1.getMessage()); - } - globalCfg=HtDevicemanagerConfiguration.getTestConfiguration(ENABLEDAAI_TESTCONFIG_FILENAME,true); - AaiConfig.reload(); - this.server = HttpServer.create(new InetSocketAddress(AAI_SERVER_PORT), 0); - this.httpThreadPool = Executors.newFixedThreadPool(5); - this.server.setExecutor(this.httpThreadPool); - this.server.createContext(globalCfg.getAai().getBaseUri(), new MyHandler()); - //server.createContext("/", new MyRootHandler()); - this.server.setExecutor(null); // creates a default executor - this.server.start(); - System.out.println("http server started"); - } - - @After - public void stopTestWebserver() { - if (this.server != null) { - this.server.stop(0); - this.httpThreadPool.shutdownNow(); - System.out.println("http server stopped" ); - } - if (ENABLEDAAI_TESTCONFIG_FILE.exists()) { - ENABLEDAAI_TESTCONFIG_FILE.delete(); - } - - } - static class MyHandler implements HttpHandler { - @Override - public void handle(HttpExchange t) throws IOException { - String method = t.getRequestMethod(); - System.out.println("req method: " + method); - OutputStream os = null; - try { - String res=""; - if (method.equals("GET")) { - t.sendResponseHeaders(404,res.length() ); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else if (method.equals("DELETE")) { - t.sendResponseHeaders(200, res.length()); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else if (method.equals("PUT")) { - t.sendResponseHeaders(200, res.length()); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else { - t.sendResponseHeaders(404, 0); - } - System.out.println("req handled successful"); - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - finally { - if (os != null) - { - os.close(); - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java deleted file mode 100644 index 3d690116d..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestAkkaConfig.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.fail; -import java.io.File; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AkkaConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.util.ClusterNodeInfo; - -public class TestAkkaConfig { - - private static String getAkkaConfigSingleNodeText() { - return "\n" + "odl-cluster-data {\n" + " akka {\n" + " remote {\n" + " artery {\n" - + " enabled = off\n" + " canonical.hostname = \"127.0.0.1\"\n" - + " canonical.port = 2550\n" + " }\n" + " netty.tcp {\n" - + " hostname = \"127.0.0.1\"\n" + " port = 2550\n" + " }\n" - + " # when under load we might trip a false positive on the failure detector\n" - + " # transport-failure-detector {\n" + " # heartbeat-interval = 4 s\n" - + " # acceptable-heartbeat-pause = 16s\n" + " # }\n" + " }\n" + "\n" + " cluster {\n" - + " # Remove \".tcp\" when using artery.\n" - + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n" + "\n" - + " roles = [\n" + " \"member-1\"\n" + " ]\n" + "\n" + " }\n" + "\n" - + " persistence {\n" - + " # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by\n" - + " # modifying the following two properties. The directory location specified may be a relative or absolute path. \n" - + " # The relative path is always relative to KARAF_HOME.\n" + "\n" - + " # snapshot-store.local.dir = \"target/snapshots\"\n" - + " # journal.leveldb.dir = \"target/journal\"\n" + "\n" + " journal {\n" - + " leveldb {\n" + " # Set native = off to use a Java-only implementation of leveldb.\n" - + " # Note that the Java-only version is not currently considered by Akka to be production quality.\n" - + "\n" + " # native = off\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}"; - } - - private static String getAkkaConfigClusterNodeText() { - return "\n" + "odl-cluster-data {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n" - + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" - + " port = 2550\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n" - + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n" - + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n" - + " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2550\"]\n" - + " seed-node-timeout = 15s\n" + " roles = [\"member-1\"]\n" + "\n" + " }\n" - + " persistence {\n" + " journal-plugin-fallback {\n" + " circuit-breaker {\n" - + " max-failures = 10\n" + " call-timeout = 60s\n" - + " reset-timeout = 30s\n" + " }\n" + " }\n" + " }\n" + " }\n" + "}\n" + "\n" - + "odl-cluster-rpc {\n" + "\n" + " akka {\n" + " loglevel = \"\"\n" + " remote {\n" - + " netty.tcp {\n" + " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" - + " port = 2551\n" + " }\n" + " }\n" + " actor {\n" + " debug{\n" - + " autoreceive = on\n" + " lifecycle = on\n" + " unhandled = on\n" - + " fsm = on\n" + " event-stream = on\n" + " }\n" + " }\n" + " cluster {\n" - + " seed-nodes = [\"akka.tcp://odl-cluster-rpc@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2551\"]\n" - + " seed-node-timeout = 15s\n" + " }\n" + " persistence {\n" - + " journal-plugin-fallback {\n" + " circuit-breaker {\n" + " max-failures = 10\n" - + " call-timeout = 60s\n" + " reset-timeout = 30s\n" + " }\n" + " }\n" - + " }\n" + " }\n" + "}\n" + "\n" + ""; - } - - @Test - public void test1() { - AkkaConfig cfg; - try { - System.out.println("testing clusternode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.parse(getAkkaConfigClusterNodeText()); - System.out.println("succeeded: "); - System.out.println(cfg.toString()); - System.out.println(String.format("found %d cluster nodes", cfg.getClusterConfig().getSeedNodes().size())); - for (ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes()) { - System.out.println(n.toString()); - } - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } - - @Test - public void test2() { - AkkaConfig cfg; - try { - System.out.println("testing singlenode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.parse(getAkkaConfigSingleNodeText()); - System.out.println("succeeded: "); - System.out.println(cfg.toString()); - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } - - @Test - public void test3() { - AkkaConfig cfg; - - ClassLoader classLoader = getClass().getClassLoader(); - File file = new File(classLoader.getResource("captured-akka.conf").getFile()); - System.out.println(file.getAbsolutePath()); - - try { - System.out.println("testing clusternode config1"); - System.out.println("==========================="); - cfg = AkkaConfig.load(file.getAbsolutePath()); - System.out.println("succeeded: "+cfg.hashCode()); - System.out.println(cfg.toString()); - System.out.println(String.format("found %d cluster nodes", cfg.getClusterConfig().getSeedNodes().size())); - for (ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes()) { - System.out.println(n.toString()); - } - } catch (Exception e) { - String failMessage = "failed: " + e.getMessage(); - System.out.println(failMessage); - fail(failMessage); - } - } - - @Test - public void test4() { - AaiConfig cfg = AaiConfig.getDefaultConfiguration(); - cfg.hashCode(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java deleted file mode 100644 index 1c0a889b4..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDcae.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.fail; -import com.google.common.io.Files; -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.dcaeconnector.impl.DcaeProviderClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; - -@SuppressWarnings("restriction") -public class TestDcae { - - private static final String ENABLEDDCAE_TESTCONFIG_FILENAME = "test2.properties"; - private static final File ENABLEDDCAE_TESTCONFIG_FILE = new File(ENABLEDDCAE_TESTCONFIG_FILENAME); - private static final int DCAE_SERVER_PORT=45451; - private static final String URI = "/abc"; - private static final String TESTCONFIG_CONTENT="[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:"+DCAE_SERVER_PORT+URI+"\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\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" + - "\n" + - ""; - private HttpServer server; - private ExecutorService httpThreadPool; - private HtDevicemanagerConfiguration cfg; - - @Test - public void test2() { - try { - Thread.sleep(3000); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - DcaeProviderClient provider = new DcaeProviderClient(cfg,"mountpoint",null); - - String mountPointName = "testDevice 01"; - String type="Unit"; - String model="Horizon Compact+"; - String vendor="DragonWave-X"; - String ipv4="127.0.0.1"; - String ipv6="::1"; - List ifInfos = new ArrayList<>(); - ifInfos.add("LP-MWPS-RADIO"); - new InventoryInformation(type, model, vendor, ipv4, ipv6, ifInfos); - System.out.println("registering device"); - boolean neDeviceAlarm = false; - ProblemNotificationXml notification = new ProblemNotificationXml(mountPointName, "network-element", "problemName", InternalSeverity.Critical,"123", InternalDateAndTime.getTestpattern()); - provider.sendProblemNotification(mountPointName, notification, neDeviceAlarm); - - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - try { - provider.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Before - public void initDcaeTestWebserver() throws IOException { - try { - Files.asCharSink(ENABLEDDCAE_TESTCONFIG_FILE, StandardCharsets.UTF_8).write(TESTCONFIG_CONTENT); - } catch (IOException e1) { - fail(e1.getMessage()); - } - cfg=HtDevicemanagerConfiguration.getTestConfiguration(ENABLEDDCAE_TESTCONFIG_FILENAME,true); - DcaeConfig.reload(); - try - { - this.server = HttpServer.create(new InetSocketAddress(DCAE_SERVER_PORT), 0); - } - catch(Exception e) { - fail(e.getMessage()); - } - this.httpThreadPool = Executors.newFixedThreadPool(5); - this.server.setExecutor(this.httpThreadPool); - this.server.createContext(URI, new MyHandler()); - //server.createContext("/", new MyRootHandler()); - this.server.setExecutor(null); // creates a default executor - this.server.start(); - System.out.println("http server started"); - } - - @After - public void stopTestWebserver() { - if (this.server != null) { - this.server.stop(0); - this.httpThreadPool.shutdownNow(); - System.out.println("http server stopped" ); - } - if (ENABLEDDCAE_TESTCONFIG_FILE.exists()) { - ENABLEDDCAE_TESTCONFIG_FILE.delete(); - } - } - static class MyHandler implements HttpHandler { - @Override - public void handle(HttpExchange t) throws IOException { - String method = t.getRequestMethod(); - System.out.println("req method: " + method); - OutputStream os = null; - try { - String res=""; - if (method.equals("POST")) { - t.sendResponseHeaders(200,res.length() ); - os = t.getResponseBody(); - os.write(res.getBytes()); - } else { - t.sendResponseHeaders(404, 0); - } - System.out.println("req handled successful"); - - } catch (Exception e) { - System.out.println(e.getMessage()); - } - finally { - if (os != null) - { - os.close(); - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java deleted file mode 100644 index 5242bac1c..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDevMgrPropertiesFile.java +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.*; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.HtDevicemanagerConfiguration; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.AaiConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.DcaeConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.EsConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.PmConfig; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.ToggleAlarmConfig; - -import com.google.common.io.Files; - -public class TestDevMgrPropertiesFile { - - private static final File FILENAME = new File("test.properties"); - private static final File AAIPROP_FILE=new File("aaiclient.properties"); - protected int hasChanged; - - @Before - public void init() { - delete(FILENAME); - delete(AAIPROP_FILE); - } - @After - public void deinit() { - this.init(); - } - - @Test - public void test1() { - - writeFile(FILENAME, this.getContent1()); - writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - - System.out.println("Read and verify"); - HtDevicemanagerConfiguration cfg=HtDevicemanagerConfiguration.getTestConfiguration(FILENAME.getPath()); - - assertNotNull(cfg.getAai()); - assertNotNull(cfg.getDcae()); - assertNotNull(cfg.getPm()); - assertNotNull(cfg.getEs()); - assertNotNull(cfg.getToggleAlarm()); - assertTrue(AaiConfig.isInstantiated()); - assertTrue(DcaeConfig.isInstantiated()); - assertTrue(PmConfig.isInstantiated()); - assertTrue(EsConfig.isInstantiated()); - assertTrue(ToggleAlarmConfig.isInstantiated()); - - System.out.println("Verify\n"+cfg.getAai()+"\n"+AaiConfig.getDefaultConfiguration()); - @SuppressWarnings("unused") - boolean res; - res = cfg.getAai().equals(AaiConfig.getDefaultConfiguration()); - res = cfg.getDcae().equals(DcaeConfig.getDefaultConfiguration()); - res = cfg.getPm().equals(PmConfig.getDefaultConfiguration()); - res = cfg.getEs().equals(EsConfig.getDefaultConfiguration()); - res = cfg.getToggleAlarm().equals(ToggleAlarmConfig.getDefaultConfiguration()); - - res = cfg.getAai().hashCode() == AaiConfig.getDefaultConfiguration().hashCode(); - res = cfg.getDcae().hashCode() == DcaeConfig.getDefaultConfiguration().hashCode(); - res = cfg.getPm().hashCode() == PmConfig.getDefaultConfiguration().hashCode(); - res = cfg.getEs().hashCode() == EsConfig.getDefaultConfiguration().hashCode(); - res = cfg.getToggleAlarm().hashCode() == ToggleAlarmConfig.getDefaultConfiguration().hashCode(); - - } - - //-- Observer not working with all testcases, because config does not support different file types. - //@Test - public void test2() { - - hasChanged=0; - writeFile(FILENAME, this.getContent1()); - writeFile(AAIPROP_FILE, this.getAaiPropertiesConfig()); - - - System.out.println("Read and verify"); - HtDevicemanagerConfiguration cfg=HtDevicemanagerConfiguration.getTestConfiguration(FILENAME.getPath()); - - assertNotNull(cfg.getAai()); - assertNotNull(cfg.getDcae()); - assertNotNull(cfg.getPm()); - assertNotNull(cfg.getEs()); - assertNotNull(cfg.getToggleAlarm()); - assertTrue(AaiConfig.isInstantiated()); - assertTrue(DcaeConfig.isInstantiated()); - assertTrue(PmConfig.isInstantiated()); - assertTrue(EsConfig.isInstantiated()); - assertTrue(ToggleAlarmConfig.isInstantiated()); - - System.out.println("Verify456\n"+cfg.getAai()+"\n"+AaiConfig.getDefaultConfiguration()); - cfg.getAai().equals(AaiConfig.getDefaultConfiguration()); - cfg.getDcae().equals(DcaeConfig.getDefaultConfiguration()); - cfg.getPm().equals(PmConfig.getDefaultConfiguration()); - cfg.getEs().equals(EsConfig.getDefaultConfiguration()); - cfg.getToggleAlarm().equals(ToggleAlarmConfig.getDefaultConfiguration()); - - cfg.registerConfigChangedListener(() -> { - hasChanged++; - System.out.println("file changed listener triggered: "+hasChanged); - AaiConfig.reload(); - DcaeConfig.reload(); - PmConfig.reload(); - EsConfig.reload(); - ToggleAlarmConfig.reload(); - - }); - System.out.println("Listerner registered."); - System.out.println(cfg.getAai().toString()); - System.out.println(cfg.getDcae().toString()); - System.out.println(cfg.getPm().toString()); - System.out.println(cfg.getEs().toString()); - System.out.println(cfg.getToggleAlarm().toString()); - - sleep(5000); - System.out.println("Write new content. Changes "+hasChanged); - writeFile(FILENAME, this.getContent2()); - sleep(5000); - - int i=10; - while(hasChanged == 0 && i-- > 0) { - System.out.println("Wait for Change indication."); - sleep(1000); - } - System.out.println("Changes "+hasChanged); - - assertTrue("fileChanged counter"+hasChanged, hasChanged > 0); - assertFalse(cfg.getAai().hashCode()==AaiConfig.getDefaultConfiguration().hashCode()); - assertFalse(cfg.getDcae().hashCode()==DcaeConfig.getDefaultConfiguration().hashCode()); - assertFalse(cfg.getPm().hashCode()==PmConfig.getDefaultConfiguration().hashCode()); - assertFalse(cfg.getEs().hashCode()==EsConfig.getDefaultConfiguration().hashCode()); - assertFalse(cfg.getToggleAlarm().hashCode()==ToggleAlarmConfig.getDefaultConfiguration().hashCode()); - - HtDevicemanagerConfiguration.clear(); - - System.out.println("Test done"); - - } - - - private static void sleep(int milliseconds) { - try { - Thread.sleep(milliseconds); - } catch (InterruptedException e) { - } - } - - public static void writeFile(File f, String content) { - try { - Files.asCharSink(f, StandardCharsets.UTF_8).write(content); - } catch (IOException e) { - fail(e.getMessage()); - }; - sleep(500); - } - - private void delete(File f) { - if(f.exists()) { - f.delete(); - } - } - - - private String getContent2() { - return "[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:45451/abc\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\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" + - "[toggleAlarmFilter]\n" + - "taEnabled=true\n" + - "taDelay=5555\n" + - ""; - } - - private String getContent1() { - return "[dcae]\n" + - "dcaeUserCredentials=admin:admin\n" + - "dcaeUrl=http://localhost:45/abc\n" + - "dcaeHeartbeatPeriodSeconds=120\n" + - "dcaeTestCollector=no\n" + - "\n" + - "[aots]\n" + - "userPassword=passwd\n" + - "soapurladd=off\n" + - "soapaddtimeout=10\n" + - "soapinqtimeout=20\n" + - "userName=user\n" + - "inqtemplate=inqreq.tmpl.xml\n" + - "assignedto=userid\n" + - "addtemplate=addreq.tmpl.xml\n" + - "severitypassthrough=critical,major,minor,warning\n" + - "systemuser=user\n" + - "prt-offset=1200\n" + - "soapurlinq=off\n" + - "#smtpHost=\n" + - "#smtpPort=\n" + - "#smtpUsername=\n" + - "#smtpPassword=\n" + - "#smtpSender=\n" + - "#smtpReceivers=\n" + - "\n" + - "[es]\n" + - "esCluster=sendateodl5\n" + - "\n" + - "[aai]\n" + - "#keep comment\n" + - "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + - "aaiUrl=off\n" + - "aaiUserCredentials=AAI:AAI\n" + - "aaiDeleteOnMountpointRemove=true\n" + - "aaiTrustAllCerts=false\n" + - "aaiApiVersion=aai/v13\n" + - "aaiPropertiesFile=aaiclient.properties\n" + - "\n" + - "[pm]\n" + - "pmCluster=sendateodl5\n" + - "pmEnabled=true\n" + - "[toggleAlarmFilter]\n" + - "taEnabled=false\n" + - "taDelay=5555\n" + - ""; - } - private String getAaiPropertiesConfig() { - return "org.onap.ccsdk.sli.adaptors.aai.ssl.key=\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=\"false\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.application=\"\"\n" + - "org.onap.ccsdk.sli.adaptors.aai.uri=\"\"\n" + - "connection.timeout=60000\n" + - "read.timeout=60000"; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java deleted file mode 100644 index 24c605e8f..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestDeviceManagerWithDatabase.java +++ /dev/null @@ -1,403 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.concurrent.TimeUnit; - -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice.ArchiveCleanService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtDatabaseWebAPIClient; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerService.Action; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.ClusterSingletonServiceProviderMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.DataBrokerNetconfMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.MountPointServiceMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.NotificationPublishServiceMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock.RpcProviderRegistryMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.DBCleanServiceHelper; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211Mock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint1211pMock; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.ReadOnlyTransactionMountpoint12Mock; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings("deprecation") -public class TestDeviceManagerWithDatabase { - - private static int DATABASETIMEOUTSECONDS = 30; - - private static Path KARAF_ETC = Paths.get("etc"); - private static DeviceManagerImpl deviceManager; - private static MountPointMock mountPoint; - private static DataBrokerNetconfMock dataBrokerNetconf; - - private static final Logger LOG = LoggerFactory.getLogger(TestDeviceManagerWithDatabase.class); - - - - @BeforeClass - public static void before() throws InterruptedException, IOException { - - System.out.println("Logger: " + LOG.getClass().getName() + " " + LOG.getName()); - // Call System property to get the classpath value - Path etc = KARAF_ETC; - delete(etc); - - System.out.println("Create empty:" + etc.toString()); - Files.createDirectories(etc); - - // Create mocks - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf = new DataBrokerNetconfMock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint = new MountPointMock(); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - ClusterSingletonServiceProvider clusterSingletonService = new ClusterSingletonServiceProviderMock(); - MountPointService mountPointService = new MountPointServiceMock(mountPoint); - NotificationPublishService notificationPublishService = new NotificationPublishServiceMock(); - RpcProviderRegistry rpcProviderRegistry = new RpcProviderRegistryMock(); - - // start using blueprint interface - String msg = ""; - try { - deviceManager = new DeviceManagerImpl(); - - deviceManager.setDataBroker(dataBrokerNetconf); - deviceManager.setMountPointService(mountPointService); - deviceManager.setNotificationPublishService(notificationPublishService); - deviceManager.setRpcProviderRegistry(rpcProviderRegistry); - deviceManager.setClusterSingletonService(clusterSingletonService); - deviceManager.init(); - } catch (Exception e) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - e.printStackTrace(pw); - msg = sw.toString(); // stack trace as a string - e.printStackTrace(); - } - readOnlyTransaction.close(); - System.out.println("Initialization status: " + deviceManager.isDevicemanagerInitializationOk()); - assertTrue("Devicemanager not initialized: " + msg, deviceManager.isDevicemanagerInitializationOk()); - System.out.println("Initialization done"); - waitfordatabase(); - } - - @AfterClass - public static void after() throws InterruptedException, IOException { - - System.out.println("Start shutdown"); - // close using blueprint interface - try { - deviceManager.close(); - } catch (Exception e) { - System.out.println(e); - } - delete(KARAF_ETC); - - } - - @Test - public void test0() throws InterruptedException { - HtDatabaseWebAPIClient client = new HtDatabaseWebAPIClient(); - try { - String response = client.sendRequest("/mwtn/mediator-server/_search", "GET", - new JSONObject("{\"match\":{\"id\":id}}")); - System.out.println(response); - } catch (JSONException | IOException e) { - e.printStackTrace(); - } - } - - @Test - public void test2() { - System.out.println("Test2: slave mountpoint"); - - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - - mountPoint.setDatabrokerAbsent(true); - NodeId nodeId = new NodeId("mountpointTest2"); - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - - readOnlyTransaction.close(); - System.out.println("Test2: Done"); - - } - - @Test - public void test3() { - System.out.println("Test3: master mountpoint ONF Model 12"); - - ReadOnlyTransactionMountpoint12Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint12Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest3"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - - readOnlyTransaction.close(); - System.out.println("Test3: Done"); - - } - - @Test - public void test4() { - System.out.println("Test4: master mountpoint ONF Model 1211"); - - ReadOnlyTransactionMountpoint1211Mock readOnlyTransaction = new ReadOnlyTransactionMountpoint1211Mock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest4"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - Thread.interrupted(); - } - - readOnlyTransaction.close(); - System.out.println("Test4: Done"); - - } - - @Test - public void test5() { - System.out.println("Test5: master mountpoint ONF Model 1211p"); - - ReadOnlyTransactionMountpoint1211pMock readOnlyTransaction = new ReadOnlyTransactionMountpoint1211pMock(); - dataBrokerNetconf.setReadOnlyTransaction(readOnlyTransaction); - mountPoint.setReadOnlyTransaction(readOnlyTransaction); - - NetconfNode nNode = readOnlyTransaction.getMock().getNetconfNode(); - mountPoint.setDatabrokerAbsent(false); - NodeId nodeId = new NodeId("mountpointTest5"); - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - System.out.println("Node capabilites: " + capabilities); - - try { - deviceManager.startListenerOnNodeForConnectedState(Action.CREATE, nodeId, nNode); - } catch (Exception e) { - e.printStackTrace(); - fail("Exception received."); - } - readOnlyTransaction.sendProblemNotification(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - Thread.interrupted(); - } - - readOnlyTransaction.close(); - System.out.println("Test5: Done"); - - } - - @Test - public void test6() { - - System.out.println("Test6: Write zip data file file"); - File testFile = new File("etc/elasticsearch_update.zip"); - Resources.extractFileTo("elasticsearch_update.zip", testFile); - int wait = 130; - while (testFile.exists() && wait-- > 0) { - System.out.println("Waiting " + wait); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - Thread.interrupted(); - } - } - - - System.out.println("Test6: Done"); - - } - - @Test - public void test7() throws Exception { - final int NUM = 5; - final int ARCHIVE_DAYS = 30; - final long ARCHIVE_LIMIT_SEC = TimeUnit.SECONDS.convert(ARCHIVE_DAYS, TimeUnit.DAYS); - final long ARCHIVE_INTERVAL_SEC = 10; - File propFile = KARAF_ETC.resolve("devicemanager.properties").toFile(); - - ArchiveCleanService service = deviceManager.getArchiveCleanService(); - DBCleanServiceHelper helper = new DBCleanServiceHelper(deviceManager); - - // setEsConfg - TestDevMgrPropertiesFile.writeFile(propFile, getContent(ARCHIVE_LIMIT_SEC, ARCHIVE_INTERVAL_SEC)); - //give time to read file - sleep(5); - System.out.println("Archive clean service configuration "+service); - System.out.println("To delete elements older: "+service.getDateForOldElements()); - System.out.println("Status of elements is: "+service.countOldEntries()); - - // create old data and check if the will be cleaned completely - int elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0 /*Hours*/); - System.out.println("Written elements are: "+elements); - - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Entries are not cleared completely as expected"); - - // create partial old and newer data and check that only half of all data are cleaned - // New data are not counted as "old" .. - int elementsToRemove = elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+5, 0); - elements += helper.writeDataToLogs(NUM, ARCHIVE_DAYS-5, 0); - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elementsToRemove, "Entries are not cleared exactly half as expected"); - - // create only newer data and check that nothing is cleaned - elements = helper.writeDataToLogs(NUM, ARCHIVE_DAYS+2, 0); - waitForDeletion(service, 2 * ARCHIVE_INTERVAL_SEC, elements, "Some entries were removed, but shouldn't."); - - service.close(); - } - - // ********************* Private - - private void waitForDeletion(ArchiveCleanService service, long timeout, long numberAtBeginning, String faultMessage) { - int numberEntries = 0; - while (timeout-- > 0) { - sleep(1000); - numberEntries = service.countOldEntries(); - if (numberEntries <= 0) { - break; - } - } - if (timeout == 0) { - fail(faultMessage + " Timeout at:" + timeout + " Entries at beginning " + numberAtBeginning - + " remaining" + numberEntries); - } - } - - - private static void waitfordatabase() throws InterruptedException { - - System.out.println("Test1: Wait for database"); - int timeout = DATABASETIMEOUTSECONDS; - while (!deviceManager.isDatabaseInitializationFinished() && timeout-- > 0) { - System.out.println("Test1: " + timeout); - Thread.sleep(1000); // On second - } - System.out.println("Ddatabase initialized"); - } - - private static void sleep(int millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException e) { - LOG.warn(e.getMessage()); - Thread.interrupted(); - } - } - - private static void delete(Path etc) throws IOException { - if (Files.exists(etc)) { - System.out.println("Found and remove:" + etc.toString()); - delete(etc.toFile()); - } - } - - private static void delete(File f) throws IOException { - if (f.isDirectory()) { - for (File c : f.listFiles()) { - delete(c); - } - } - if (!f.delete()) { - throw new FileNotFoundException("Failed to delete file: " + f); - } - } - - private String getContent(long archiveLimitSeconds, long esArchiveCheckIntervalSeconds) { - return "[dcae]\n" + "dcaeUserCredentials=admin:admin\n" + "dcaeUrl=http://localhost:45/abc\n" - + "dcaeHeartbeatPeriodSeconds=120\n" + "dcaeTestCollector=no\n" + "\n" + "[aots]\n" - + "userPassword=passwd\n" + "soapurladd=off\n" + "soapaddtimeout=10\n" + "soapinqtimeout=20\n" - + "userName=user\n" + "inqtemplate=inqreq.tmpl.xml\n" + "assignedto=userid\n" - + "addtemplate=addreq.tmpl.xml\n" + "severitypassthrough=critical,major,minor,warning\n" - + "systemuser=user\n" + "prt-offset=1200\n" + "soapurlinq=off\n" + "#smtpHost=\n" + "#smtpPort=\n" - + "#smtpUsername=\n" + "#smtpPassword=\n" + "#smtpSender=\n" + "#smtpReceivers=\n" + "\n" + "[es]\n" - + "esCluster=sendateodl5\n" + "esArchiveLifetimeSeconds=" + archiveLimitSeconds + "\n" + "esArchiveCheckIntervalSeconds=" - + esArchiveCheckIntervalSeconds + "\n" + "\n" + "[aai]\n" + "#keep comment\n" - + "aaiHeaders=[\"X-TransactionId: 9999\"]\n" + "aaiUrl=off\n" + "aaiUserCredentials=AAI:AAI\n" - + "aaiDeleteOnMountpointRemove=true\n" + "aaiTrustAllCerts=false\n" + "aaiApiVersion=aai/v13\n" - + "aaiPropertiesFile=aaiclient.properties\n" + "\n" + "[pm]\n" + "pmCluster=sendateodl5\n" - + "pmEnabled=true\n" + "[toggleAlarmFilter]\n" + "taEnabled=false\n" + "taDelay=5555\n" + ""; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java deleted file mode 100644 index 9875a8f43..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestEquipment.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import org.junit.Test; -import org.mockito.Mockito; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.types.equipment.ExtendedEquipment; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; - -public class TestEquipment extends Mockito { - - @Test - public void test() { - - - EquipmentBuilder equipmentBuilder = new EquipmentBuilder(); - equipmentBuilder.setUuid( new UniversalId("EquipmentId")); - ExtendedEquipment extendedEquipment = new ExtendedEquipment("Parent",equipmentBuilder.build(),1); - - String extendedEquipmentString = extendedEquipment.toString(); - System.out.println(extendedEquipmentString); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java deleted file mode 100644 index 5b00cbb78..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestGeoConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.config.impl.GeoConfig; - -public class TestGeoConfig { - - @Test - public void test() { - GeoConfig config; - try { - System.out.println("testing clusternode geo config1"); - System.out.println("==========================="); - config = GeoConfig.parse(getClusterGeoConfigContent()); - System.out.println("succeeded: "); - System.out.println(config.toString()); - System.out.println("primary roles:"); - System.out.println(config.getPrimaryRoles().toString()); - System.out.println("secondary roles:"); - System.out.println(config.getSecondaryRoles().toString()); - - } catch (Exception e) { - fail("failed: " + e.getMessage()); - } - } - - - - private static String getClusterGeoConfigContent() { - return "\n" + "lumina-geo-cluster {\n" + " primary_roles = [\n" - + " \"member-1\",\"member-2\",\"member-3\"\n" + " ]\n" + " secondary_roles = [\n" - + " \"member-4\",\"member-5\",\"member-6\"\n" + " ]\n" + " ip_roles_table = [\n" + "\n" - + " {\n" + "role=\"member-1\"\n" + "ip=\"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" + "},\n" - + "{\n" + "role=\"member-2\"\n" + "ip=\"zltcmtn23arbc02.2f0377.mtn23a.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-3\"\n" + "ip=\"zltcmtn23arbc03.2f0377.mtn23a.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-4\"\n" + "ip=\"zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-5\"\n" + "ip=\"zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com\"\n" + "},\n" + "{\n" - + "role=\"member-6\"\n" + "ip=\"zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com\"\n" + "}\n" + " \n" - + " ]\n" + "}\n" + "\n" + "\n" + "\n" + "\n" + ""; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java deleted file mode 100644 index 1d97eb85b..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMaintenanceTimeFilter.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import java.time.ZonedDateTime; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.maintenance.database.types.EsMaintenanceFilter; - -public class TestMaintenanceTimeFilter { - - private static String DEFAULT1 = "EsMaintenanceFilter [start=1970-01-01T00:00Z[UTC], end=1970-01-01T00:00Z[UTC], definition=EsMaintenanceFilterDefinition [objectIdRef=, problem=], description=]"; - private static String DEFAULT2 = "EsMaintenanceFilter [start=1970-01-01T00:00Z[UTC], end=2018-01-01T10:00+05:00, definition=EsMaintenanceFilterDefinition [objectIdRef=, problem=], description=]"; - - @Test - public void test1() { - EsMaintenanceFilter fi = new EsMaintenanceFilter(); - String fiAsString; - - fiAsString = fi.toString(); - System.out.println("Default 1: " + fiAsString); - if (! fiAsString.equals(DEFAULT1)) { - fail("Time conversion not OK"); - } - } - @Test - public void test2() { - EsMaintenanceFilter fi = new EsMaintenanceFilter(); - String fiAsString; - - fi.setEndAsString("2018-01-01T10:00:00+05:00"); - fiAsString = fi.toString(); - System.out.println("Default 2: " + fi); - System.out.println("As String: " + fi.getEndAsString()); - if (! fiAsString.equals(DEFAULT2)) { - fail("Time conversion not OK"); - } - } - @Test - public void test3() { - - boolean res; - - ZonedDateTime start = ZonedDateTime.parse("2018-01-01T10:00:00+05:00"); - ZonedDateTime end = ZonedDateTime.parse("2019-01-01T10:00:00+05:00"); - ZonedDateTime now; - - now = ZonedDateTime.parse("2017-05-01T10:00:00+05:00"); - res = EsMaintenanceFilter.isInPeriod(start, end, now); - System.out.println("Before: " + res); - assertFalse("before period", res); - - now = ZonedDateTime.parse("2018-05-01T10:00:00+05:00"); - res = EsMaintenanceFilter.isInPeriod(start, end, now); - System.out.println("Within: " + res); - assertTrue("within period",res); - - now = ZonedDateTime.parse("2019-05-01T10:00:00+05:00"); - res = EsMaintenanceFilter.isInPeriod(start, end, now); - System.out.println("After: " + res); - assertFalse("after period", res); - - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java deleted file mode 100644 index d532f4256..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestMapper.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import java.util.Arrays; -import java.util.List; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtMapper; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.JsonMapperBase; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestMapper { - - @Test - public void test1() { - - int t = 0; - System.out.println(t++); - - HtMapper mapper = new HtMapper<>(EsHistoricalPerformance15Minutes.class); - System.out.println(t++); - - - Lp layerProtocol = new LpBuilder().setUuid(new UniversalId("TestId")) - .setLayerProtocolName(new LayerProtocolName("LayprotcolTest")).build(); - System.out.println(t++); - EsHistoricalPerformance15Minutes pmData = new EsHistoricalPerformance15Minutes("Testnode", layerProtocol); - System.out.println(t++); - - // AirInterfaceHistoricalPerformancesBuilder builder1 = new - // AirInterfaceHistoricalPerformancesBuilder(); - // System.out.println(t++); - - - HistoricalPerformanceDataListBuilder builder2 = new HistoricalPerformanceDataListBuilder(); - System.out.println(t++); - builder2.setPeriodEndTime(new DateAndTime("2019-06-06T12:12:12.1Z")); - System.out.println(t++); - - String json = mapper.objectToJson(pmData); - - System.out.println("Result: " + pmData); - System.out.println("Result: " + json); - - // fail("Not yet implemented"); - } - - @Test - public void test2() { - - for (int t = 0; t < 5; t++) { - JsonMapperBase baseMapper = new JsonMapperBase(0); - Integer o = new Integer(6); - List oList = Arrays.asList(o); - String json = baseMapper.objectListToJson(oList); - System.out.println(json); - } - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java deleted file mode 100644 index f32f35723..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestNotification.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter.NotificationWithServerTimeStamp; - -public class TestNotification { - - @Test - public void test() { - - NotificationWithServerTimeStamp test = new NotificationWithServerTimeStamp<>(1000); - - test.refresh(1000); - test.getStartTime(); - - System.out.println(test); - - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java deleted file mode 100644 index 0037724bf..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData12 { - - @Test - public void test1() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java deleted file mode 100644 index ffd460c3c..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211 { - - @Test - public void test() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java deleted file mode 100644 index 60706771e..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211Ethernet.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211Ethernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java deleted file mode 100644 index dff517de9..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211p.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211p { - - @Test - public void test() { - - PerformanceDataBuilder p = new PerformanceDataBuilder(); - byte b=100; - short s=100; - p.setEs(100); - p.setCses(100); - p.setEs(100); - p.setSes(100); - p.setCses(100); - p.setUnavailability(100); - p.setTxLevelMin(b); - p.setTxLevelMax(b); - p.setTxLevelAvg(b); - p.setRxLevelMin(b); - p.setRxLevelMax(b); - p.setRxLevelAvg(b); - p.setTime2States(100); - p.setTime4StatesS(100); - p.setTime4States(100); - p.setTime8States(100); - p.setTime16StatesS(100); - p.setTime16States(100); - p.setTime32States(100); - p.setTime64States(100); - p.setTime128States(100); - p.setTime256States(100); - p.setTime512States(100); - p.setTime512StatesL(100); - p.setTime1024States(100); - p.setTime1024StatesL(100); - p.setTime2048States(100); - p.setTime2048StatesL(100); - p.setTime4096States(100); - p.setTime4096StatesL(100); - p.setTime8192States(100); - p.setTime8192StatesL(100); - p.setSnirMin(b); - p.setSnirMax(b); - p.setSnirAvg(b); - p.setXpdMin(b); - p.setXpdMax(b); - p.setXpdAvg(b); - p.setRfTempMin(b); - p.setRfTempMax(b); - p.setRfTempAvg(b); - p.setDefectBlocksSum(s); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmList = new HistoricalPerformanceDataListBuilder(); - pmList.setPerformanceData(p.build()); - - EsPerformanceData pmData = new EsPerformanceData(pmList.build()); - - assertTrue("Verify value", pmData.getEs() == 100); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java deleted file mode 100644 index 68cb5ca3d..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData1211pEthernet.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData1211pEthernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - p.setTimePeriod(100); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java deleted file mode 100644 index 96491af9f..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestPerformanceData12Ethernet.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsPerformanceData; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceDataBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.historical.performances.g.HistoricalPerformanceDataListBuilder; - -public class TestPerformanceData12Ethernet { - - @Test - public void test1() { - PerformanceDataBuilder p = new PerformanceDataBuilder(); - p.setTimePeriod(1); - p.setTxEthernetBytesMaxM(2L); - p.setTxEthernetBytesMaxS(3); - p.setTxEthernetBytesSum(4L); - - HistoricalPerformanceDataListBuilder pmElement = new HistoricalPerformanceDataListBuilder(); - pmElement.setPerformanceData(p.build()); - - //EthernetContainerHistoricalPerformancesBuilder pmList = new EthernetContainerHistoricalPerformancesBuilder(); - //pmList.setHistoricalPerformanceDataList(Arrays.asList(pmElement.build())); - - EsPerformanceData pmData = new EsPerformanceData(pmElement.build()); - - assertTrue("Verify value", pmData.getEs() == null); - assertTrue("Verify value", pmData.getTxEthernetBytesSum() == 4L); - - System.out.println(pmData.toString()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java deleted file mode 100644 index d4353d9da..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsCapability.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.Model12ObjectMock; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; - -public class TestsCapability { - - private static NetconfNode nNode; - - @BeforeClass - public static void before() { - nNode = new Model12ObjectMock().getNetconfNode(); - } - - @Test - public void test1() { - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - assertTrue(capabilities.isSupportingNamespaceAndRevision(NetworkElement.QNAME)); - - } - - @Test - public void test2() { - - Capabilities capabilities = Capabilities.getAvailableCapabilities(nNode); - assertTrue(capabilities.isSupportingNamespaceAndRevision(WrapperMicrowaveModelRev170324.QNAME)); - - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java deleted file mode 100644 index b753ceb70..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/TestsNectconfDateTime.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test; - -import static org.junit.Assert.assertTrue; - -import java.util.Date; - -import org.junit.Test; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.test.util.NetconfTimeStampOld; - -public class TestsNectconfDateTime { - - private static String[] testPatterPostive = { - "2017-01-18T11:44:49.482-0500", - "2017-01-18T11:44:49.482-05:00", - "20170118114449.123Z", - "20170118114449.1Z", - "20170118114449.1-0500", - "2017-01-23T13:32:38-05:00", - "2017-01-23T13:32-05:00", - "2017-01-18T11:44:49Z" - }; - private static String[] testPatterProblem = { - "2017-01-18T11:44:49" - }; - - - private NetconfTimeStampOld netconfTimeConverterOld = NetconfTimeStampOld.getConverter(); - private NetconfTimeStamp netconfTimeConverterNew = NetconfTimeStamp.getConverter(); - - @Test - public void test1() { - - int t = 1; - String timeNew, timeOld; - for (String testTime : testPatterPostive) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconf(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconf(testTime); - - System.out.println("No "+(t++)+" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - - for (String testTime : testPatterProblem) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconf(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconf(testTime); - - System.out.println("No "+(t++)+" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - } - - @Test - public void test2() { - - int t = 1; - Long timeNew, timeOld; - for (String testTime : testPatterPostive) { - timeNew = netconfTimeConverterNew.getTimeStampFromNetconfAsMilliseconds(testTime); - timeOld = netconfTimeConverterOld.getTimeStampFromNetconfAsMilliseconds(testTime); - - System.out.println("No "+(t++)+" Pattern: "+testTime); - System.out.println(" to old "+timeOld); - System.out.println(" to new "+timeNew); - System.out.println(); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - } - - } - - - @Test - public void test3() { - - Date now = new Date(); - String timeNew = netconfTimeConverterNew.getTimeStampAsNetconfString(now); - String timeOld = netconfTimeConverterOld.getTimeStampAsNetconfString(now); - - System.out.println("Old/New: "+timeOld+"/"+timeNew); - - assertTrue("Old/New implementation not same "+timeOld+"/"+timeNew, timeOld.equals(timeNew)); - - - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java deleted file mode 100644 index 30b64817a..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/ClusterSingletonServiceProviderMock.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.test.mock; - -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration; - -public class ClusterSingletonServiceProviderMock implements ClusterSingletonServiceProvider { - - @Override - public void close() throws Exception { - - } - - @Override - public ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java deleted file mode 100644 index 34c5959bd..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerMountpointMock.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerMountpointMock implements DataBroker, BindingService { - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - @Override - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - @Override - public ReadOnlyTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public WriteTransaction newWriteOnlyTransaction() { - return null; - } - - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java deleted file mode 100644 index c9455cc9c..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/DataBrokerNetconfMock.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class DataBrokerNetconfMock implements DataBroker { - - - ReadOnlyTransaction readOnlyTransaction; - - public void setReadOnlyTransaction(ReadOnlyTransaction readOnlyTransaction) { - this.readOnlyTransaction = readOnlyTransaction; - } - - @Override - public > ListenerRegistration registerDataTreeChangeListener( - DataTreeIdentifier arg0, L arg1) { - return null; - } - - @Override - public BindingTransactionChain createTransactionChain(TransactionChainListener listener) { - return null; - } - - @Override - public ReadOnlyTransaction newReadOnlyTransaction() { - return readOnlyTransaction; - } - - @Override - public ReadWriteTransaction newReadWriteTransaction() { - return null; - } - - @Override - public WriteTransaction newWriteOnlyTransaction() { - return null; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java deleted file mode 100644 index f2065c622..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointMock.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.BindingService; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.network.topology.topology.topology.types.TopologyNetconf; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointMock implements MountPoint { - - private boolean databrokerAbsent = true; - private final DataBrokerMountpointMock dataBroker = new DataBrokerMountpointMock(); - private final RpcConsumerRegistryMock rpcConsumerRegistry = new RpcConsumerRegistryMock(); - private NotificationService setReadOnlyTransaction; - - private static final InstanceIdentifier NETCONF_TOPO_IID = - InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, - new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName()))); - - @Override - public InstanceIdentifier getIdentifier() { - return NETCONF_TOPO_IID; - } - - @SuppressWarnings("unchecked") - @Override - public Optional getService(Class service) { - - System.out.println("Requested mountpoint service: "+service.getSimpleName()+" databrokerAbsent state: "+databrokerAbsent); - - Optional res; - if (service.isInstance(dataBroker)) { - System.out.println("Delivering databroker"); - res = databrokerAbsent ? Optional.absent() : Optional.of(dataBroker); - } else if (service.isInstance(rpcConsumerRegistry)) { - System.out.println("Delivering RpcConsumerRegistryMock"); - res = Optional.of(rpcConsumerRegistry); - } else if (service.isInstance(setReadOnlyTransaction)) { - System.out.println("Delivering notificationService"); - res = Optional.of(setReadOnlyTransaction); - } else { - System.out.println("Delivering no service"); - res = Optional.absent(); - } - return (Optional)res; - } - - public void setDatabrokerAbsent( boolean state) { - this.databrokerAbsent = state; - } - - public void setReadOnlyTransaction(T readOnlyTransaction) { - this.setReadOnlyTransaction = readOnlyTransaction; - dataBroker.setReadOnlyTransaction(readOnlyTransaction); - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java deleted file mode 100644 index ebb501bc3..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/MountPointServiceMock.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class MountPointServiceMock implements MountPointService { - - private final MountPointMock mountpoint; - - public MountPointServiceMock(MountPointMock mountpoint) { - this.mountpoint = mountpoint; - } - - @Override - public Optional getMountPoint(InstanceIdentifier mountPoint) { - - Optional optional = Optional.of(mountpoint); - return optional; - } - - @Override - public ListenerRegistration registerListener(InstanceIdentifier path, - T listener) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java deleted file mode 100644 index 9099a4a87..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/NotificationPublishServiceMock.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.concurrent.TimeUnit; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.yangtools.yang.binding.Notification; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class NotificationPublishServiceMock implements NotificationPublishService { - - @Override - public ListenableFuture offerNotification(Notification notification) { - return null; - } - - @Override - public ListenableFuture offerNotification(Notification notification, int timeout, TimeUnit unit) - throws InterruptedException { - return null; - } - - @Override - public void putNotification(Notification notification) throws InterruptedException { - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java deleted file mode 100644 index 89864c2c5..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcConsumerRegistryMock.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt sdnr-wt-devicemanager-provider - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yangtools.yang.binding.RpcService; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class RpcConsumerRegistryMock implements RpcConsumerRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java deleted file mode 100644 index b95da853b..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/mock/RpcProviderRegistryMock.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.mock; - -import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.RpcService; - -@SuppressWarnings("deprecation") -public class RpcProviderRegistryMock implements RpcProviderRegistry { - - @Override - public T getRpcService(Class serviceInterface) { - return null; - } - - @Override - public >> ListenerRegistration registerRouteChangeListener( - L listener) { - return null; - } - - - @Override - public RoutedRpcRegistration addRoutedRpcImplementation(Class serviceInterface, - T implementation) throws IllegalStateException { - return null; - } - - @Override - public RpcRegistration addRpcImplementation(Class serviceInterface, T implementation) - throws IllegalStateException { - System.out.println("Register class "+serviceInterface); - return null; - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java deleted file mode 100644 index 4e46e1800..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/DBCleanServiceHelper.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.util.Date; -import java.util.concurrent.TimeUnit; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalSeverity; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.util.NetconfTimeStamp; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.DeviceManagerImpl; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.database.service.HtDatabaseEventsService; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ObjectCreationNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.database.types.EsEventOdluxLog; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.index.impl.IndexMwtnService; - -public class DBCleanServiceHelper { - - private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); - - private final HtDatabaseEventsService databaseEventService; - private final IndexMwtnService mwtnService; - - /** - * Helper to fill data into the database - * @param deviceManager devicemanger to get services - */ - public DBCleanServiceHelper(DeviceManagerImpl deviceManager) { - this.databaseEventService = deviceManager.getDatabaseClientEvents(); - this.mwtnService = deviceManager.getMwtnService(); - } - - /** - * Write data into database with specific date and content profile. - * @param number of data to be written for each log - * @param days starting day, relative to actual date - * @param hours starting hour ... increased by one hour for each write - * @return integer with the amount of written data - */ - public int writeDataToLogs(int number, int days, int hours) { - int res = 0; - for (Integer t=0; t < number; t++) { //Test "sdnevents", "eventlog" - ObjectCreationNotificationXml notificationXml = new ObjectCreationNotificationXml( - "Testpoint"+t, t.toString(), getInternalDateAndTime(days, hours+t), "ObjectId"+t); - databaseEventService.writeEventLog(notificationXml); - res++; - } - - for (Integer t=0; t < number; t++) { //Test "sdnevents", "faultlog" - ProblemNotificationXml fault = new ProblemNotificationXml( - "ProblemNode"+t, "Problemuuid", "Problemname", InternalSeverity.Major, t.toString(), getInternalDateAndTime(days, hours+t)); - databaseEventService.writeFaultLog(fault); - res++; - } - - for (Integer t=0; t < number; t++) { //Test "mwtn", "log" - EsEventOdluxLog odluxEvent = new EsEventOdluxLog("Odluxevent"+t, "Problemuuid", "Message", getInternalDateAndTime(days, hours+t)); - mwtnService.writeOdluxEventForTestpurpose(odluxEvent); - res++; - } - - return res; - } - - /************************************************************** - * Private section - */ - - private InternalDateAndTime getInternalDateAndTime(int days, int hours) { - Date actual = new Date(new Date().getTime() - TimeUnit.MILLISECONDS.convert(days, TimeUnit.DAYS) - TimeUnit.MILLISECONDS.convert(hours, TimeUnit.HOURS)); - InternalDateAndTime timeStamp = InternalDateAndTime.valueOf(NETCONFTIME_CONVERTER.getTimeStamp(actual)); - return timeStamp; - } - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java deleted file mode 100644 index 156aabdcb..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211ObjectMock.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev180907; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model1211ObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev180907.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // LTP/LP1 - /* - * LpBuilder lpBuilder1 = new LpBuilder(); lpBuilder1.withKey(new LpKey(new - * UniversalId("MwAirInterfacePacLpKey"))); lpBuilder1.setLayerProtocolName(new - * LayerProtocolName(ONFLayerProtocolName.MWAirInterface.getValue())); - * lpBuilder1.setExtension(Arrays.asList(getExtension("e1", "capability", - * MwAirInterfacePac.QNAME.getLocalName()), getExtension("e1", "revision", - * MwAirInterfacePac.QNAME.getRevision().get().toString()), getExtension("e1", - * "conditional-package", MwAirInterfacePac.QNAME.getModule().toString()))); LtpBuilder ltpBuilder1 - * = new LtpBuilder(); ltpBuilder1.setUuid(new UniversalId("MwAirInterfacePac")); - * ltpBuilder1.withKey(new LtpKey(new UniversalId("MwAirInterfacePacKey"))); - * ltpBuilder1.setLp(values) - */ - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, - ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, - ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, - ONFLayerProtocolName.Structure))); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public , PLB extends Builder> R getCurrentProblems(Class plbClazz, - Class rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java deleted file mode 100644 index 46b66aebc..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model1211pObjectMock.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= ONAP : ccsdk - * feature sdnr wt ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev181010; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model1211pObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev181010.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, - ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, - ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, - ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, - ONFLayerProtocolName.Structure))); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public , PLB extends Builder> R getCurrentProblems(Class plbClazz, - Class rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java deleted file mode 100644 index 9d7c0f3b0..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/Model12ObjectMock.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InternalDateAndTime; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.wrapperc.WrapperMicrowaveModelRev170324; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElementBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfaceDiversityPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwAirInterfacePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwEthernetContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwHybridMwStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwPureEthernetStructurePac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MwTdmContainerPac; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotification; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ProblemNotificationBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.SeverityType; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemListBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus.ConnectionStatus; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yangtools.concepts.Builder; - -public class Model12ObjectMock { - - public NetconfNode getNetconfNode() { - - AvailableCapabilitiesBuilder availableCapabilitiesBuilder = - ObjectBuilder.getAvailableCababilitiesList(NetworkElement.QNAME, WrapperMicrowaveModelRev170324.QNAME); - - NetconfNodeBuilder nNodeBuilder = new NetconfNodeBuilder(); - nNodeBuilder.setAvailableCapabilities(availableCapabilitiesBuilder.build()); - nNodeBuilder.setConnectionStatus(ConnectionStatus.Connected); - - // build - NetconfNode nNode = nNodeBuilder.build(); - return nNode; - } - - public NetworkElement getNetworkElement() { - - NetworkElementBuilder networkElementBuilder = new NetworkElementBuilder(); - - // ---- LTP List - networkElementBuilder.setLtp(Arrays.asList( - ObjectBuilder.getLtp(MwAirInterfacePac.class, MwAirInterfacePac.QNAME, ONFLayerProtocolName.MWAirInterface), - ObjectBuilder.getLtp(MwEthernetContainerPac.class, MwEthernetContainerPac.QNAME, - ONFLayerProtocolName.EthernetContainer12), - ObjectBuilder.getLtp(MwTdmContainerPac.class, MwTdmContainerPac.QNAME, ONFLayerProtocolName.TDMContainer), - ObjectBuilder.getLtp(MwHybridMwStructurePac.class, MwHybridMwStructurePac.QNAME, ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwAirInterfaceDiversityPac.class, MwAirInterfaceDiversityPac.QNAME, ONFLayerProtocolName.Structure), - ObjectBuilder.getLtp(MwPureEthernetStructurePac.class, MwPureEthernetStructurePac.QNAME, ONFLayerProtocolName.Structure) - )); - // build - NetworkElement networkElement = networkElementBuilder.build(); - return networkElement; - } - - public AirInterfaceCurrentProblems getMwAirInterfacePacCurrentProblems() { - /* - * CurrentProblemListBuilder currentProblemListBuilder = new CurrentProblemListBuilder(); - * currentProblemListBuilder.setProblemName("Problem1"); - * currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - * currentProblemListBuilder.setSequenceNumber(1); currentProblemListBuilder.setTimeStamp(new - * DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - * - * AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - * AirInterfaceCurrentProblemsBuilder(); - * airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder. - * build())); - * - * return airInterfaceCurrentProblemsBuilder.build(); - */ - return getCurrentProblems(CurrentProblemListBuilder.class, AirInterfaceCurrentProblemsBuilder.class); - } - - public , PLB extends Builder> R getCurrentProblems(Class plbClazz, - Class rbClazz) { - - try { - PLB currentProblemListBuilder = plbClazz.newInstance(); - - // currentProblemListBuilder.setProblemName("Problem1"); - Method setProblemName = plbClazz.getDeclaredMethod("setProblemName", String.class); - setProblemName.setAccessible(true); - setProblemName.invoke(currentProblemListBuilder, "Problem1"); - - // currentProblemListBuilder.setProblemSeverity(SeverityType.Critical); - Method setProblemSeverity = plbClazz.getDeclaredMethod("setProblemSeverity", SeverityType.class); - setProblemSeverity.setAccessible(true); - setProblemSeverity.invoke(currentProblemListBuilder, SeverityType.Critical); - - // currentProblemListBuilder.setSequenceNumber(1); - Method setSequenceNumber = plbClazz.getDeclaredMethod("setSequenceNumber", Integer.class); - setSequenceNumber.setAccessible(true); - setSequenceNumber.invoke(currentProblemListBuilder, 1); - - // currentProblemListBuilder.setTimeStamp(new - // DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - Method setTimeStamp = plbClazz.getDeclaredMethod("setTimeStamp", DateAndTime.class); - setTimeStamp.setAccessible(true); - setTimeStamp.invoke(currentProblemListBuilder, - new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - - // AirInterfaceCurrentProblemsBuilder airInterfaceCurrentProblemsBuilder = new - // AirInterfaceCurrentProblemsBuilder(); - Builder airInterfaceCurrentProblemsBuilder = rbClazz.newInstance(); - // airInterfaceCurrentProblemsBuilder.setCurrentProblemList(Arrays.asList(currentProblemListBuilder.build())); - Method setCurrentProblemList = rbClazz.getDeclaredMethod("setCurrentProblemList", List.class); - setCurrentProblemList.setAccessible(true); - setCurrentProblemList.invoke(airInterfaceCurrentProblemsBuilder, - Arrays.asList(currentProblemListBuilder.build())); - - return airInterfaceCurrentProblemsBuilder.build(); - } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException - | IllegalArgumentException | InvocationTargetException e) { - e.printStackTrace(); - return null; - } - } - - public ProblemNotification getProblemNotification() { - ProblemNotificationBuilder b = new ProblemNotificationBuilder(); - b.setProblem("ProblemNotification"); - b.setSeverity(SeverityType.Minor); - b.setCounter(2); - b.setObjectIdRef(new UniversalId("test")); - b.setTimeStamp(new DateAndTime(InternalDateAndTime.getTestpattern().getValue())); - return b.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java deleted file mode 100644 index b81d40d92..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/NetconfTimeStampOld.java +++ /dev/null @@ -1,285 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Function is handling the NETCONF and the format used by database and restconf communication. - * - * Input supported for the formats used in NETCONF messages: - * - * Format1 ISO 8601 2017-01-18T11:44:49.482-05:00 - * - * Format2 NETCONF - pattern from ietf-yang-types "2013-07-15" Pattern: - * "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-](\d{2}):(\d{2}))" - * - * Format3 NETCONF DateAndTime CoreModel-CoreFoundationModule-TypeDefinitions vom - * 2016-07-01 Example1: 20170118114449.1Z Example2: 20170118114449.1-0500 Pattern: - * "\d{4}\d{2}\d{2}\d{2}\d{2}\d{2}.\d+?(Z|[\+\-](\d{2})(\d{2}))" typedef DateAndTime { description - * "This primitive type defines the date and time according to the following structure: - * 'yyyyMMddhhmmss.s[Z|{+|-}HHMm]' where: yyyy '0000'..'9999' year MM '01'..'12' month dd '01'..'31' - * day hh '00'..'23' hour mm '00'..'59' minute ss '00'..'59' second s '.0'..'.9' tenth of second - * (set to '.0' if EMS or NE cannot support this granularity) Z 'Z' indicates UTC (rather than local - * time) {+|-} '+' or '-' delta from UTC HH '00'..'23' time zone difference in hours Mm '00'..'59' - * time zone difference in minutes."; type string; } Format4 E/// specific Example1: - * 2017-01-23T13:32:38-05:00 Example2: 2017-01-23T13:32-05:00 - * - * Input formats netconfTime as String according the formats given above - * - * Return format is String in ISO8601 Format for database and presentation. - * - * Example formats: - * 1) ISO8601. Example 2017-01-18T11:44:49.482-05:00 - * 2) Microwave ONF. Examples 20170118114449.1Z, 20170118114449.1-0500 - * 3.1) Ericson. Example: 2017-01-23T13:32:38-05:00 - * 3.2) Ericson. Example: 2017-01-23T13:32-05:00 - * Always 10 Groups, - * 1:Year 2:Month 3:day 4:Hour 5:minute 6:optional sec 7:optional ms 8:optional Z or 9:offset - * signedhour 10:min - * - * Template: - * private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStamp.getConverter(); - */ - -public class NetconfTimeStampOld { - private static final Logger LOG = LoggerFactory.getLogger(NetconfTimeStampOld.class); - - private static final NetconfTimeStampOld CONVERTER = new NetconfTimeStampOld(); - - private final SimpleDateFormat dateFormatResult = init("yyyy-MM-dd'T'HH:mm:ss.S'Z'", TimeZone.getTimeZone("GMT")); - private final SimpleDateFormat dateFormatConvert = init("yyyy-MM-dd HH:mm:ss.S", TimeZone.getTimeZone("GMT")); - private static int MILLISECONDSDIGITS = 3; // Digits of milliseconds in dateFormatResult - private static String MILLISECONDZEROS = "000"; // String with zeros for milliseconds in dateFormatResult - private static final Pattern dateNetconfPatter = Pattern.compile( - "(\\d{4})-?(\\d{2})-?(\\d{2})T?(\\d{2}):?(\\d{2})(?:(?::?)(\\d{2}))?(?:.(\\d+))?(?:(Z)|([+-]\\d{2}):?(\\d{2}))"); - - /* - * ------------------------------------ Public function - */ - - /** - * Use static access - */ - private NetconfTimeStampOld() { - } - - /** - * Use this function to get the converter - * @return global converter - */ - public static NetconfTimeStampOld getConverter() { - return CONVERTER; - } - - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - * - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - public String getTimeStampAsNetconfString() { - return this.getRightFormattedDate(new Date().getTime()); - } - - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format - - * @return String with Date in NETCONF/YANG Format Version 1.0. - */ - public String getTimeStampAsNetconfString(Date date) { - return getRightFormattedDate(date.getTime()); - } - /** - * Get actual timestamp as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - public DateAndTime getTimeStamp() { - return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString()); - } - - /** - * Get time from date as NETCONF specific type NETCONF/YANG 1.0 Format in GMT - * @param date specifying the date and time - * @return DateAndTime Type 1.0. Date in NETCONF/YANG Format Version 1.0. - */ - public DateAndTime getTimeStamp(Date date) { - return DateAndTime.getDefaultInstance(getTimeStampAsNetconfString(date)); - } - - - /** - * Return the String with a NETCONF time converted to long - * - * @param netconfTime as String according the formats given above - * @return Epoch milliseconds - * @throws IllegalArgumentException In case of no compliant time format definition for the string - * @throws ParseException Time parsing failed - */ - public long getTimeStampFromNetconfAsMilliseconds(String netconfTime) - throws IllegalArgumentException { - Matcher m = dateNetconfPatter.matcher(netconfTime); - // According to specified matches there have to be 10 parameter - if (m.matches() && m.groupCount() == 10) { - // Convert now - synchronized(dateFormatConvert) { - long utcMillis; - try { - utcMillis = dateFormatConvert.parse(getTimeAsNormalizedString(m, m.group(6), m.group(7))).getTime() - - getTimezoneOffsetMilliseconds(m.group(9), m.group(10)); - return utcMillis; - } catch (ParseException e) { - throw new IllegalArgumentException("Parse problem for NETCONF data string: " + netconfTime); - } - } - } else { - throw new IllegalArgumentException("No pattern for NETCONF data string: " + netconfTime); - } - } - - /** - * Deliver String result. - * - * @param netconfTime as String according the formats given above - * @return If successful: String in ISO8601 Format for database and presentation. If "wrong formed - * input" the Input string with the prefix "Mailformed date" is delivered back. - */ - public String getTimeStampFromNetconf(String netconfTime) { - Matcher m = dateNetconfPatter.matcher(netconfTime); - // According to spezified matches there have to be 10 parameter - if (m.matches() && m.groupCount() == 10) { - // Convert now - try { - synchronized(dateFormatConvert) { - long utcMillis = dateFormatConvert.parse(getTimeAsNormalizedString(m, m.group(6), m.group(7))).getTime() - - getTimezoneOffsetMilliseconds(m.group(9), m.group(10)); - return getRightFormattedDate(utcMillis); - } - } catch (ParseException e) { - LOG.info(e.getMessage()); - } catch (IllegalArgumentException e) { - LOG.info(e.getMessage()); - } - } - LOG.debug("No pattern for NETCONF data string: {}", netconfTime); - return "Malformed date: " + netconfTime; // Error handling - } - - /*------------------------------------------- - * Private and static functions - */ - /** - * Convert timeZone parameter in format [+-]/d/d:/d/d into milliseconds - * - * @param m Index 9 with "+/-" and hour string or null for UTZ, Index 10 with minutes - * @return long milliseconds of TimeZoneOffset - * @throws IllegalArgumentException If parameters are wrong - */ - private static long getTimezoneOffsetMilliseconds(String timeZoneHour, String timeZoneMinute) - throws IllegalArgumentException { - // -- Calculate timezone specific offset - long timeZoneOffsetMilliseconds = 0; - if (timeZoneHour != null) { - // Time zone offset in hours and minutes - int tzHour = 0; - int tzMinutes = 0; - tzHour = Integer.valueOf(timeZoneHour); - if (timeZoneMinute != null) { - tzMinutes = Integer.valueOf(timeZoneMinute); - } else { - throw new IllegalArgumentException("Problem in Netconf Time format timeZone minutes parameter."); - } - timeZoneOffsetMilliseconds = (tzHour * 60 + (tzHour > 0 ? tzMinutes : -tzMinutes)) * 60000L; - } - return timeZoneOffsetMilliseconds; - } - - /** - * Convert parameters to String with year .. minutes and optional Seconds and .. milliseconds - * - * @param m Matcher with parsed date - * @param secString Seconds as String or null - * @param msString Milliseconds as String or null - * @return Normalized time string - */ - private static String getTimeAsNormalizedString(Matcher m, String secString, String msString) { - // -- Create time as normalized string - StringBuffer sb = new StringBuffer(); - sb.append(m.group(1)); // year - sb.append('-'); - sb.append(m.group(2)); // Month - sb.append('-'); - sb.append(m.group(3)); // Day - sb.append(' '); - sb.append(m.group(4)); // Hour 0-23 - sb.append(':'); - sb.append(m.group(5)); // Minute - sb.append(':'); - sb.append(secString != null ? secString : "00"); // Seconds (optional) - sb.append('.'); - if (msString == null) { // Milliseconds optional - sb.append(MILLISECONDZEROS); - } else if (msString.length() <= MILLISECONDSDIGITS) { - sb.append(msString); // Millisecond - sb.append(MILLISECONDZEROS.substring(0, MILLISECONDSDIGITS - msString.length())); - } else { - sb.append(msString.substring(0, MILLISECONDSDIGITS)); // Only first Three - } - return sb.toString(); - } - - /** - * Deliver format in a way that milliseconds are correct. - * - * @param dateMillis Date as milliseconds in Java definition - * @return String - */ - private String getRightFormattedDate(long dateMillis) { - long tenthOfSeconds = dateMillis % 1000 / 100L; // Extract 100 milliseconds - long base = dateMillis / 1000L * 1000L; // Cut milliseconds to 000 - Date newDate = new Date(base + tenthOfSeconds); - synchronized(dateFormatResult) { - return dateFormatResult.format(newDate); - } - } - - /** - * Static initialization - */ - private static SimpleDateFormat init(String format, TimeZone zone) { - if (zone == null) { - throw new ExceptionInInitializerError(); - } else { - SimpleDateFormat dateFormat; - dateFormat = new SimpleDateFormat(format); - dateFormat.setTimeZone(zone); - return dateFormat; - } - } - - - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java deleted file mode 100644 index b2faa5667..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ObjectBuilder.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.ONFLayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.ExtensionBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpKey; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.Ltp; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.LtpBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.network.element.LtpKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.AvailableCapabilitiesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapability; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.connection.status.available.capabilities.AvailableCapabilityBuilder; -import org.opendaylight.yangtools.yang.common.QName; - -public class ObjectBuilder { - - static AvailableCapabilitiesBuilder getAvailableCababilitiesList(QName... qNames) { - return getAvailableCababilitiesList(null, qNames); - } - - static AvailableCapabilitiesBuilder getAvailableCababilitiesList(AvailableCapabilitiesBuilder valueBuilder, - QName... qNames) { - if (valueBuilder == null) { - valueBuilder = new AvailableCapabilitiesBuilder(); - } - List capabilites = new ArrayList<>(); - for (QName s : qNames) { - AvailableCapabilityBuilder capabilityBuilder = new AvailableCapabilityBuilder(); - capabilityBuilder.setCapability(s.toString()); - capabilites.add(capabilityBuilder.build()); - } - valueBuilder.setAvailableCapability(capabilites); - return valueBuilder; - } - - static Extension getExtension(String valueName, String value) { - ExtensionBuilder lpExtension = new ExtensionBuilder(); - lpExtension.setValueName(valueName); - lpExtension.setValue(value); - return lpExtension.build(); - } - - static Ltp getLtp(Class clazz, QName qname, ONFLayerProtocolName onflayerProtocolName) { - String baseName = clazz.getSimpleName(); - LpBuilder lpBuilder = new LpBuilder(); - lpBuilder.withKey(new LpKey(new UniversalId(baseName + "LpKey"))); - lpBuilder.setLayerProtocolName(new LayerProtocolName(onflayerProtocolName.getValue())); - lpBuilder.setExtension(Arrays.asList(getExtension("capability", qname.getNamespace().toString()), - getExtension("revision", qname.getRevision().get().toString()), - getExtension("conditional-package", qname.getLocalName()))); - - LtpBuilder ltpBuilder = new LtpBuilder(); - ltpBuilder.setUuid(new UniversalId(baseName)); - ltpBuilder.setLp(Arrays.asList(lpBuilder.build())); - ltpBuilder.withKey(new LtpKey(new UniversalId(baseName + "LtpKey"))); - return ltpBuilder.build(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java deleted file mode 100644 index 5dbffa3b2..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211Mock.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class ReadOnlyTransactionMountpoint1211Mock implements ReadOnlyTransaction, NotificationService { - - private final Model1211ObjectMock mock = new Model1211ObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model1211ObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - @Override - public CheckedFuture, ReadFailedException> read(LogicalDatastoreType store, - InstanceIdentifier path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.absent(); - } - - - CheckedFuture, ReadFailedException> res = new CheckedFuture, ReadFailedException>() { - - @Override - public void addListener(Runnable arg0, Executor arg1) {} - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - return false; - } - - @Override - public Optional get() throws InterruptedException, ExecutionException { - return res1; - } - - @Override - public Optional get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return null; - } - - @Override - public boolean isCancelled() { - return false; - } - - @Override - public boolean isDone() { - return false; - } - - @Override - public Optional checkedGet() throws ReadFailedException { - return res1; - } - - @Override - public Optional checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException { - return null; - } - - }; - return res; - - } - - - @Override - public void close() {} - - @Override - public ListenerRegistration registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification(mock.getProblemNotification()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java deleted file mode 100644 index 9b49c5b99..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint1211pMock.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class ReadOnlyTransactionMountpoint1211pMock implements ReadOnlyTransaction, NotificationService { - - private final Model1211pObjectMock mock = new Model1211pObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model1211pObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - @Override - public CheckedFuture, ReadFailedException> read(LogicalDatastoreType store, - InstanceIdentifier path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.absent(); - } - - - CheckedFuture, ReadFailedException> res = new CheckedFuture, ReadFailedException>() { - - @Override - public void addListener(Runnable arg0, Executor arg1) {} - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - return false; - } - - @Override - public Optional get() throws InterruptedException, ExecutionException { - return res1; - } - - @Override - public Optional get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return null; - } - - @Override - public boolean isCancelled() { - return false; - } - - @Override - public boolean isDone() { - return false; - } - - @Override - public Optional checkedGet() throws ReadFailedException { - return res1; - } - - @Override - public Optional checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException { - return null; - } - - }; - return res; - - } - - - @Override - public void close() {} - - @Override - public ListenerRegistration registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification(mock.getProblemNotification()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java deleted file mode 100644 index 45c0f3900..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ReadOnlyTransactionMountpoint12Mock.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * ONAP : ccsdk feature sdnr wt - * ================================================================================ - * Copyright (C) 2019 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.devicemanager.test.util; - -import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.NetworkElement; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.MicrowaveModelListener; -import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.NotificationListener; - -/** - * @author herbert - * - */ -@SuppressWarnings("deprecation") -public class ReadOnlyTransactionMountpoint12Mock implements ReadOnlyTransaction, NotificationService { - - private final Model12ObjectMock mock = new Model12ObjectMock(); - private MicrowaveModelListener modelListener; - - @Override - public Object getIdentifier() { - return null; - } - - public Model12ObjectMock getMock() { - return mock; - } - - @SuppressWarnings("unchecked") - @Override - public CheckedFuture, ReadFailedException> read(LogicalDatastoreType store, - InstanceIdentifier path) { - - System.out.println("READ: " + path + " Store: " + store); - - Optional res1; - - if (path.getTargetType().equals(Node.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetconfNode nNode = mock.getNetconfNode(); - NodeBuilder nodeBuilder = new NodeBuilder(); - nodeBuilder.addAugmentation(NetconfNode.class, nNode); - Node node = nodeBuilder.build(); - res1 = (Optional) Optional.of(node); - - } else if (path.getTargetType().equals(NetworkElement.class)) { - System.out.println("Deliver " + path.getTargetType()); - NetworkElement ne = mock.getNetworkElement(); - res1 = (Optional) Optional.of(ne); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblems.class)) { - // MwAirInterfacePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblems.class)) { - // MwHybridMwStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.hybrid.mw.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.hybrid.mw.structure.pac.HybridMwStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblems.class)) { - // MwAirInterfaceDiversityPac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.diversity.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.diversity.pac.AirInterfaceDiversityCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblems.class)) { - // MwPureEthernetStructurePac - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.pure.ethernet.structure.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.pure.ethernet.structure.pac.PureEthernetStructureCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblems.class)) { - //EthernetContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.ethernet.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.ethernet.container.pac.EthernetContainerCurrentProblemsBuilder.class)); - - } else if (path.getTargetType().equals( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblems.class)) { - // TdmContainerCurrentProblems - System.out.println("Deliver " + path.getTargetType()); - res1 = (Optional) Optional.of(mock.getCurrentProblems( - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.tdm.container.current.problems.g.CurrentProblemListBuilder.class, - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.tdm.container.pac.TdmContainerCurrentProblemsBuilder.class)); - - } else { - System.err.println("Nothing to deliver for" + path.getTargetType()); - res1 = Optional.absent(); - } - - - CheckedFuture, ReadFailedException> res = new CheckedFuture, ReadFailedException>() { - - @Override - public void addListener(Runnable arg0, Executor arg1) {} - - @Override - public boolean cancel(boolean mayInterruptIfRunning) { - return false; - } - - @Override - public Optional get() throws InterruptedException, ExecutionException { - return res1; - } - - @Override - public Optional get(long timeout, TimeUnit unit) - throws InterruptedException, ExecutionException, TimeoutException { - return null; - } - - @Override - public boolean isCancelled() { - return false; - } - - @Override - public boolean isDone() { - return false; - } - - @Override - public Optional checkedGet() throws ReadFailedException { - return res1; - } - - @Override - public Optional checkedGet(long arg0, TimeUnit arg1) throws TimeoutException, ReadFailedException { - return null; - } - - }; - return res; - - } - - @Override - public void close() {} - - @Override - public ListenerRegistration registerNotificationListener(T listener) { - this.modelListener = (MicrowaveModelListener)listener; - return null; - } - - - public void sendProblemNotification() { - System.out.println("Send out Problemnotification"); - modelListener.onProblemNotification(mock.getProblemNotification()); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java deleted file mode 100644 index 9a926fd64..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/test/util/ZipFile.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 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.devicemanager.test.util; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -public class ZipFile implements AutoCloseable { - - private final ZipOutputStream zos; - private final FileOutputStream fos; - - public ZipFile(String zipPath) throws FileNotFoundException { - fos = new FileOutputStream(zipPath); - zos = new ZipOutputStream(fos); - } - - public void addToZipFile(String fileName) throws FileNotFoundException, IOException { - - System.out.println("Writing '" + fileName + "' to zip file"); - - InputStream fis = ZipFile.class.getClassLoader().getResourceAsStream(fileName); - if (fis == null) { - throw new FileNotFoundException("Resource not found: " + fileName); - } - - ZipEntry zipEntry = new ZipEntry(fileName); - zos.putNextEntry(zipEntry); - byte[] bytes = new byte[1024]; - int length; - while ((length = fis.read(bytes)) >= 0) { - zos.write(bytes, 0, length); - } - zos.closeEntry(); - fis.close(); - } - - @Override - public void close() throws IOException { - zos.close(); - fos.close(); - } - -} diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties b/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties deleted file mode 100644 index 3e4da05b0..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/aaiclient.properties +++ /dev/null @@ -1,165 +0,0 @@ -### - -# ============LICENSE_START======================================================= - -# openECOMP : SDN-C - -# ================================================================================ - -# Copyright (C) 2017 AT&T 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========================================================= - -### - - - -# - -# Configuration file for A&AI Client - -# - - - -# - -# Certificate keystore and truststore - -# - -org.onap.ccsdk.sli.adaptors.aai.ssl.trust=/opt/logs/externals/data/stores/truststore.client.jks - -org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd=adminadmin - - - -org.onap.ccsdk.sli.adaptors.aai.ssl.key=/opt/logs/externals/data/stores/keystore.client.p12 - -org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=adminadmin - -org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=true - - - -org.onap.ccsdk.sli.adaptors.aai.application=SDNC - - - -#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int1.test.att.com:8443 - -org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-pwt3.ecomp.cci.att.com:8443 - - - -connection.timeout=60000 - -read.timeout=60000 - - - -# query - -org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v13/search/sdn-zone-query - -org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v13/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name} - -org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v13/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3 - - - -# named query - -org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query - - - -#update - -org.onap.ccsdk.sli.adaptors.aai.update=/aai/v13/actions/update - - - -# UBB Notify - -org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v13/actions/notify - -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} - -org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information - - - -# P-Interfaces - -org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces - -org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v13/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name} - - - -# VNF IMAGES - -org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v13/service-design-and-creation/vnf-images - -org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v13/service-design-and-creation/vnf-images/vnf-image/{att-uuid} - -org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} - - - -# service instance - -org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query=/aai/v13/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance - -org.onap.ccsdk.sli.adaptors.aai.path.service.instance=/aai/v13/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id} - - - -# VNF IMAGES QUERY - -org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v13/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} - - - -# - -# Formatting - -# - -org.onap.ccsdk.sli.adaptors.aai.param.format=filter=%s:%s - -org.onap.ccsdk.sli.adaptors.aai.param.vnf_type=vnf-type - -org.onap.ccsdk.sli.adaptors.aai.param.physical.location.id=physical-location-id - -org.onap.ccsdk.sli.adaptors.aai.param.service.type=service-type - - \ No newline at end of file diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf b/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf deleted file mode 100644 index 8489f0905..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/captured-akka.conf +++ /dev/null @@ -1,72 +0,0 @@ - -odl-cluster-data { - - akka { - loglevel = "" - remote { - netty.tcp { - hostname = "zltcdyh1arbc02.2f0377.dyh1a.tci.att.com" - port = 2550 - } - } - actor { - debug{ - autoreceive = on - lifecycle = on - unhandled = on - fsm = on - event-stream = on - } - } - cluster { - seed-nodes = ["akka.tcp://opendaylight-cluster-data@zltcdyh1arbc01.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1arbc02.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1arbc03.2f0377.dyh1a.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc01.f84e7a.dyh1b.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc02.f84e7a.dyh1b.tci.att.com:2550", "akka.tcp://opendaylight-cluster-data@zltcdyh1brbc03.f84e7a.dyh1b.tci.att.com:2550"] - seed-node-timeout = 15s - roles = ["member-2"] - - } - persistence { - journal-plugin-fallback { - circuit-breaker { - max-failures = 10 - call-timeout = 60s - reset-timeout = 30s - } - } - } - } -} - -odl-cluster-rpc { - - akka { - loglevel = "" - remote { - netty.tcp { - hostname = "zltcdyh1arbc02.2f0377.dyh1a.tci.att.com" - port = 2551 - } - } - actor { - debug{ - autoreceive = on - lifecycle = on - unhandled = on - fsm = on - event-stream = on - } - } - cluster { - seed-nodes = ["akka.tcp://odl-cluster-rpc@zltcdyh1arbc01.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1arbc02.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1arbc03.2f0377.dyh1a.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc01.f84e7a.dyh1b.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc02.f84e7a.dyh1b.tci.att.com:2551", "akka.tcp://odl-cluster-rpc@zltcdyh1brbc03.f84e7a.dyh1b.tci.att.com:2551"] - seed-node-timeout = 15s - } - persistence { - journal-plugin-fallback { - circuit-breaker { - max-failures = 10 - call-timeout = 60s - reset-timeout = 30s - } - } - } - } -} diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json b/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json deleted file mode 100644 index c7db70121..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/mediator-server.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "uri":"/mwtn/mediator-server/_query", - "method":"DELETE", - "body":{"query":{"match_all":{}}} - }, - - { - "uri":"/mwtn/mediator-server/1", - "method":"POST", - "body":{ - "id": 1, - "name": "internal mediatorserver", - "url": "http://192.168.178.89:7070" - - } - } -] diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties deleted file mode 100644 index eec5d3a4c..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,38 +0,0 @@ -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. - -# Default logging detail level for all instances of SimpleLogger. -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=info - -# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz". -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, the default logging detail level is used. -# org.slf4j.simpleLogger.log.xxx.yyy=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=debug -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info -org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info - -# Set to true if you want the current date and time to be included in output messages. -# Default is false, and will output the number of milliseconds elapsed since startup. -#org.slf4j.simpleLogger.showDateTime=false - -# The date and time format to be used in the output messages. -# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. -# If the format is not specified or is invalid, the default format is used. -# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. -#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z - -# Set to true if you want to output the current thread name. -# Defaults to true. -#org.slf4j.simpleLogger.showThreadName=true - -# Set to true if you want the Logger instance name to be included in output messages. -# Defaults to true. -#org.slf4j.simpleLogger.showLogName=true - -# Set to true if you want the last component of the name to be included in output messages. -# Defaults to false. -#org.slf4j.simpleLogger.showShortLogName=false diff --git a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties b/sdnr/wt/devicemanager/provider/src/test/resources/test.properties deleted file mode 100644 index de49c5893..000000000 --- a/sdnr/wt/devicemanager/provider/src/test/resources/test.properties +++ /dev/null @@ -1,55 +0,0 @@ -[dcae] -dcaeUserCredentials=admin:admin -dcaeUrl=off -dcaeHeartbeatPeriodSeconds=120 -dcaeTestCollector=no - -[aots] -userPassword=passwd -soapurladd=off -soapaddtimeout=10 -soapinqtimeout=20 -userName=user -inqtemplate=inqreq.tmpl.xml -assignedto=userid -addtemplate=addreq.tmpl.xml -severitypassthrough=critical,major,minor,warning -systemuser=user -prt-offset=1200 -soapurlinq=off -#smtpHost= -#smtpPort= -#smtpUsername= -#smtpPassword= -#smtpSender= -#smtpReceivers= - -[es] -esCluster=sendateodl5 -#time limit to keep increasing data in database [in seconds] -#60*60*24*30 (30days) -esArchiveLimit=2592000 -#folder where removed data will be stored -esArchiveFolder=./backup -#interval to archive database [in seconds] -#60*60*24 (1day) -esArchiveInterval=86400 - -[aai] -#keep comment -aaiHeaders=["X-TransactionId: 9999"] -aaiUrl=http://localhost:81 -aaiUserCredentials=AAI:AAI -aaiDeleteOnMountpointRemove=false -aaiTrustAllCerts=false -aaiApiVersion=aai/v13 -aaiPropertiesFile=aaiclient.properties -aaiApplicationId=SDNR -aaiPcks12ClientCertFile=/opt/logs/externals/data/stores/keystore.client.p12 -aaiPcks12ClientCertPassphrase=adminadmin -aaiClientConnectionTimeout=30000 - -[pm] -pmCluster=sendateodl5 -pmEnabled=true - -- cgit 1.2.3-korg