[jboss-svn-commits] JBL Code SVN: r25991 - in labs/jbosstm/workspace/adinn/orchestration: dd/grammar/flex and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Apr 9 07:30:57 EDT 2009
Author: adinn
Date: 2009-04-09 07:30:57 -0400 (Thu, 09 Apr 2009)
New Revision: 25991
Added:
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestLogical.txt
labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/javaops/TestLogical.java
Modified:
labs/jbosstm/workspace/adinn/orchestration/dd/grammar/cup/ECAGrammar.cup
labs/jbosstm/workspace/adinn/orchestration/dd/grammar/flex/ECAToken.flex
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Script.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Transformer.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/Rule.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/Expression.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/ExpressionHelper.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/OperExpression.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECAGrammarParser.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECATokenLexer.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ParseNode.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/PrintableSymbol.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/sym.java
labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/test/TestScript.java
labs/jbosstm/workspace/adinn/orchestration/tests/build.xml
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestArithmetic.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestCall.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestEntry.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestExit.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestReadWrite.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestSynch.txt
labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestThrow.txt
labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/Test.java
Log:
added tests for logical operations, fixed bug in parsing/type checking ?= operator and modified parser/typechecker to display file and line number for offending expressions when parse or type errors occur
Modified: labs/jbosstm/workspace/adinn/orchestration/dd/grammar/cup/ECAGrammar.cup
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/dd/grammar/cup/ECAGrammar.cup 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/dd/grammar/cup/ECAGrammar.cup 2009-04-09 11:30:57 UTC (rev 25991)
@@ -34,40 +34,47 @@
/*
private ParseNode node(int tag)
{
- return ParseNode.node(tag);
+ return ParseNode.node(tag, parser.file);
}
*/
private ParseNode node(int tag, int line, int column)
{
- return ParseNode.node(tag, line, column);
+ return ParseNode.node(tag, parser.file, line, column);
}
private ParseNode node(int tag, int line, int column, Object child0)
{
- return ParseNode.node(tag, line, column, child0);
+ return ParseNode.node(tag, parser.file, line, column, child0);
}
private ParseNode node(int tag, int line, int column, Object child0, Object child1)
{
- return ParseNode.node(tag, line, column, child0, child1);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1);
}
private ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2)
{
- return ParseNode.node(tag, line, column, child0, child1, child2);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1, child2);
}
/*
private ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2, Object child3)
{
- return ParseNode.node(tag, line, column, child0, child1, child2, child3);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1, child2, child3);
}
*/
:}
parser code {:
+ public String file = "";
+
+ public void setFile(String file)
+ {
+ this.file = file;
+ }
+
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/** Do debug output for a reduce.
Modified: labs/jbosstm/workspace/adinn/orchestration/dd/grammar/flex/ECAToken.flex
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/dd/grammar/flex/ECAToken.flex 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/dd/grammar/flex/ECAToken.flex 2009-04-09 11:30:57 UTC (rev 25991)
@@ -40,11 +40,25 @@
%{
StringBuffer string = new StringBuffer();
+ private int startLine = 0;
+
+ private String file = "";
+
+ public void setStartLine(int startLine)
+ {
+ this.startLine = startLine;
+ }
+
+ public void setFile(String file)
+ {
+ this.file = file;
+ }
+
private Symbol symbol(int type) {
- return new PrintableSymbol(type, yyline, yycolumn);
+ return new PrintableSymbol(type, file, yyline + startLine, yycolumn);
}
private Symbol symbol(int type, Object value) {
- return new PrintableSymbol(type, yyline, yycolumn, value);
+ return new PrintableSymbol(type, file, yyline + startLine, yycolumn, value);
}
%}
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Script.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Script.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Script.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -12,8 +12,10 @@
private String targetHelper;
private Location targetLocation;
private String ruleText;
+ int line;
+ String file;
- Script (String name, String targetClass, String targetMethod, String targetHelper, Location targetLocation, String ruleText)
+ Script (String name, String targetClass, String targetMethod, String targetHelper, Location targetLocation, String ruleText, int line, String file)
{
this.name = name;
this.targetClass = targetClass;
@@ -21,6 +23,8 @@
this.targetHelper = targetHelper;
this.targetLocation = targetLocation;
this.ruleText = ruleText;
+ this.line = line;
+ this.file = file;
}
public String getName() {
@@ -46,4 +50,14 @@
public String getRuleText() {
return ruleText;
}
+
+ public int getLine()
+ {
+ return line;
+ }
+
+ public String getFile()
+ {
+ return file;
+ }
}
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Transformer.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Transformer.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/agent/Transformer.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -73,6 +73,7 @@
int scriptIdx = 0;
while (iter.hasNext()) {
String scriptText = iter.next();
+ String file = scriptPaths.get(scriptIdx);
if (scriptText != null) {
// split rules into separate lines
String[] lines = scriptText.split("\n");
@@ -90,6 +91,7 @@
boolean inRule = false;
for (String line : lines) {
lineNumber++;
+ int startNumber = -1;
if (line.trim().startsWith("#")) {
if (inRule) {
// add a blank line in place of the comment so the line numbers
@@ -102,7 +104,7 @@
name = line.substring(5).trim();
} else if (!inRule) {
if (!line.trim().equals("")) {
- throw new Exception("org.jboss.jbossts.orchestration.agent.Transformer : invalid text outside of RULE/ENDRULE " + "at line " + lineNumber + " in script " + scriptPaths.get(scriptIdx));
+ throw new Exception("org.jboss.jbossts.orchestration.agent.Transformer : invalid text outside of RULE/ENDRULE " + "at line " + lineNumber + " in script " + file);
}
} else if (line.startsWith("CLASS ")) {
targetClass = line.substring(6).trim();
@@ -132,7 +134,7 @@
if (targetLocation == null) {
targetLocation = Location.create(LocationType.ENTRY, "");
}
- Script script = new Script(name, targetClass, targetMethod, targetHelper, targetLocation, nextRule);
+ Script script = new Script(name, targetClass, targetMethod, targetHelper, targetLocation, nextRule, startNumber, file);
scripts.add(script);
if (isVerbose()) {
System.out.println("RULE " + script.getName());
@@ -160,6 +162,9 @@
} else if (lineNumber == maxLines && !nextRule.trim().equals("")) {
throw new Exception("org.jboss.jbossts.orchestration.agent.Transformer : no matching ENDRULE for RULE " + name + " in script " + scriptPaths.get(scriptIdx));
} else {
+ if (startNumber < 0) {
+ startNumber = lineNumber;
+ }
nextRule += sepr + line;
sepr = "\n";
}
@@ -391,6 +396,8 @@
final String handlerMethod = script.getTargetMethod();
final String helperName = script.getTargetHelper();
final Location handlerLocation = script.getTargetLocation();
+ final int lineNumber = script.getLine();
+ final String file = script.getFile();
Class helperClass = null;
if (helperName != null) {
try {
@@ -408,7 +415,7 @@
final Rule rule;
String ruleName = script.getName();
try {
- rule = Rule.create(ruleName, handlerClass, handlerMethod, helperClass, handlerLocation, script.getRuleText(), loader);
+ rule = Rule.create(ruleName, handlerClass, handlerMethod, helperClass, handlerLocation, script.getRuleText(), lineNumber, file, loader);
} catch (ParseException pe) {
System.out.println("org.jboss.jbossts.orchestration.agent.Transformer : error parsing rule " + ruleName + " : " + pe);
return targetClassBytes;
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/Rule.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/Rule.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/Rule.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -75,6 +75,14 @@
*/
private Location targetLocation;
/**
+ * the line number for the start of the parseable rule text (the BIND clause)
+ */
+ private int line;
+ /**
+ * the name of the file which contains this rule
+ */
+ private String file;
+ /**
* the parsed event derived from the script for this rule
*/
private Event event;
@@ -146,12 +154,14 @@
private Type returnType;
- private Rule(String name, String targetClass, String targetMethod,Class<?> helperClass, Location targetLocation, String ruleSpec, ClassLoader loader)
+ private Rule(String name, String targetClass, String targetMethod,Class<?> helperClass, Location targetLocation, String ruleSpec, int line, String file, ClassLoader loader)
throws ParseException, TypeException, CompileException
{
ParseNode ruleTree;
this.name = name;
+ this.line = line;
+ this.file = file;
typeGroup = new TypeGroup(loader);
bindings = new Bindings();
if (ruleSpec != null) {
@@ -159,7 +169,10 @@
String fullSpec = "\n" + ruleSpec;
try {
ECATokenLexer lexer = new ECATokenLexer(new StringReader(fullSpec));
+ lexer.setStartLine(line);
+ lexer.setFile(file);
ECAGrammarParser parser = new ECAGrammarParser(lexer);
+ parser.setFile(file);
Symbol parse = (debugParse ? parser.debug_parse() : parser.parse());
ruleTree = (ParseNode) parse.value;
} catch (Exception e) {
@@ -232,10 +245,10 @@
return returnType;
}
- public static Rule create(String name, String targetClass, String targetMethod, Class<?> helperClass, Location targetLocation, String ruleSpec, ClassLoader loader)
+ public static Rule create(String name, String targetClass, String targetMethod, Class<?> helperClass, Location targetLocation, String ruleSpec, int line, String file, ClassLoader loader)
throws ParseException, TypeException, CompileException
{
- return new Rule(name, targetClass, targetMethod, helperClass, targetLocation, ruleSpec, loader);
+ return new Rule(name, targetClass, targetMethod, helperClass, targetLocation, ruleSpec, line, file, loader);
}
public void setEvent(String eventSpec) throws ParseException, TypeException
@@ -478,6 +491,24 @@
}
/**
+ * retrieve the start line for the ruel's parseable text
+ * @return the start line for the ruel's parseable text
+ */
+ public int getLine()
+ {
+ return line;
+ }
+
+ /**
+ * retrieve the name of the file containing this rule
+ * @return the name of the file containing this rule
+ */
+ public String getFile()
+ {
+ return file;
+ }
+
+ /**
* a hash map used to identify rules from their keys
*/
private static HashMap<String, Rule> ruleKeyMap = new HashMap<String, Rule>();
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/Expression.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/Expression.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/Expression.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -57,7 +57,7 @@
this.token = token;
if (token != null) {
this.charPos = token.getColumn();
- this.line = token.getLine();
+ this.line = rule.getLine() + token.getLine();
} else {
this.charPos = 0;
this.line = 0;
@@ -74,7 +74,7 @@
public String getPos()
{
- return " @ line " + line + "." + charPos;
+ return rule.getFile() + " @ line " + "." + charPos;
}
public Type getType()
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/ExpressionHelper.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/ExpressionHelper.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/ExpressionHelper.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -485,42 +485,41 @@
public static Expression createTernaryExpression(Rule rule, Bindings bindings, ParseNode exprTree, Type type)
throws TypeException
{
- // we expect ^(TERNOP ternary_oper simple_expr expr expr)
+ // we only expect ^(TERNOP ternary_oper simple_expr expr expr)
ParseNode child0 = (ParseNode) exprTree.getChild(0);
ParseNode child1 = (ParseNode) exprTree.getChild(1);
ParseNode child2 = (ParseNode) exprTree.getChild(2);
- ParseNode child3 = (ParseNode) exprTree.getChild(3);
Expression expr;
- int oper = child0.getTag();
+ int oper = exprTree.getTag();
switch (oper)
{
- case COND:
+ case TERNOP:
{
- // the argument must be a numeric expression
- Expression operand1 = createExpression(rule, bindings, child1, Type.BOOLEAN);
+ // the first argument must be a boolean expression
+ Expression operand0 = createExpression(rule, bindings, child0, Type.BOOLEAN);
+ Expression operand1 = createExpression(rule, bindings, child1, type);
Expression operand2 = createExpression(rule, bindings, child2, type);
- Expression operand3 = createExpression(rule, bindings, child3, type);
+ Type type1 = Type.dereference(operand1.getType());
Type type2 = Type.dereference(operand2.getType());
- Type type3 = Type.dereference(operand3.getType());
- if (type2.isNumeric() || type3.isNumeric()) {
+ if (type1.isNumeric() || type2.isNumeric()) {
if (!type.isUndefined() && !type.isVoid() && !type.isNumeric()) {
throw new TypeException("ExpressionHelper.createUnaryExpression : invalid numeric expression" + exprTree.getPos());
}
- expr = new ConditionalEvalExpression(rule, Type.promote(type2, type3), exprTree, operand1, operand2, operand3);
- } else if (type2.isDefined() && type3.isDefined()) {
+ expr = new ConditionalEvalExpression(rule, Type.promote(type1, type2), exprTree, operand0, operand1, operand2);
+ } else if (type1.isDefined() && type2.isDefined()) {
// since they are not numeric we have to have the same type
- if (type2 == type3) {
+ if (type1 == type2) {
// use this type
- expr = new ConditionalEvalExpression(rule, type2, exprTree, operand1, operand2, operand3);
+ expr = new ConditionalEvalExpression(rule, type1, exprTree, operand0, operand1, operand2);
} else {
// mismatched types so don't generate a result
- throw new TypeException("ExpressionHelper.createTernaryExpression : mismatched types " + type2.getName() + " and " + type3.getName() + " in conditional expression " + exprTree.getText() + exprTree.getPos());
+ throw new TypeException("ExpressionHelper.createTernaryExpression : mismatched types " + type1.getName() + " and " + type2.getName() + " in conditional expression " + exprTree.getText() + exprTree.getPos());
}
} else {
// have to wait for type check to resolve types
- expr = new ConditionalEvalExpression(rule, Type.UNDEFINED, exprTree, operand1, operand2, operand3);
+ expr = new ConditionalEvalExpression(rule, Type.UNDEFINED, exprTree, operand0, operand1, operand2);
}
}
break;
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/OperExpression.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/OperExpression.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/expression/OperExpression.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -177,7 +177,7 @@
org.jboss.jbossts.orchestration.rule.grammar.ParseNode.PLUS,
org.jboss.jbossts.orchestration.rule.grammar.ParseNode.MINUS,
org.jboss.jbossts.orchestration.rule.grammar.ParseNode.MOD,
- org.jboss.jbossts.orchestration.rule.grammar.ParseNode.COND
+ org.jboss.jbossts.orchestration.rule.grammar.ParseNode.TERNOP
};
final private static String[] operandNames = {
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECAGrammarParser.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECAGrammarParser.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECAGrammarParser.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,7 +1,7 @@
//----------------------------------------------------
// The following code was generated by CUP v0.10k
-// Mon Dec 15 12:13:44 GMT 2008
+// Thu Apr 09 12:10:33 BST 2009
//----------------------------------------------------
package org.jboss.jbossts.orchestration.rule.grammar;
@@ -10,7 +10,7 @@
import org.jboss.jbossts.orchestration.rule.grammar.ParseNode;
/** CUP v0.10k generated parser.
- * @version Mon Dec 15 12:13:44 GMT 2008
+ * @version Thu Apr 09 12:10:33 BST 2009
*/
public class ECAGrammarParser extends java_cup.runtime.lr_parser {
@@ -583,6 +583,13 @@
+ public String file = "";
+
+ public void setFile(String file)
+ {
+ this.file = file;
+ }
+
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
/** Do debug output for a reduce.
@@ -618,34 +625,34 @@
/*
private ParseNode node(int tag)
{
- return ParseNode.node(tag);
+ return ParseNode.node(tag, parser.file);
}
*/
private ParseNode node(int tag, int line, int column)
{
- return ParseNode.node(tag, line, column);
+ return ParseNode.node(tag, parser.file, line, column);
}
private ParseNode node(int tag, int line, int column, Object child0)
{
- return ParseNode.node(tag, line, column, child0);
+ return ParseNode.node(tag, parser.file, line, column, child0);
}
private ParseNode node(int tag, int line, int column, Object child0, Object child1)
{
- return ParseNode.node(tag, line, column, child0, child1);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1);
}
private ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2)
{
- return ParseNode.node(tag, line, column, child0, child1, child2);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1, child2);
}
/*
private ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2, Object child3)
{
- return ParseNode.node(tag, line, column, child0, child1, child2, child3);
+ return ParseNode.node(tag, parser.file, line, column, child0, child1, child2, child3);
}
*/
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECATokenLexer.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECATokenLexer.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ECATokenLexer.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.2 on 15/12/08 12:13 */
+/* The following code was generated by JFlex 1.4.2 on 09/04/09 12:10 */
/*
* JBoss, Home of Professional Open Source
@@ -33,7 +33,7 @@
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.2
- * on 15/12/08 12:13 from the specification file
+ * on 09/04/09 12:10 from the specification file
* <tt>dd/grammar/flex/ECAToken.flex</tt>
*/
public class ECATokenLexer implements java_cup.runtime.Scanner {
@@ -485,11 +485,25 @@
/* user code: */
StringBuffer string = new StringBuffer();
+ private int startLine = 0;
+
+ private String file = "";
+
+ public void setStartLine(int startLine)
+ {
+ this.startLine = startLine;
+ }
+
+ public void setFile(String file)
+ {
+ this.file = file;
+ }
+
private Symbol symbol(int type) {
- return new PrintableSymbol(type, yyline, yycolumn);
+ return new PrintableSymbol(type, file, yyline + startLine, yycolumn);
}
private Symbol symbol(int type, Object value) {
- return new PrintableSymbol(type, yyline, yycolumn, value);
+ return new PrintableSymbol(type, file, yyline + startLine, yycolumn, value);
}
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ParseNode.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ParseNode.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/ParseNode.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -49,7 +49,6 @@
public final static int PLUS = 47;
public final static int TWIDDLE = 48;
public final static int UMINUS = 49;
- public final static int COND = 50;
/**
* the type tag for this node
@@ -57,6 +56,12 @@
private int tag;
/**
+ * the script file containing the text form which this node was parsed
+ */
+
+ private String file;
+
+ /**
* the line position fo rthis node
*/
@@ -73,9 +78,10 @@
* @param line identifies the start line for this node's text
* @param column identifies the start columen for this node's text
*/
- protected ParseNode(int tag, int line, int column)
+ protected ParseNode(int tag, String file, int line, int column)
{
this.tag = tag;
+ this.file = file;
this.line = line;
this.column = column;
}
@@ -128,7 +134,7 @@
* @return a string representing the position for this node
*/
public String getPos() {
- return " @ " + line + "." + column;
+ return " " + file + " @ " + line + "." + column;
}
/**
@@ -138,9 +144,9 @@
* @param column identifies the start columen for this node's text
* @return a simple node for a builtin token
*/
- public static ParseNode node(int tag, int line, int column)
+ public static ParseNode node(int tag, String file, int line, int column)
{
- return new NullaryNode(tag, line, column);
+ return new NullaryNode(tag, file, line, column);
}
/**
@@ -150,24 +156,24 @@
* @param column identifies the start columen for this node's text
* @return a simple node for a builtin token
*/
- public static ParseNode node(int tag, int line, int column, Object child0)
+ public static ParseNode node(int tag, String file, int line, int column, Object child0)
{
- return new UnaryNode(tag, line, column, child0);
+ return new UnaryNode(tag, file, line, column, child0);
}
- public static ParseNode node(int tag, int line, int column, Object child0, Object child1)
+ public static ParseNode node(int tag, String file, int line, int column, Object child0, Object child1)
{
- return new BinaryNode(tag, line, column, child0, child1);
+ return new BinaryNode(tag, file, line, column, child0, child1);
}
- public static ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2)
+ public static ParseNode node(int tag, String file, int line, int column, Object child0, Object child1, Object child2)
{
- return new TernaryNode(tag, line, column, child0, child1, child2);
+ return new TernaryNode(tag, file, line, column, child0, child1, child2);
}
- public static ParseNode node(int tag, int line, int column, Object child0, Object child1, Object child2, Object child3)
+ public static ParseNode node(int tag, String file, int line, int column, Object child0, Object child1, Object child2, Object child3)
{
- return new QuaternaryNode(tag, line, column, child0, child1, child2, child3);
+ return new QuaternaryNode(tag, file, line, column, child0, child1, child2, child3);
}
/**
@@ -175,9 +181,9 @@
*/
private static class NullaryNode extends ParseNode
{
- public NullaryNode(int tag, int line, int column)
+ public NullaryNode(int tag, String file, int line, int column)
{
- super(tag, line, column);
+ super(tag, file, line, column);
}
/**
@@ -263,9 +269,9 @@
{
private Object child0;
- public UnaryNode(int tag, int line, int column, Object child0)
+ public UnaryNode(int tag, String file, int line, int column, Object child0)
{
- super(tag, line, column);
+ super(tag, file, line, column);
this.child0 = child0;
}
@@ -326,9 +332,9 @@
private Object child0;
private Object child1;
- public BinaryNode(int tag, int line, int column, Object child0, Object child1)
+ public BinaryNode(int tag, String file, int line, int column, Object child0, Object child1)
{
- super(tag, line, column);
+ super(tag, file, line, column);
this.child0 = child0;
this.child1 = child1;
}
@@ -411,9 +417,9 @@
private Object child1;
private Object child2;
- public TernaryNode(int tag, int line, int column, Object child0, Object child1, Object child2)
+ public TernaryNode(int tag, String file, int line, int column, Object child0, Object child1, Object child2)
{
- super(tag, line, column);
+ super(tag, file, line, column);
this.child0 = child0;
this.child1 = child1;
this.child2 = child2;
@@ -477,9 +483,9 @@
private Object child2;
private Object child3;
- public QuaternaryNode(int tag, int line, int column, Object child0, Object child1, Object child2, Object child3)
+ public QuaternaryNode(int tag, String file, int line, int column, Object child0, Object child1, Object child2, Object child3)
{
- super(tag, line, column);
+ super(tag, file, line, column);
this.child0 = child0;
this.child1 = child1;
this.child2 = child2;
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/PrintableSymbol.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/PrintableSymbol.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/PrintableSymbol.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -7,19 +7,24 @@
*/
public class PrintableSymbol extends Symbol
{
- public PrintableSymbol(int id, int l, int r, Object o)
+ private String file;
+
+ public PrintableSymbol(int id, String file, int l, int r, Object o)
{
super(id, l, r, o);
+ this.file= file;
}
- public PrintableSymbol(int id, int l, int r)
+ public PrintableSymbol(int id, String file, int l, int r)
{
super(id, l, r);
+ this.file= file;
}
public PrintableSymbol(int id, Object o)
{
super(id, o);
+ this.file= "";
}
public String toString()
@@ -39,6 +44,11 @@
}
}
+ public String getPos()
+ {
+ return file + " @ " + left + "." + right;
+ }
+
public static String[] sym_name = new String[100];
static {
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/sym.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/sym.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/rule/grammar/sym.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,7 +1,7 @@
//----------------------------------------------------
// The following code was generated by CUP v0.10k
-// Mon Dec 15 12:13:44 GMT 2008
+// Thu Apr 09 12:10:33 BST 2009
//----------------------------------------------------
package org.jboss.jbossts.orchestration.rule.grammar;
Modified: labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/test/TestScript.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/test/TestScript.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/src/org/jboss/jbossts/orchestration/test/TestScript.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -69,7 +69,7 @@
FileInputStream fis = new FileInputStream(new File(script));
System.out.println("checking rules in " + script);
List<String> rules = processRules(fis);
- checkRules(rules);
+ checkRules(rules, script);
} catch (IOException ioe) {
System.err.println("TestScript: unable to open rule script file : " + script);
}
@@ -104,7 +104,7 @@
return rules;
}
- private void checkRules(List<String> ruleScripts)
+ private void checkRules(List<String> ruleScripts, String file)
{
ClassLoader loader = getClass().getClassLoader();
int errorCount = 0;
@@ -125,6 +125,7 @@
String sepr = "";
int idx = 0;
int len = lines.length;
+ int lineNumber = 0;
while (lines[idx].trim().equals("") || lines[idx].trim().startsWith("#")) {
idx++;
@@ -187,6 +188,7 @@
}
idx++;
}
+ lineNumber = idx;
for (;idx < len; idx++) {
if (lines[idx].trim().startsWith("#")) {
lines[idx] = "";
@@ -209,7 +211,7 @@
System.out.println("org.jboss.jbossts.orchestration.agent.Transformer : unknown helper class " + targetHelperName + " for rule " + ruleName);
}
}
- Rule rule = Rule.create(ruleName, targetClassName, targetMethodName, targetHelperClass, targetLocation, text, loader);
+ Rule rule = Rule.create(ruleName, targetClassName, targetMethodName, targetHelperClass, targetLocation, text, lineNumber, file, loader);
System.err.println("TestScript: parsed rule " + rule.getName());
System.err.println(rule);
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/build.xml
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/build.xml 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/build.xml 2009-04-09 11:30:57 UTC (rev 25991)
@@ -95,8 +95,8 @@
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
+ <test name="org.jboss.jbossts.orchestration.tests.location.TestEntry"/>
-->
- <test name="org.jboss.jbossts.orchestration.tests.location.TestEntry"/>
</junit>
<junit fork="true" showoutput="true">
<classpath>
@@ -221,6 +221,14 @@
<pathelement location="${junit.home}/${junit.jar}"/>
</classpath>
<jvmarg value="-javaagent:${toast.home}/${toast.jar}=script:${scripts.dir}/javaops/TestArithmetic.txt"/>
+ <test name="org.jboss.jbossts.orchestration.tests.javaops.TestArithmetic"/>
+ </junit>
+ <junit fork="true" showoutput="true">
+ <classpath>
+ <pathelement location="${build.lib.dir}/orchestration-tests.jar"/>
+ <pathelement location="${junit.home}/${junit.jar}"/>
+ </classpath>
+ <jvmarg value="-javaagent:${toast.home}/${toast.jar}=script:${scripts.dir}/javaops/TestLogical.txt"/>
<!-- uncomment for verbose toast output
<jvmarg value="-Dorg.jboss.jbossts.orchestration.verbose"/>
-->
@@ -233,8 +241,8 @@
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=NONE"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
+ <test name="org.jboss.jbossts.orchestration.tests.javaops.TestLogical"/>
-->
- <test name="org.jboss.jbossts.orchestration.tests.javaops.TestArithmetic"/>
</junit>
</target>
@@ -245,6 +253,14 @@
<pathelement location="${junit.home}/${junit.jar}"/>
</classpath>
<jvmarg value="-javaagent:${toast.home}/${toast.jar}=script:${scripts.dir}/javaops/TestArithmetic.txt"/>
+ <test name="org.jboss.jbossts.orchestration.tests.javaops.TestArithmetic"/>
+ </junit>
+ <junit fork="true" showoutput="true">
+ <classpath>
+ <pathelement location="${build.lib.dir}/orchestration-tests.jar"/>
+ <pathelement location="${junit.home}/${junit.jar}"/>
+ </classpath>
+ <jvmarg value="-javaagent:${toast.home}/${toast.jar}=script:${scripts.dir}/javaops/TestLogical.txt"/>
<!-- uncomment for verbose toast output
<jvmarg value="-Dorg.jboss.jbossts.orchestration.verbose"/>
-->
@@ -259,7 +275,7 @@
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=5005"/>
<jvmarg value="-Dorg.jboss.jbossts.orchestration.compileToBytecode"/>
-->
- <test name="org.jboss.jbossts.orchestration.tests.javaops.TestArithmetic"/>
+ <test name="org.jboss.jbossts.orchestration.tests.javaops.TestLogical"/>
</junit>
</target>
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestArithmetic.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestArithmetic.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestArithmetic.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test arithmetic plus
CLASS TestArithmetic
METHOD triggerMethod1(int,char,short,byte)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER CALL log
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0,
i : int = $1,
c : char = $2,
@@ -23,8 +23,8 @@
RULE test arithmetic minus
CLASS TestArithmetic
METHOD triggerMethod2(int,char,short,byte)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER CALL log
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0,
i : int = $1,
c : char = $2,
@@ -45,8 +45,8 @@
RULE test arithmetic mod, times and div
CLASS TestArithmetic
METHOD triggerMethod3(int,char,short,byte)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER CALL log
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0,
i : int = $1,
c : char = $2,
@@ -67,8 +67,8 @@
RULE test arithmetic mod, times and div again
CLASS TestArithmetic
METHOD triggerMethod4(int,char,short,byte)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER CALL log
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0,
i : int = $1,
c : char = $2,
Copied: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestLogical.txt (from rev 25933, labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestArithmetic.txt)
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestLogical.txt (rev 0)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/javaops/TestLogical.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -0,0 +1,56 @@
+RULE test logical 1
+CLASS TestLogical
+METHOD triggerMethod1(boolean)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
+AFTER CALL log
+BIND test : Test = $0,
+ arg : boolean = $1
+IF arg
+DO test.log("triggerMethod1 : arg == " + $1),
+ test.log("triggerMethod1 : (arg && !arg) == " + (arg && !arg)),
+ test.log("triggerMethod1 : (arg && true) == " + (arg && true)),
+ return $1
+ENDRULE
+
+RULE test logical 2
+CLASS TestLogical
+METHOD triggerMethod1(boolean)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
+AFTER CALL log
+BIND test : Test = $0,
+ arg : boolean = $1
+IF NOT arg
+DO test.log("triggerMethod1 : arg == " + $1),
+ test.log("triggerMethod1 : (arg || !arg) == " + (arg || !arg)),
+ test.log("triggerMethod1 : (arg || false) == " + (arg || false)),
+ return (arg ? false : true)
+ENDRULE
+
+RULE test logical 3
+CLASS TestLogical
+METHOD triggerMethod2(boolean)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
+AFTER CALL log
+BIND test : Test = $0,
+ arg : boolean = $1
+IF arg
+DO test.log("triggerMethod2 : arg == " + $1),
+ test.log("triggerMethod2 : (arg || !arg) == " + (arg || !arg)),
+ test.log("triggerMethod2 : (arg || false) == " + (arg || false)),
+ return (arg ? false : true)
+ENDRULE
+
+RULE test logical 4
+CLASS TestLogical
+METHOD triggerMethod2(boolean)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
+AFTER CALL log
+BIND test : Test = $0,
+ arg : boolean = $1
+IF NOT arg
+DO test.log("triggerMethod2 : arg == " + $1),
+ test.log("triggerMethod2 : (arg && !arg) == " + (arg && !arg)),
+ test.log("triggerMethod2 : (arg && true) == " + (arg && true)),
+ return $1
+ENDRULE
+
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestCall.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestCall.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestCall.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test call getCounter trigger
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT CALL getCounter
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("CALL getCounter triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -11,8 +11,8 @@
RULE test call getCounter trigger 2
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT CALL getCounter 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("CALL getCounter 2 triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -21,8 +21,8 @@
RULE test call getCounter trigger 3
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT CALL getCounter 3
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("CALL getCounter 3 triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -31,8 +31,8 @@
RULE test call setCounter trigger
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT CALL setCounter
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("CALL setCounter triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -41,8 +41,8 @@
RULE test call setCounter trigger 2
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT CALL setCounter 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("CALL setCounter 2 triggered in TestCallThrowSynchAuxiliary.testMethod")
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestEntry.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestEntry.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestEntry.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test entry trigger for constructor
CLASS TestEntryExitAuxiliarySub
METHOD <init>(Test)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT ENTRY
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $1
IF TRUE
DO test.log("ENTRY triggered in constructor")
@@ -11,8 +11,8 @@
RULE test entry trigger for subclass method
CLASS TestEntryExitAuxiliarySub
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT ENTRY
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("ENTRY triggered in TestEntryExitAuxiliarySub.testMethod")
@@ -21,8 +21,8 @@
RULE test entry trigger for superclass method
CLASS TestEntryExitAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT ENTRY
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("ENTRY triggered in TestEntryExitAuxiliary.testMethod")
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestExit.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestExit.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestExit.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test exit trigger for constructor
CLASS TestEntryExitAuxiliarySub
METHOD <init>(Test)
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT EXIT
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $1
IF TRUE
DO test.log("EXIT triggered in constructor")
@@ -11,8 +11,8 @@
RULE test exit trigger for subclass method
CLASS TestEntryExitAuxiliarySub
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT EXIT
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("EXIT triggered in TestEntryExitAuxiliarySub.testMethod")
@@ -21,8 +21,8 @@
RULE test exit trigger for superclass method
CLASS TestEntryExitAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT EXIT
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("EXIT triggered in TestEntryExitAuxiliary.testMethod")
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestReadWrite.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestReadWrite.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestReadWrite.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test at read trigger
CLASS TestReadWriteAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT READ counter
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("AT READ 1 triggered in TestReadWriteAuxiliary.testMethod : counter == " + $0.counter)
@@ -11,8 +11,8 @@
RULE test after read trigger 2
CLASS TestReadWriteAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER READ counter 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("AFTER READ 2 triggered in TestReadWriteAuxiliary.testMethod : counter == " + $0.counter)
@@ -21,8 +21,8 @@
RULE test at write trigger
CLASS TestReadWriteAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT WRITE counter
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("AT WRITE 1 triggered in TestReadWriteAuxiliary.testMethod : counter == " + $0.counter)
@@ -31,8 +31,8 @@
RULE test after write trigger 2
CLASS TestReadWriteAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AFTER WRITE counter 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("AFTER WRITE 2 triggered in TestReadWriteAuxiliary.testMethod : counter == " + $0.counter)
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestSynch.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestSynch.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestSynch.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test getSynchronize trigger
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT SYNCHRONIZE
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("SYNCHRONIZE triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -11,8 +11,8 @@
RULE test getSynchronize trigger 2
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT SYNCHRONIZE 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("SYNCHRONIZE 2 triggered in TestCallThrowSynchAuxiliary.testMethod")
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestThrow.txt
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestThrow.txt 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/dd/scripts/location/TestThrow.txt 2009-04-09 11:30:57 UTC (rev 25991)
@@ -1,8 +1,8 @@
RULE test throw trigger
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT THROW
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("THROW 1 triggered in TestCallThrowSynchAuxiliary.testMethod")
@@ -11,8 +11,8 @@
RULE test throw trigger 2
CLASS TestCallThrowSynchAuxiliary
METHOD testMethod()
+HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
AT THROW 2
-HELPER org.jboss.jbossts.orchestration.tests.helpers.Default
BIND test : Test = $0.getTest()
IF TRUE
DO test.log("THROW 2 triggered in TestCallThrowSynchAuxiliary.testMethod")
Modified: labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/Test.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/Test.java 2009-04-09 11:00:55 UTC (rev 25990)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/Test.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -58,7 +58,7 @@
if (!output.equals(expected)) {
fail("Test " + name + "fail" + "\n\n<expected>\n" + expected + "</expected>\n\n<log>\n" + output +"</log>\n");
} else {
- System.out.println("Test " + name + "success" + "\n\n<log>\n" + output + "</log>\n");
+ System.out.println("Test " + name + " success" + "\n\n<log>\n" + output + "</log>\n");
}
if (reset) {
Added: labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/javaops/TestLogical.java
===================================================================
--- labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/javaops/TestLogical.java (rev 0)
+++ labs/jbosstm/workspace/adinn/orchestration/tests/src/org/jboss/jbossts/orchestration/tests/javaops/TestLogical.java 2009-04-09 11:30:57 UTC (rev 25991)
@@ -0,0 +1,128 @@
+package org.jboss.jbossts.orchestration.tests.javaops;
+
+import org.jboss.jbossts.orchestration.tests.Test;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: adinn
+ * Date: 08-Apr-2009
+ * Time: 16:04:11
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestLogical extends Test
+{
+ public TestLogical() {
+ super(TestLogical.class.getCanonicalName());
+ }
+
+ static int runNumber = 0;
+
+ public void test()
+ {
+ boolean res;
+
+ runNumber = 1;
+ try {
+ log("calling TestLogical.triggerMethod1");
+ res = triggerMethod1(true);
+ log("called TestLogical.triggerMethod1 : result == " + res);
+ } catch (Exception e) {
+ log(e);
+ }
+
+ checkOutput(true);
+
+ runNumber = 2;
+ try {
+ log("calling TestLogical.triggerMethod1");
+ res = triggerMethod1(false);
+ log("called TestLogical.triggerMethod1 : result == " + res);
+ } catch (Exception e) {
+ log(e);
+ }
+
+ checkOutput(true);
+
+ runNumber = 3;
+ try {
+ log("calling TestLogical.triggerMethod2");
+ res = triggerMethod2(true);
+ log("called TestLogical.triggerMethod2 : result == " + res);
+ } catch (Exception e) {
+ log(e);
+ }
+
+ checkOutput(true);
+
+ runNumber = 4;
+ try {
+ log("calling TestLogical.triggerMethod2");
+ res = triggerMethod2(false);
+ log("called TestLogical.triggerMethod2 : result == " + res);
+ } catch (Exception e) {
+ log(e);
+ }
+
+ checkOutput(true);
+ }
+
+ public boolean triggerMethod1(boolean arg)
+ {
+ log("inside TestLogical.triggerMethod1");
+ return arg;
+ }
+
+ public boolean triggerMethod2(boolean arg)
+ {
+ log("inside TestLogical.triggerMethod2");
+ return arg;
+ }
+
+ @Override
+ public String getExpected() {
+ switch (runNumber) {
+ case 1:
+ {
+ logExpected("calling TestLogical.triggerMethod1");
+ logExpected("inside TestLogical.triggerMethod1");
+ logExpected("triggerMethod1 : arg == true");
+ logExpected("triggerMethod1 : (arg && !arg) == false");
+ logExpected("triggerMethod1 : (arg && true) == true");
+ logExpected("called TestLogical.triggerMethod1 : result == " + true);
+ }
+ break;
+ case 2:
+ {
+ logExpected("calling TestLogical.triggerMethod1");
+ logExpected("inside TestLogical.triggerMethod1");
+ logExpected("triggerMethod1 : arg == false");
+ logExpected("triggerMethod1 : (arg || !arg) == true");
+ logExpected("triggerMethod1 : (arg || false) == false");
+ logExpected("called TestLogical.triggerMethod1 : result == " + true);
+ }
+ break;
+ case 3:
+ {
+ logExpected("calling TestLogical.triggerMethod2");
+ logExpected("inside TestLogical.triggerMethod2");
+ logExpected("triggerMethod2 : arg == true");
+ logExpected("triggerMethod2 : (arg || !arg) == true");
+ logExpected("triggerMethod2 : (arg || false) == true");
+ logExpected("called TestLogical.triggerMethod2 : result == " + false);
+ }
+ break;
+ case 4:
+ {
+ logExpected("calling TestLogical.triggerMethod2");
+ logExpected("inside TestLogical.triggerMethod2");
+ logExpected("triggerMethod2 : arg == false");
+ logExpected("triggerMethod2 : (arg && !arg) == false");
+ logExpected("triggerMethod2 : (arg && true) == false");
+ logExpected("called TestLogical.triggerMethod2 : result == " + false);
+ }
+ break;
+ }
+
+ return super.getExpected();
+ }
+}
More information about the jboss-svn-commits
mailing list