import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.onap.aaf.cadi.cm.CmAgent;
+import org.onap.aaf.cadi.configure.Agent;
public class JU_CmAgent {
- private static final String resourceDirString = "src/test/resources";
- private static final String aafDir = resourceDirString + "/aaf";
-
- private ByteArrayInputStream inStream;
-
- @Before
- public void setup() {
- System.setProperty("user.home", aafDir);
-
- // Simulate user input
- inStream = new ByteArrayInputStream("test\nhttp://example.com\nhttp://example.com".getBytes());
- System.setIn(inStream);
- }
-
- @After
- public void tearDown() {
- recursiveDelete(new File(aafDir));
- }
-
- @Test
- public void test() {
- String[] args;
- args = new String[] {
- "-login",
- "-noExit",
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "place",
- "-noExit",
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "create"
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "read"
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "copy"
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "update"
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "delete"
- };
- CmAgent.main(args);
-
- inStream.reset();
- args = new String[] {
- "-noExit",
- "showpass"
- };
- CmAgent.main(args);
-
- }
-
- private void recursiveDelete(File file) {
- for (File f : file.listFiles()) {
- if (f.isDirectory()) {
- recursiveDelete(f);
- }
- f.delete();
- }
- file.delete();
- }
+ private static final String resourceDirString = "src/test/resources";
+ private static final String aafDir = resourceDirString + "/aaf";
+
+ private ByteArrayInputStream inStream;
+
+ @Before
+ public void setup() {
+ System.setProperty("user.home", aafDir);
+
+ // Simulate user input
+ inStream = new ByteArrayInputStream("test\nhttp://example.com\nhttp://example.com".getBytes());
+ System.setIn(inStream);
+ }
+
+ @After
+ public void tearDown() {
+ recursiveDelete(new File(aafDir));
+ }
+
+ @Test
+ public void test() {
+ String[] args;
+ args = new String[] {
+ "-login",
+ "-noExit",
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "place",
+ "-noExit",
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "create"
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "read"
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "copy"
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "update"
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "delete"
+ };
+ Agent.main(args);
+
+ inStream.reset();
+ args = new String[] {
+ "-noExit",
+ "showpass"
+ };
+ Agent.main(args);
+
+ }
+
+ private void recursiveDelete(File file) {
+ for (File f : file.listFiles()) {
+ if (f.isDirectory()) {
+ recursiveDelete(f);
+ }
+ f.delete();
+ }
+ file.delete();
+ }
}