diff options
author | Bogumil Zebek <bogumil.zebek@nokia.com> | 2019-10-07 08:11:34 +0200 |
---|---|---|
committer | Zebek Bogumil <bogumil.zebek@nokia.com> | 2019-10-21 12:16:06 +0200 |
commit | c7df5f53e2d525230170dc818572883de0bdf2ca (patch) | |
tree | 552b302141fc5183c39c17f82627005b3b3d2e53 /sdnr/wt/devicemanager/provider/src/test | |
parent | a6557cbba03576e7593160fd2a6abe68f0af86b3 (diff) |
Improve code quality
Issue-ID: CCSDK-1808
Signed-off-by: Zebek Bogumil <bogumil.zebek@nokia.com>
Change-Id: I004557c67b3440c41c00b6bf1a13e723f3ded0e4
Diffstat (limited to 'sdnr/wt/devicemanager/provider/src/test')
2 files changed, 142 insertions, 0 deletions
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 new file mode 100644 index 000000000..cc4a43677 --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/aaiconnector/impl/URLParamEncoderTest.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * ============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 new file mode 100644 index 000000000..538dcd47a --- /dev/null +++ b/sdnr/wt/devicemanager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/base/netconf/container/AllPmTest.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * ============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<EsHistoricalPerformance15Minutes> pm15size = allPm.getPm15(); + final List<EsHistoricalPerformance24Hours> 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<EsHistoricalPerformance15Minutes> pm15size = allPm.getPm15(); + final List<EsHistoricalPerformance24Hours> 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); + } + + +} |