Package org.uengine.telnet

Examples of org.uengine.telnet.TelnetNormalModule


                  timeouts[k] = timeout;
                  resultCommands[k] = resultCommand;

                }
               
                TelnetNormalModule telnetNormalModule = new TelnetNormalModule();
                telnetNormalModule.setHost(hostName, port);
                telnetNormalModule.setSessionTimeout(sessionTimeout);
                telnetNormalModule.setWaitFor(waitFors);
                telnetNormalModule.setCommand(commands);
                telnetNormalModule.setTimeout(timeouts);
                telnetNormalModule.setServerType(serverType);
                telnetNormalModule.start();

                String resultTotalStr = telnetNormalModule.getTotalResultString();
                ArrayList resultStringList = telnetNormalModule.getResultStringList();
               
                if (UEngineUtil.isNotEmpty(resultTotalStr)) {
                  try {
                    bw = new BufferedWriter(new FileWriter(TEMP_DIRECTORY + File.separatorChar + instance.getInstanceId() + "."
                        + tracingTag + "." + eventParentDivName + "." + eventDivName + ".totalResult.log"));
                    bw.write(resultTotalStr);
                    bw.close();
                  } catch (Exception e) {
                    e.printStackTrace();
                  } finally {
                    if (bw != null) try { bw.close(); } catch (Exception e) { }
                  }
                }
                for (int k = 0; k < telnetNormalModule.getResultStringList().size(); k++) {
                  String result = (String) telnetNormalModule.getResultStringList().get(k);
                  if (result.lastIndexOf("\r\n") != -1) {
                    result = result.substring(0, result.lastIndexOf("\r\n"));
                  } else if (result.lastIndexOf("\n") != -1) {
                    result = result.substring(0, result.lastIndexOf("\n"));
                  }
                  result = result.replace(" ", "");
                 
                  if (UEngineUtil.isNotEmpty(result)) {
                    try {
                      bw = new BufferedWriter(new FileWriter(TEMP_DIRECTORY + File.separatorChar + instance.getInstanceId() + "."
                          + tracingTag + "." + eventParentDivName + "." + eventDivName + "." + k + "."
                          + URLEncoder.encode(waitFors[k], "UTF-8") + ".log"));
                      bw.write(result);
                      bw.close();
                    } catch (Exception e) {
                      e.printStackTrace();
                    } finally {
                      if (bw != null) try { bw.close(); } catch (Exception e) { }
                    }
                  }
                }

                if (totalResult != null) {
                  if (instance.getProcessDefinition().getProcessVariable(totalResult.getName()) != null) {
                    instance.set("", totalResult.getName(), resultTotalStr);
                  }
                }
                for (int k = 0; k < resultStringList.size(); k++) {
                  if (resultCommands[k] != null) {
                    if (instance.getProcessDefinition().getProcessVariable(resultCommands[k].getName()) != null) {
                      String resultStr = (String) resultStringList.get(k);
                      instance.set("", resultCommands[k].getName(), resultStr);
                    }
                  }
                }
               
                if (telnetNormalModule.isTimeoutExit() == true) {
                  isSuccess = false;
                  break;
                }
               
              }  // if (telnetCommands != null && telnetCommands.length > 0)
View Full Code Here

TOP

Related Classes of org.uengine.telnet.TelnetNormalModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.