aboutsummaryrefslogtreecommitdiffstats
path: root/appc-config/appc-config-adaptor/provider/src/test/java/org
diff options
context:
space:
mode:
authorJoss Armstrong <joss.armstrong@ericsson.com>2019-03-01 12:34:01 +0000
committerJoss Armstrong <joss.armstrong@ericsson.com>2019-03-01 12:40:15 +0000
commit5d185ed733c897df1e5d51285b5941a780fe6520 (patch)
treede5eeb48125e8d467c5b379930be1c477bbbabc3 /appc-config/appc-config-adaptor/provider/src/test/java/org
parenta9128f1964d43842056ea72dc1f0a8f3702cc03c (diff)
Test coverage in ConfigComponentAdaptor
Increased coverage from 79% to 89% Fixed indentation Issue-ID: APPC-1497 Change-Id: I9cee309b916eff93887a8d2b7691f9a7c6ba204b Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-config/appc-config-adaptor/provider/src/test/java/org')
-rw-r--r--appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java b/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java
index a947f19fa..e798c65f6 100644
--- a/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java
+++ b/appc-config/appc-config-adaptor/provider/src/test/java/org/onap/appc/ccadaptor/ConfigComponentAdaptorTest.java
@@ -362,6 +362,31 @@ public class ConfigComponentAdaptorTest {
assertEquals("500", ctx.getAttribute("error-code"));
}
+ /**
+ * Test method to add coverage to buildNetworkData2(..) and expandRepeats(..) methods in
+ * ConfigComponentAdaptor by inputting a more complex XML document
+ */
+ @Test
+ public void testPrepareComplexTemplate() {
+ Client mockClient = Mockito.mock(Client.class);
+ WebResource mockWebResource = Mockito.mock(WebResource.class);
+ ClientResponse mockClientResponse = Mockito.mock(ClientResponse.class);
+ ConfigComponentAdaptor cca = Mockito.spy(new ConfigComponentAdaptor(null));
+ Mockito.doReturn(mockClientResponse).when(cca).getClientResponse(Mockito.anyObject(),
+ Mockito.anyString(), Mockito.anyString());
+ Mockito.doReturn(mockWebResource).when(mockClient).resource(Mockito.anyString());
+ Mockito.doReturn(mockClient).when(cca).getClient();
+ String complexTemplateString = cca.readFile("/prepare.xml");
+ Mockito.when(cca.readFile(Mockito.anyString())).thenReturn(complexTemplateString);
+ Map<String, String> parameters = new HashMap<>();
+ parameters.put("action", "prepare");
+ SvcLogicContext ctx = new SvcLogicContext();
+ ctx.setAttribute(
+ "service-data.vnf-config-parameters-list.vnf-config-parameters[0].update-configuration[0].block-key-name",
+ "test");
+ assertEquals(ConfigStatus.SUCCESS, cca.configure("", parameters, ctx));
+ }
+
@Test
public void testAudit() {
Client mockClient = Mockito.mock(Client.class);