aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/test')
-rw-r--r--framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java23
-rw-r--r--framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java14
2 files changed, 35 insertions, 2 deletions
diff --git a/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java b/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java
index 5d83374c..741b53a1 100644
--- a/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/cmd/execution/OnapCommandExceutionShowCommandTest.java
@@ -25,7 +25,10 @@ import org.onap.cli.fw.store.OnapCommandExecutionStoreTest;
import java.io.File;
import java.util.List;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import mockit.Mock;
+import mockit.MockUp;
+import org.onap.cli.fw.store.OnapCommandExecutionStore;
public class OnapCommandExceutionShowCommandTest {
@BeforeClass
@@ -46,7 +49,23 @@ public static void setUp() throws Exception {
assertTrue(oclipCommandResultAttributes.size() > 1);
}
-
+ @Test
+ public void runTestForStringBuilder() throws OnapCommandException {
+ new MockUp<OnapCommandExecutionStore.Execution>(){
+ @Mock
+ public String getOutput() {
+ return "oclip-request-output";
+ }
+ };
+ OnapCommandExceutionShowCommand cmd=new OnapCommandExceutionShowCommand();
+ cmd.initializeSchema("execution-show.yaml");
+ cmd.getParametersMap().get("execution-id").setValue("requestId");
+ cmd.getParametersMap().get("format").setValue("TEXT");
+ cmd.execute();
+ List<OnapCommandResultAttribute> oclipCommandResultAttributes = cmd.getResult()
+ .getRecords();
+ assertTrue(oclipCommandResultAttributes.size() > 1);
+ }
@AfterClass
public static void tearDown() throws Exception {
String dirPathForExecutions = System.getProperty("user.dir") + File.separator + "data/executions";
diff --git a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
index 9c31747b..e01c3878 100644
--- a/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
+++ b/framework/src/test/java/org/onap/cli/fw/utils/OnapCommandUtilsTest.java
@@ -132,6 +132,20 @@ public class OnapCommandUtilsTest {
}
@Test
+ public void replaceLineFromResultsTest() {
+ String replacedLine = OnapCommandUtils.replaceLineFromResults("line", new HashMap<>());
+ assertEquals("line", replacedLine);
+ replacedLine = OnapCommandUtils.replaceLineFromResults("${}", new HashMap<>());
+ assertEquals("${}", replacedLine);
+ replacedLine = OnapCommandUtils.replaceLineFromResults("$r{}", new HashMap<>());
+ assertTrue( replacedLine.isEmpty());
+ HashMap<String, String> values = new HashMap<>();
+ values.put("This is test line","This is test line");
+ replacedLine = OnapCommandUtils.replaceLineFromResults("$r{This is test line}", values);
+ assertEquals("This is test line", replacedLine);
+ }
+
+ @Test
public void replaceLineForSpecialValues_replacingUuid() {
String replacedLine = OnapCommandUtils.replaceLineForSpecialValues("$s{uuid}");