diff options
author | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-02-21 15:24:46 +0100 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-02-22 16:02:32 -0500 |
commit | 7353bcd8f2b85a50720b7cc7ca04c837c7b1796a (patch) | |
tree | 92a9c90b5852b3aea04da1526b5f81a1ec1b4223 /appc-directed-graph/dg-loader/provider/src/test | |
parent | 78cc8df2d203e32296e15e5564d9f809734c2e26 (diff) |
DGXML classes refactoring
Did some refactor in org.onap.sdnc.dg.loader package in order to reduce code duplication
Change-Id: I5c063487046c7ff72042d067213ea3d639a37227
Issue-ID: APPC-655
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'appc-directed-graph/dg-loader/provider/src/test')
-rw-r--r-- | appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java | 69 | ||||
-rw-r--r-- | appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivator.java (renamed from appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java) | 4 | ||||
-rw-r--r-- | appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java | 35 | ||||
-rw-r--r-- | appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoader.java (renamed from appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java) | 4 |
4 files changed, 17 insertions, 95 deletions
diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java index ea83213fc..a0ce3fac7 100644 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/DGLoaderTest.java @@ -44,7 +44,7 @@ public class DGLoaderTest { // Generate, GenerateLoad, GenerateLoadActivate String[] args = new String[] {"src/test/resources/json", "src/test/resources/xml"}; // logger.info("DGXML Conversion Started with arguments :"+ args[0] +":"+ args[1]); - if (args != null && args.length >= 2) { + if (args.length >= 2) { jsonPath = args[0]; xmlPath = args[1]; } @@ -52,8 +52,7 @@ public class DGLoaderTest { application.generateXMLFromJSON(jsonPath, xmlPath, propertyPath); File dir = new File("src/test/resources/xml"); String extensions[] = new String[] {"xml", "XML"}; - List<File> files = new ArrayList<File>(); - files = (List<File>) FileUtils.listFiles(dir, extensions, true); + List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true); assertNotNull(files.get(0)); assertNotNull(files.get(0).getName()); } @@ -64,8 +63,7 @@ public class DGLoaderTest { DGXMLGenerator.main(args); File dir = new File("src/test/resources/xml"); String extensions[] = new String[] {"xml", "XML"}; - List<File> files = new ArrayList<File>(); - files = (List<File>) FileUtils.listFiles(dir, extensions, true); + List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true); assertNotNull(files.get(0)); assertNotNull(files.get(0).getName()); } @@ -74,7 +72,7 @@ public class DGLoaderTest { public void testDGLoader() throws Exception { String propertyPath = "src/test/resources/dummy.properties"; String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); + DGXMLLoader dgXMLLoad = new MockDGXMLLoader(); dgXMLLoad.loadDGXMLFile(xmlPath); } @@ -82,7 +80,7 @@ public class DGLoaderTest { public void testDGLoaderWithDir() throws Exception { String propertyPath = "src/test/resources/dummy.properties"; String xmlPath = "src/test/resources/xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); + DGXMLLoader dgXMLLoad = new MockDGXMLLoader(); Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir", xmlPath); } @@ -90,16 +88,16 @@ public class DGLoaderTest { public void testDGLoaderWithDirThrowsException() throws Exception { String propertyPath = "src/test/resources/dummy.properties"; String xmlPath = "src/test/resources/xml/xml"; - DGXMLLoad dgXMLLoad = new MockDGXMLLoad(); - Whitebox.invokeMethod(dgXMLLoad, "loadDGXMLDir", xmlPath); + DGXMLLoader dgXMLLoader = new MockDGXMLLoader(); + Whitebox.invokeMethod(dgXMLLoader, "loadDGXMLDir", xmlPath); } @Test public void testDGActivate() throws Exception { String propertyPath = "src/test/resources/dummy.properties"; String activateFilePath = "src/test/resources/dg_activate_test"; - DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); - dgXMLActivate.activateDg(activateFilePath); + DGXMLActivator dgXMLActivator = new MockDGXMLActivator(); + dgXMLActivator.activateDg(activateFilePath); } @@ -107,43 +105,9 @@ public class DGLoaderTest { public void testDGActivateThrowsException() throws Exception { String propertyPath = "src/test/resources/dummy.properties"; String activateFilePath = "src/test/resources/someFile"; - DGXMLActivate dgXMLActivate = new MockDGXMLActivate(); - dgXMLActivate.activateDg(activateFilePath); - - } + DGXMLActivator dgXMLActivator = new MockDGXMLActivator(); + dgXMLActivator.activateDg(activateFilePath); - @Test - public void testDGLoadNActivate() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/dg_activate_test"; - String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - dgXMLLoadNActivate.loadDGXMLFile(xmlPath); - dgXMLLoadNActivate.activateDg(activateFilePath); - } - - @Test - public void testDGLoadNActivateThrowsException() throws Exception { - String propertyPath = "src/test/resources/dummy.properties"; - String activateFilePath = "src/test/resources/someFile"; - String xmlPath = "src/test/resources/xml/Appc_UniTest.xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - dgXMLLoadNActivate.loadDGXMLFile(xmlPath); - dgXMLLoadNActivate.activateDg(activateFilePath); - } - - @Test - public void testDGLoadNActivateloadDGXMLDir() throws Exception { - String xmlPath = "src/test/resources/xml"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - Whitebox.invokeMethod(dgXMLLoadNActivate, "loadDGXMLDir", xmlPath); - } - - - public void testDGLoadNActivateloadDGXMLDirThrowsException() throws Exception { - String xmlPath = "src/test/resources/someDir"; - DGXMLLoadNActivate dgXMLLoadNActivate = new MockDGXMLLoadNActivate(); - Whitebox.invokeMethod(dgXMLLoadNActivate, "loadDGXMLDir", xmlPath); } @Test @@ -158,19 +122,12 @@ public class DGLoaderTest { @Test(expected = Exception.class) public void testDGActivateConstructorThrowsException() throws Exception { String somePath = ""; - DGXMLActivate dgXMLActivate = new DGXMLActivate(somePath); + DGXMLActivator dgXMLActivator = new DGXMLActivator(somePath); } @Test(expected = Exception.class) public void testDGXMLLoadConstructorThrowsException() throws Exception { String somePath = ""; - DGXMLLoad dgXMLLoad = new DGXMLLoad(somePath); - } - - @Test(expected = Exception.class) - public void testDGLoadNActivateConstructorThrowsException() throws Exception { - String somePath = ""; - DGXMLLoadNActivate dgXMLLoadNActivate = new DGXMLLoadNActivate(somePath); + DGXMLLoader dgXMLLoader = new DGXMLLoader(somePath); } - } diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivator.java index 09de23285..4e0a74b17 100644 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivate.java +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLActivator.java @@ -26,10 +26,10 @@ package org.onap.sdnc.dg.loader; import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -public class MockDGXMLActivate extends DGXMLActivate { +public class MockDGXMLActivator extends DGXMLActivator { private final static SvcLogicStore storeChild = MockSvcLogicFactory.getMockSvcLogicStore();; - MockDGXMLActivate() throws Exception { + MockDGXMLActivator() throws Exception { super(storeChild); } diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java deleted file mode 100644 index dd3590a78..000000000 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoadNActivate.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.onap.sdnc.dg.loader; - -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; - -public class MockDGXMLLoadNActivate extends DGXMLLoadNActivate { - private final static SvcLogicStore storeChild = MockSvcLogicFactory.getMockSvcLogicStore();; - - MockDGXMLLoadNActivate() throws Exception { - super(storeChild); - } -} diff --git a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoader.java index bbca6af6d..37f1aa15f 100644 --- a/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoad.java +++ b/appc-directed-graph/dg-loader/provider/src/test/java/org/onap/sdnc/dg/loader/MockDGXMLLoader.java @@ -26,11 +26,11 @@ package org.onap.sdnc.dg.loader; import org.onap.ccsdk.sli.core.sli.SvcLogicStore; -public class MockDGXMLLoad extends DGXMLLoad { +public class MockDGXMLLoader extends DGXMLLoader { private final static SvcLogicStore storeChild = MockSvcLogicFactory.getMockSvcLogicStore();; - MockDGXMLLoad() throws Exception { + MockDGXMLLoader() throws Exception { super(storeChild); } |