@@ -103,7 +103,7 @@ public void testCheckAlertLog() throws JSchException, IOException {
103103 alc .setReadLine (10 );
104104 alc .setReadFilePath ("C:\\ alert_DKYDB.log" );
105105
106- String command = String .format ("Get-Content %s -Tail %d " , alc .getReadFilePath (), alc .getReadLine ());
106+ String command = String .format ("tail %d %s " , alc .getReadLine (), alc .getReadFilePath ());
107107 when (jschServer .executeCommand (command )).thenReturn (alertLogString );
108108
109109 // Act
@@ -123,7 +123,7 @@ public void testCheckAlertLogDuringPeriod() throws JSchException, IOException {
123123 String command1 = String .format ("find /v /c \" \" %s" , alc .getReadFilePath ());
124124 when (jschServer .executeCommand (command1 )).thenReturn (String .valueOf (alertLogLines .length ));
125125
126- String command2 = String .format ("Get-Content %s -Tail %d " , alc .getReadFilePath (), alc .getReadLine ());
126+ String command2 = String .format ("tail %d %s " , alc .getReadLine (), alc .getReadFilePath ());
127127 when (jschServer .executeCommand (command2 )).thenReturn (alertLogString );
128128
129129 // Act
@@ -144,14 +144,14 @@ public void testCheckAlertLogDuringPeriod_ReadLineBiggerThenTotalLineCnt() throw
144144 String command1 = String .format ("find /v /c \" \" %s" , alc .getReadFilePath ());
145145 when (jschServer .executeCommand (command1 )).thenReturn ("26" );
146146
147- String command2 = String .format ("Get-Content %s -Tail %d " , alc .getReadFilePath (), alc .getReadLine ());
147+ String command2 = String .format ("tail %d %s " , alc .getReadLine (), alc .getReadFilePath ());
148148 StringBuilder builder = new StringBuilder ();
149149 for (int i = 0 ; i < Math .min (alertLogLines .length , alc .getReadLine ()); i ++) {
150150 builder .append (alertLogLines [i ]).append ("\n " );
151151 }
152152 when (jschServer .executeCommand (command2 )).thenReturn (builder .toString ());
153153
154- String command3 = String .format ("Get-Content %s -Tail %d " , alc .getReadFilePath () , alc .getReadLine () * 2 );
154+ String command3 = String .format ("tail %d %s " , alc .getReadLine () * 2 , alc .getReadFilePath () );
155155 builder = new StringBuilder ();
156156 for (int i = 0 ; i < Math .min (alertLogLines .length , alc .getReadLine () * 2 ); i ++) {
157157 builder .append (alertLogLines [i ]).append ("\n " );
0 commit comments