Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java =================================================================== RCS file: /usr/local/cvsroot/TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java,v diff -u -r1.1 -r1.2 --- TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java 31 Jul 2006 02:04:30 -0000 1.1 +++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java 4 Aug 2006 00:47:42 -0000 1.2 @@ -118,7 +118,7 @@ } /** - * need add CallRecord to TestReport + * need add CallRecord to TestReporter */ public Object execute(){ switch(test.callType){ @@ -215,10 +215,8 @@ } private boolean isCancelButton(SubmitButton button) { - if(button.getName().contains("CANCEL")||button.getName().contains("Cancel")||button.getName().contains("cancel") - ||button.getValue().contains("cancel")||button.getValue().contains("Cancel")||button.getValue().contains("CANCEL")) - return true; - return false; + return button.getName().contains("CANCEL")||button.getName().contains("Cancel")||button.getName().contains("cancel") + ||button.getValue().contains("cancel")||button.getValue().contains("Cancel")||button.getValue().contains("CANCEL"); } /** Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestReporter.java =================================================================== RCS file: /usr/local/cvsroot/TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestReporter.java,v diff -u -r1.1 -r1.2 --- TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestReporter.java 31 Jul 2006 02:04:30 -0000 1.1 +++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestReporter.java 4 Aug 2006 00:47:42 -0000 1.2 @@ -22,6 +22,12 @@ */ package org.lamsfoundation.testharness; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.LineNumberReader; +import java.util.ArrayList; import java.util.LinkedList; import java.util.List; @@ -132,8 +138,46 @@ public static void generateReport(AbstractTestManager manager) { report(manager); log.info("Generating the formal test report document..."); - //TODO implement me log.info("Sorry, this feature is not ready yet. It should come soon."); } + private static class TemplateCompiler{ + static String loadAndCompile() throws IOException{ + StringBuilder result = new StringBuilder(); + LineNumberReader lnReader = new LineNumberReader(new FileReader(fileTemplate)); + String line = lnReader.readLine(); + while (line != null){ + List block = new ArrayList(); + int statementIdx = line.indexOf("<#"); + int elIdx = line.indexOf("${"); + if(statementIdx!=-1){ + block.add(line); + String keyword = line.substring(statementIdx+2,line.indexOf(' ',statementIdx)); + String endTag = "'; + while((line!=null)&&(line.indexOf(endTag) == -1)){ + block.add(line = lnReader.readLine()); + } + if(line == null){ + throw new TestHarnessException("Cannot find end tag "+endTag); + } + result.append(compileBlock((String[])block.toArray(),keyword, endTag)); + }else if(elIdx!=-1){ + String el = line.substring(elIdx,line.indexOf('}',elIdx)+1); + result.append(line.replace(el, compileEl(el))); + }else{ + result.append(line).append('\n'); + } + line = lnReader.readLine(); + } + return null; + } + + private static Object compileBlock(String[] strings, String keyword, String endTag) { + return null; + } + + private static String compileEl(String el) { + return null; + } + } } Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/monitor/MonitorTest.java =================================================================== RCS file: /usr/local/cvsroot/TestHarness4LAMS2/src/org/lamsfoundation/testharness/monitor/MonitorTest.java,v diff -u -r1.2 -r1.3 --- TestHarness4LAMS2/src/org/lamsfoundation/testharness/monitor/MonitorTest.java 1 Aug 2006 23:35:42 -0000 1.2 +++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/monitor/MonitorTest.java 4 Aug 2006 00:47:42 -0000 1.3 @@ -105,7 +105,7 @@ } public void notifyMonitorToStop(CountDownLatch stopSignal){ - if(monitorThread.isAlive()){ + if((monitorThread != null) && monitorThread.isAlive()){ ((MockMonitor)users[0]).setStopFlag(stopSignal); }else{ stopSignal.countDown();