Ejemplo n.º 1
0
 @Test
 public void testCd() {
   String commandline = "cd .. | echo";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f2, null);
   String expectedOutput = "";
   assertEquals(expectedOutput, output);
 }
Ejemplo n.º 2
0
 @Test
 public void testCd2() {
   String commandline = "cd " + f2 + "| echo this is test";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "this is test";
   assertEquals(expectedOutput, output);
 }
Ejemplo n.º 3
0
 @Test
 public void testEcho2() {
   String commandline = "echo | echo repeat";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "repeat";
   assertEquals(expectedOutput, output);
 }
Ejemplo n.º 4
0
 @Test
 public void testPwd2() {
   String commandline = "pwd rubbishvalue | echo " + f1.getAbsolutePath();
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = f1.getAbsolutePath();
   assertEquals(expectedOutput, output);
 }
Ejemplo n.º 5
0
 @Test
 public void testCopy() {
   String commandline = "copy  | echo 1234";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "1234";
   assertEquals(expectedOutput, output);
 }
Ejemplo n.º 6
0
 @Test
 public void testCd2() {
   String commandline = "cd " + f2 + "| move " + file1 + " " + file2;
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   pipingTool.execute(f1, null);
   assertFalse(file1.exists());
   assertTrue(file2.exists());
 }
Ejemplo n.º 7
0
 @Test
 public void testMove() {
   String commandline = "move " + file1 + " " + f1 + "| echo this is test";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "this is test";
   assertEquals(expectedOutput, output);
   file1.mkdir();
 }
Ejemplo n.º 8
0
 @Test
 public void testDelete2() {
   String commandline = "delete testFolder2 | echo";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f1, null);
   String expectedOutput = "";
   assertEquals(expectedOutput, output);
   f2.mkdirs();
 }
Ejemplo n.º 9
0
 @Test
 public void testDelete() {
   String commandline = "delete " + file1 + "| echo -";
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   String output = pipingTool.execute(f3, null);
   String expectedOutput = "-";
   assertEquals(expectedOutput, output);
   file1.mkdir();
 }
Ejemplo n.º 10
0
 @Test
 public void testDelete2() {
   String commandline = "delete testFolder2 | move " + file1 + " " + file2;
   PipingTool pipingTool = new PipingTool(commandline.split("\\|"));
   pipingTool.execute(f1, null);
   assertFalse(file1.exists());
   assertTrue(file2.exists());
   f2.mkdirs();
 }