You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(11) |
Nov
(97) |
Dec
(35) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(55) |
Mar
(21) |
Apr
(3) |
May
(7) |
Jun
(25) |
Jul
(108) |
Aug
(23) |
Sep
|
Oct
|
Nov
|
Dec
(4) |
2006 |
Jan
|
Feb
|
Mar
(6) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
(13) |
Feb
|
Mar
(257) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(38) |
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(63) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser In directory sc8-pr-cvs1:/tmp/cvs-serv6730/src/org/webmacro/parser Modified Files: WMParser_impl.java WMParser_impl.jj WMParser_implConstants.java WMParser_implTokenManager.java Log Message: Experimental parser Map support using this syntax: #set $map = { "key" => "value", "key2" => "value2" Index: WMParser_impl.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** WMParser_impl.java 27 Mar 2003 00:35:30 -0000 1.46 --- WMParser_impl.java 13 May 2003 05:29:17 -0000 1.47 *************** *** 964,971 **** --- 964,1094 ---- } + final public MapBuilder MapArgList() throws ParseException { + MapBuilder map = new MapBuilder(); + Object key, value; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LBRACE: + case DOLLAR: + case QUOTE: [...2436 lines suppressed...] for (int j = 0; j < 32; j++) { --- 3155,3159 ---- jj_kind = -1; } ! for (int i = 0; i < 104; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { *************** *** 3026,3030 **** } } ! for (int i = 0; i < 58; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; --- 3167,3171 ---- } } ! for (int i = 0; i < 59; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; Index: WMParser_impl.jj =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.jj,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** WMParser_impl.jj 15 Dec 2002 10:22:37 -0000 1.44 --- WMParser_impl.jj 13 May 2003 05:29:18 -0000 1.45 *************** *** 284,287 **** --- 284,288 ---- | <LBRACKET: "["> | <RBRACKET: "]"> + | <ASSOC: "=>"> | <DOT: "."> | <OP_LT: "<"> *************** *** 825,828 **** --- 826,850 ---- } + MapBuilder MapArgList() : { + MapBuilder map = new MapBuilder(); + Object key, value; + } + { + [ [<WS>] key=Expression() [<WS>] <ASSOC> [<WS>] value=Expression() [<WS>] { map.put(key, value); } + ( + <COMMA> [<WS>] key=Expression() [<WS>] <ASSOC> [<WS>] value=Expression() [<WS>] { map.put(key, value); } + ) * + ] + { return map; } + } + + MapBuilder CurlyMap() : { + MapBuilder map; + } + { + <LBRACE> map=MapArgList() {SetState(DEFAULT);} <RBRACE> {SetState(WM);} + { return map; } + } + ListBuilder ArgList() : { ListBuilder list = new ListBuilder(); *************** *** 881,884 **** --- 903,907 ---- | e=QuotedString() | e=BracketList() + | e=CurlyMap() | <NULL> { e = null; } | <TRUE> { e = Boolean.TRUE; } Index: WMParser_implConstants.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implConstants.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** WMParser_implConstants.java 11 Nov 2002 04:53:12 -0000 1.10 --- WMParser_implConstants.java 13 May 2003 05:29:18 -0000 1.11 *************** *** 39,64 **** int LBRACKET = 34; int RBRACKET = 35; ! int DOT = 36; ! int OP_LT = 37; ! int OP_LE = 38; ! int OP_GT = 39; ! int OP_GE = 40; ! int OP_EQ = 41; ! int OP_SET = 42; ! int OP_NE = 43; ! int OP_PLUS = 44; ! int OP_MINUS = 45; ! int OP_MULT = 46; ! int OP_DIV = 47; ! int OP_AND = 48; ! int OP_OR = 49; ! int OP_NOT = 50; ! int COMMA = 51; ! int SEMI = 52; ! int WORD = 53; ! int NUMBER = 54; ! int OTHER = 55; ! int QS_TEXT = 56; ! int SQS_TEXT = 57; int SQS = 0; --- 39,65 ---- int LBRACKET = 34; int RBRACKET = 35; ! int ASSOC = 36; ! int DOT = 37; ! int OP_LT = 38; ! int OP_LE = 39; ! int OP_GT = 40; ! int OP_GE = 41; ! int OP_EQ = 42; ! int OP_SET = 43; ! int OP_NE = 44; ! int OP_PLUS = 45; ! int OP_MINUS = 46; ! int OP_MULT = 47; ! int OP_DIV = 48; ! int OP_AND = 49; ! int OP_OR = 50; ! int OP_NOT = 51; ! int COMMA = 52; ! int SEMI = 53; ! int WORD = 54; ! int NUMBER = 55; ! int OTHER = 56; ! int QS_TEXT = 57; ! int SQS_TEXT = 58; int SQS = 0; *************** *** 105,108 **** --- 106,110 ---- "\"[\"", "\"]\"", + "\"=>\"", "\".\"", "\"<\"", Index: WMParser_implTokenManager.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implTokenManager.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** WMParser_implTokenManager.java 27 Mar 2003 00:35:30 -0000 1.24 --- WMParser_implTokenManager.java 13 May 2003 05:29:18 -0000 1.25 *************** *** 17,20 **** --- 17,22 ---- // Required by SetState void backup(int n) { input_stream.backup(n); } + public java.io.PrintStream debugStream = System.out; + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_4(int pos, long active0) { *************** *** 390,395 **** if ((0xffffffebffffdbffL & l) == 0L) break; ! if (kind > 56) ! kind = 56; jjCheckNAdd(4); break; --- 392,397 ---- if ((0xffffffebffffdbffL & l) == 0L) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; *************** *** 420,425 **** if ((0xffffffffefffffffL & l) != 0L) { ! if (kind > 56) ! kind = 56; jjCheckNAdd(4); } --- 422,427 ---- if ((0xffffffffefffffffL & l) != 0L) { ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); } *************** *** 430,435 **** if ((0xffffffffefffffffL & l) == 0L) break; ! if (kind > 56) ! kind = 56; jjCheckNAdd(4); break; --- 432,437 ---- if ((0xffffffffefffffffL & l) == 0L) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; *************** *** 457,462 **** if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; ! if (kind > 56) ! kind = 56; jjCheckNAdd(4); break; --- 459,464 ---- if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; *************** *** 572,579 **** if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 53; return 29; } ! if ((active0 & 0x6000000000L) != 0L) return 13; return -1; --- 574,581 ---- if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 54; return 29; } ! if ((active0 & 0xc000000000L) != 0L) return 13; return -1; *************** *** 581,585 **** if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 1; return 29; --- 583,587 ---- if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 1; return 29; *************** *** 589,593 **** if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 2; return 29; --- 591,595 ---- if ((active0 & 0x3c000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 2; return 29; *************** *** 597,601 **** if ((active0 & 0x30000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 3; return 29; --- 599,603 ---- if ((active0 & 0x30000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 3; return 29; *************** *** 607,611 **** if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 4; return 29; --- 609,613 ---- if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 4; return 29; *************** *** 617,621 **** if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 5; return 29; --- 619,623 ---- if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 5; return 29; *************** *** 625,629 **** if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 6; return 29; --- 627,631 ---- if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 6; return 29; *************** *** 633,637 **** if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 53; jjmatchedPos = 7; return 29; --- 635,639 ---- if ((active0 & 0x20000000L) != 0L) { ! jjmatchedKind = 54; jjmatchedPos = 7; return 29; *************** *** 672,697 **** return jjStopAtPos(0, 33); case 42: ! return jjStopAtPos(0, 46); case 43: ! return jjStopAtPos(0, 44); case 44: ! return jjStopAtPos(0, 51); case 45: ! return jjStopAtPos(0, 45); case 46: ! return jjStopAtPos(0, 36); case 47: ! return jjStopAtPos(0, 47); case 59: ! return jjStopAtPos(0, 52); case 60: ! jjmatchedKind = 37; ! return jjMoveStringLiteralDfa1_3(0x4000000000L); case 61: ! jjmatchedKind = 42; ! return jjMoveStringLiteralDfa1_3(0x20000000000L); case 62: ! jjmatchedKind = 39; ! return jjMoveStringLiteralDfa1_3(0x10000000000L); case 91: return jjStopAtPos(0, 34); --- 674,699 ---- return jjStopAtPos(0, 33); case 42: ! return jjStopAtPos(0, 47); case 43: ! return jjStopAtPos(0, 45); case 44: ! return jjStopAtPos(0, 52); case 45: ! return jjStopAtPos(0, 46); case 46: ! return jjStopAtPos(0, 37); case 47: ! return jjStopAtPos(0, 48); case 59: ! return jjStopAtPos(0, 53); case 60: ! jjmatchedKind = 38; ! return jjMoveStringLiteralDfa1_3(0x8000000000L); case 61: ! jjmatchedKind = 43; ! return jjMoveStringLiteralDfa1_3(0x41000000000L); case 62: ! jjmatchedKind = 40; ! return jjMoveStringLiteralDfa1_3(0x20000000000L); case 91: return jjStopAtPos(0, 34); *************** *** 724,733 **** { case 61: ! if ((active0 & 0x4000000000L) != 0L) ! return jjStopAtPos(1, 38); ! else if ((active0 & 0x10000000000L) != 0L) ! return jjStopAtPos(1, 40); else if ((active0 & 0x20000000000L) != 0L) return jjStopAtPos(1, 41); break; case 97: --- 726,739 ---- { case 61: ! if ((active0 & 0x8000000000L) != 0L) ! return jjStopAtPos(1, 39); else if ((active0 & 0x20000000000L) != 0L) return jjStopAtPos(1, 41); + else if ((active0 & 0x40000000000L) != 0L) + return jjStopAtPos(1, 42); + break; + case 62: + if ((active0 & 0x1000000000L) != 0L) + return jjStopAtPos(1, 36); break; case 97: *************** *** 931,936 **** if ((0x3ff000000000000L & l) != 0L) { ! if (kind > 54) ! kind = 54; jjCheckNAdd(30); } --- 937,942 ---- if ((0x3ff000000000000L & l) != 0L) { ! if (kind > 55) ! kind = 55; jjCheckNAdd(30); } *************** *** 948,953 **** else if (curChar == 33) { ! if (kind > 50) ! kind = 50; } else if (curChar == 38) --- 954,959 ---- else if (curChar == 33) { ! if (kind > 51) ! kind = 51; } else if (curChar == 38) *************** *** 1004,1009 **** break; case 11: ! if (curChar == 61 && kind > 43) ! kind = 43; break; case 12: --- 1010,1015 ---- break; case 11: ! if (curChar == 61 && kind > 44) ! kind = 44; break; case 12: *************** *** 1012,1017 **** break; case 13: ! if (curChar == 62 && kind > 43) ! kind = 43; break; case 14: --- 1018,1023 ---- break; case 13: ! if (curChar == 62 && kind > 44) ! kind = 44; break; case 14: *************** *** 1020,1025 **** break; case 15: ! if (curChar == 38 && kind > 48) ! kind = 48; break; case 16: --- 1026,1031 ---- break; case 15: ! if (curChar == 38 && kind > 49) ! kind = 49; break; case 16: *************** *** 1028,1039 **** break; case 24: ! if (curChar == 33 && kind > 50) ! kind = 50; break; case 29: if ((0x3ff000000000000L & l) == 0L) break; ! if (kind > 53) ! kind = 53; jjstateSet[jjnewStateCnt++] = 29; break; --- 1034,1045 ---- break; case 24: ! if (curChar == 33 && kind > 51) ! kind = 51; break; case 29: if ((0x3ff000000000000L & l) == 0L) break; ! if (kind > 54) ! kind = 54; jjstateSet[jjnewStateCnt++] = 29; break; *************** *** 1041,1046 **** if ((0x3ff000000000000L & l) == 0L) break; ! if (kind > 54) ! kind = 54; jjCheckNAdd(30); break; --- 1047,1052 ---- if ((0x3ff000000000000L & l) == 0L) break; ! if (kind > 55) ! kind = 55; jjCheckNAdd(30); break; *************** *** 1063,1068 **** if ((0x7fffffe07fffffeL & l) != 0L) { ! if (kind > 53) ! kind = 53; jjCheckNAdd(29); } --- 1069,1074 ---- if ((0x7fffffe07fffffeL & l) != 0L) { ! if (kind > 54) ! kind = 54; jjCheckNAdd(29); } *************** *** 1088,1093 **** break; case 17: ! if (curChar == 68 && kind > 48) ! kind = 48; break; case 18: --- 1094,1099 ---- break; case 17: ! if (curChar == 68 && kind > 49) ! kind = 49; break; case 18: *************** *** 1100,1105 **** break; case 20: ! if (curChar == 124 && kind > 49) ! kind = 49; break; case 21: --- 1106,1111 ---- break; case 20: ! if (curChar == 124 && kind > 50) ! kind = 50; break; case 21: *************** *** 1108,1113 **** break; case 22: ! if (curChar == 82 && kind > 49) ! kind = 49; break; case 23: --- 1114,1119 ---- break; case 22: ! if (curChar == 82 && kind > 50) ! kind = 50; break; case 23: *************** *** 1116,1121 **** break; case 25: ! if (curChar == 84 && kind > 50) ! kind = 50; break; case 26: --- 1122,1127 ---- break; case 25: ! if (curChar == 84 && kind > 51) ! kind = 51; break; case 26: *************** *** 1130,1135 **** if ((0x7fffffe07fffffeL & l) == 0L) break; ! if (kind > 53) ! kind = 53; jjCheckNAdd(29); break; --- 1136,1141 ---- if ((0x7fffffe07fffffeL & l) == 0L) break; ! if (kind > 54) ! kind = 54; jjCheckNAdd(29); break; *************** *** 1137,1142 **** if ((0x7fffffe87fffffeL & l) == 0L) break; ! if (kind > 53) ! kind = 53; jjCheckNAdd(29); break; --- 1143,1148 ---- if ((0x7fffffe87fffffeL & l) == 0L) break; ! if (kind > 54) ! kind = 54; jjCheckNAdd(29); break; *************** *** 1250,1255 **** if ((0xffffff6fffffdbffL & l) == 0L) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; --- 1256,1261 ---- if ((0xffffff6fffffdbffL & l) == 0L) break; ! if (kind > 58) ! kind = 58; jjCheckNAdd(4); break; *************** *** 1280,1285 **** if ((0xffffffffefffffffL & l) != 0L) { ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); } --- 1286,1291 ---- if ((0xffffffffefffffffL & l) != 0L) { ! if (kind > 58) ! kind = 58; jjCheckNAdd(4); } *************** *** 1290,1295 **** if ((0xffffffffefffffffL & l) == 0L) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; --- 1296,1301 ---- if ((0xffffffffefffffffL & l) == 0L) break; ! if (kind > 58) ! kind = 58; jjCheckNAdd(4); break; *************** *** 1317,1322 **** if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; ! if (kind > 57) ! kind = 57; jjCheckNAdd(4); break; --- 1323,1328 ---- if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) break; ! if (kind > 58) ! kind = 58; jjCheckNAdd(4); break; *************** *** 1358,1363 **** "\134", "\43", "\42", "\47", "\156\165\154\154", "\164\162\165\145", "\146\141\154\163\145", "\165\156\144\145\146\151\156\145\144", null, null, "\50", "\51", "\133", ! "\135", "\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\75", null, "\53", "\55", ! "\52", "\57", null, null, null, "\54", "\73", null, null, null, null, null, }; public static final String[] lexStateNames = { "SQS", --- 1364,1370 ---- "\134", "\43", "\42", "\47", "\156\165\154\154", "\164\162\165\145", "\146\141\154\163\145", "\165\156\144\145\146\151\156\145\144", null, null, "\50", "\51", "\133", ! "\135", "\75\76", "\56", "\74", "\74\75", "\76", "\76\75", "\75\75", "\75", null, ! "\53", "\55", "\52", "\57", null, null, null, "\54", "\73", null, null, null, null, ! null, }; public static final String[] lexStateNames = { "SQS", *************** *** 1370,1377 **** -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { ! 0x3fffffffffef801L, }; static final long[] jjtoSkip = { --- 1377,1384 ---- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, ! -1, -1, -1, -1, -1, -1, -1, -1, -1, }; static final long[] jjtoToken = { ! 0x7fffffffffef801L, }; static final long[] jjtoSkip = { *************** *** 1504,1510 **** jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_3(); ! if (jjmatchedPos == 0 && jjmatchedKind > 55) { ! jjmatchedKind = 55; } break; --- 1511,1517 ---- jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_3(); ! if (jjmatchedPos == 0 && jjmatchedKind > 56) { ! jjmatchedKind = 56; } break; |
From: <dr...@us...> - 2003-05-13 05:29:20
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/engine In directory sc8-pr-cvs1:/tmp/cvs-serv6730/src/org/webmacro/engine Added Files: MapBuilder.java Log Message: Experimental parser Map support using this syntax: #set $map = { "key" => "value", "key2" => "value2" --- NEW FILE: MapBuilder.java --- /* * Copyright (C) 1998-2000 Semiotek Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of either of the following * Open Source licenses: * * The GNU General Public License, version 2, or any later version, as * published by the Free Software Foundation * (http://www.fsf.org/copyleft/gpl.html); * * or * * The Semiotek Public License (http://webmacro.org/LICENSE.) * * This software is provided "as is", with NO WARRANTY, not even the * implied warranties of fitness to purpose, or merchantability. You * assume all risks and liabilities associated with its use. * * See www.webmacro.org for more information on the WebMacro project. */ package org.webmacro.engine; import org.webmacro.Macro; import org.webmacro.FastWriter; import org.webmacro.Context; import org.webmacro.PropertyException; import java.util.HashMap; import java.util.Map; import java.util.Iterator; import java.io.IOException; /** * MapBuilder is used during the parsing/building phase of a template to create * user defined Map types, using a syntax that is similar to:<pre> * #set $map = { "key" => "value", "key2" => "value2" } * </pre> * * MapBuilder ultimately creates a Map that understands <code>org.webmacro.Macro</code>'s * for <i>keys</i> and <i>values</i>, so $Variable references are okay for both. * * @author e_ridge * @since May 13, 2003 */ public class MapBuilder extends HashMap implements Builder { public Object build(BuildContext pc) throws BuildException { Map ret = new HashMap (size()); boolean isMacro = false; for (Iterator itr = entrySet().iterator(); itr.hasNext();) { Map.Entry entry = (Map.Entry) itr.next(); Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof Builder) key = ((Builder) key).build(pc); if (value instanceof Builder) value = ((Builder) value).build(pc); if (!isMacro) isMacro = key instanceof Macro || value instanceof Macro; ret.put (key, value); } if (isMacro) return new MapMacro (ret); else return ret; } } class MapMacro implements Macro { private final Map _map; MapMacro (Map map) { _map = map; } public void write(FastWriter out, Context context) throws PropertyException, IOException { out.write (evaluate(context).toString()); } public String toString() { return _map.toString(); } public Object evaluate(Context context) throws PropertyException { Map ret = new HashMap (_map.size()); for (Iterator itr =_map.entrySet().iterator(); itr.hasNext();) { Map.Entry entry = (Map.Entry) itr.next(); Object key = entry.getKey(); Object value = entry.getValue(); if (key instanceof Macro) key = ((Macro) key).evaluate(context); if (value instanceof Macro) value = ((Macro) value).evaluate(context); ret.put (key, value); } return ret; } } |
From: <wan...@us...> - 2003-04-03 20:53:16
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv6439 Modified Files: WMServlet.java Log Message: Made some private methods protected, and added helper methods for getting error var name and error template. Makes WMServlet more extensible. Index: WMServlet.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/WMServlet.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** WMServlet.java 29 Jan 2003 04:25:48 -0000 1.53 --- WMServlet.java 3 Apr 2003 20:53:05 -0000 1.54 *************** *** 72,76 **** * Log object used to write out messages */ ! private Log _log; /** --- 72,76 ---- * Log object used to write out messages */ ! protected Log _log; /** *************** *** 314,318 **** //Handler hand = new ErrorHandler(); try { ! context.put(getConfig(ERROR_VARIABLE, ERROR_VARIABLE_DEFAULT), error); //tmpl = hand.accept(context); --- 314,318 ---- //Handler hand = new ErrorHandler(); try { ! context.put(getErrorVariableName(), error); //tmpl = hand.accept(context); *************** *** 324,328 **** return tmpl; } ! /** * This object is used to access components that have been plugged --- 324,336 ---- return tmpl; } ! ! /** ! * <p>Returns the name of the error variable, as per the config.</p> ! * @return Name to use for the error variable in templates ! */ ! protected String getErrorVariableName(){ ! return getConfig(ERROR_VARIABLE, ERROR_VARIABLE_DEFAULT); ! } ! /** * This object is used to access components that have been plugged *************** *** 716,720 **** * this is only defined for JSDK 2.2+ */ ! private void setLocale(HttpServletResponse resp, Locale locale) { try { Method m = HttpServletResponse.class.getMethod( --- 724,728 ---- * this is only defined for JSDK 2.2+ */ ! protected void setLocale(HttpServletResponse resp, Locale locale) { try { Method m = HttpServletResponse.class.getMethod( *************** *** 762,774 **** */ public Template getErrorTemplate(){ ! String templateName; ! ! try { ! templateName = (String) _broker.get("config", ERROR_TEMPLATE); ! } ! catch (ResourceException e) { ! templateName = ERROR_TEMPLATE_DEFAULT; ! } ! try { _errorTemplate = (Template) _broker.get("template", templateName); --- 770,775 ---- */ public Template getErrorTemplate(){ ! String templateName = getErrorTemplateName(); ! try { _errorTemplate = (Template) _broker.get("template", templateName); *************** *** 780,783 **** return _errorTemplate; } ! } --- 781,797 ---- return _errorTemplate; } ! ! protected String getErrorTemplateName(){ ! String templateName; ! ! try { ! templateName = (String) _broker.get("config", ERROR_TEMPLATE); ! } ! catch (ResourceException e) { ! templateName = ERROR_TEMPLATE_DEFAULT; ! } ! return templateName; ! } ! ! } |
From: <dr...@us...> - 2003-04-03 18:11:27
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/util In directory sc8-pr-cvs1:/tmp/cvs-serv2961/org/webmacro/util Modified Files: LogSystem.java Log Message: Fixing bugs where log messages can be output multiple times. Index: LogSystem.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/util/LogSystem.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LogSystem.java 11 Jun 2002 17:43:23 -0000 1.4 --- LogSystem.java 3 Apr 2003 18:11:23 -0000 1.5 *************** *** 125,128 **** --- 125,146 ---- } + /** + * Remove the specified LogSystem instance from the internal + * cache of LogSystems. + */ + public static void removeInstance(LogSystem instance) { + synchronized (_instances) { + if (_instances.containsValue(instance)) { + for (Iterator itr = _instances.entrySet().iterator(); itr.hasNext();) { + Map.Entry e = (Map.Entry) itr.next(); + if (e.getValue() == instance) { + itr.remove(); + } + } + } + } + } + + ///////////////////////////////////////////// |
From: <dr...@us...> - 2003-04-03 18:11:27
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv2961/org/webmacro Modified Files: Broker.java Log Message: Fixing bugs where log messages can be output multiple times. Index: Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Broker.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Broker.java 27 Mar 2003 00:35:30 -0000 1.33 --- Broker.java 3 Apr 2003 18:11:19 -0000 1.34 *************** *** 749,752 **** --- 749,756 ---- if ( --_count == 0 ) { shutdown(); + + // make sure to cleanup the logging system + // if no more references to this Broker are around + LogSystem.removeInstance(_ls); } } |
From: <ke...@us...> - 2003-03-30 00:09:52
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory sc8-pr-cvs1:/tmp/cvs-serv6584 Modified Files: TestGetSet.java Log Message: Added testBinaryMutator() to test the various binary accessor/mutator combinations. Index: TestGetSet.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestGetSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestGetSet.java 23 Mar 2003 02:00:40 -0000 1.3 --- TestGetSet.java 30 Mar 2003 00:09:45 -0000 1.4 *************** *** 44,47 **** --- 44,62 ---- return objArray; } + + private java.util.HashMap myProps = new java.util.HashMap(); + + public Object getMyProp(String name){ + return myProps.get(name); + } + + public void setMyProp(String name, Object val){ + myProps.put(name, val); + } + + public java.util.Map getProps(){ + return myProps; + } + } *************** *** 117,120 **** --- 132,148 ---- assertStringTemplateEquals("$TestObject2.setObjectValue($foo)", ""); assertTrue(to2.obj == null); + } + + /** test the binary accessor/mutator syntax */ + public void testBinaryMutator() throws Exception { + String tmpl = "#set $TestObject.ObjectValue='foo'"; + assertStringTemplateEquals(tmpl, ""); + assertTrue(to.obj.equals("foo")); + + tmpl = "#set $TestObject.MyProp.Foo='Bar'\n$TestObject.MyProp.Foo"; + assertStringTemplateEquals(tmpl, "Bar"); + + tmpl = "#set $TestObject.Props.MyProp=123\n$TestObject.Props.MyProp"; + assertStringTemplateEquals(tmpl, "123"); } |
From: <ke...@us...> - 2003-03-28 02:46:05
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv24328 Modified Files: MathTool.java Log Message: Fixed bug in random(). Added main method with a test. Index: MathTool.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/MathTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MathTool.java 10 Nov 2002 21:26:54 -0000 1.5 --- MathTool.java 28 Mar 2003 02:46:00 -0000 1.6 *************** *** 99,103 **** */ public static final int random(int start, int end) { ! return start + (int) (end *java.lang.Math.random()/(Integer.MAX_VALUE+1.0)); } --- 99,103 ---- */ public static final int random(int start, int end) { ! return start + (int)((end - start + 1) * java.lang.Math.random()); } *************** *** 186,189 **** --- 186,198 ---- */ public void destroy(Object o) { + } + + public static void main(String[] args){ + System.out.println("Generating 200 random ints between 10 and 99 inclusive:"); + for (int i=0; i<200; i++){ + System.out.print(MathTool.random(10, 99) + " "); + if (((i + 1) % 20) == 0) System.out.println(); + } + System.out.println("\nDone."); } } |
From: <dat...@us...> - 2003-03-27 06:08:12
|
Update of /cvsroot/webmacro/wiki/src/org/tcdi/opensource/wiki In directory sc8-pr-cvs1:/tmp/cvs-serv7773/src/org/tcdi/opensource/wiki Modified Files: Tag: christian WikiUtil.java Log Message: Changes to allow Wiki to handle pages that contain numbers in their names Index: WikiUtil.java =================================================================== RCS file: /cvsroot/webmacro/wiki/src/org/tcdi/opensource/wiki/WikiUtil.java,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -C2 -d -r1.1.1.1 -r1.1.1.1.2.1 *** WikiUtil.java 30 Sep 2001 08:28:28 -0000 1.1.1.1 --- WikiUtil.java 27 Mar 2003 06:08:08 -0000 1.1.1.1.2.1 *************** *** 1,41 **** /** ! * The contents of this file are subject to the Mozilla Public ! * License Version 1.1 (the "License"); you may not use this file ! * except in compliance with the License. You may obtain a copy of ! * the License at http://www.mozilla.org/MPL/ ! * ! * Software distributed under the License is distributed on an "AS ! * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or ! * implied. See the License for the specific language governing ! * rights and limitations under the License. ! * ! * The Original Code is Wiki. ! * ! * The Initial Developer of the Original Code is Technology Concepts ! * and Design, Inc. ! * Copyright (C) 2000 Technology Concepts and Design, Inc. All ! * Rights Reserved. ! * ! * Contributor(s): Lane Sharman (OpenDoors Software) ! * Justin Wells (Semiotek Inc.) ! * Eric B. Ridge (Technology Concepts and Design, Inc.) ! * ! * Alternatively, the contents of this file may be used under the ! * terms of the GNU General Public License Version 2 or later (the ! * "GPL"), in which case the provisions of the GPL are applicable ! * instead of those above. If you wish to allow use of your ! * version of this file only under the terms of the GPL and not to ! * allow others to use your version of this file under the MPL, ! * indicate your decision by deleting the provisions above and ! * replace them with the notice and other provisions required by ! * the GPL. If you do not delete the provisions above, a recipient ! * may use your version of this file under either the MPL or the ! * GPL. ! * ! * ! * This product includes sofware developed by OpenDoors Software. ! * ! * This product includes software developed by Justin Wells and Semiotek Inc. ! * for use in the WebMacro ServletFramework (http://www.webmacro.org). */ package org.tcdi.opensource.wiki; --- 1,25 ---- /** ! * The contents of this file are subject to the Mozilla Public License Version ! * 1.1 (the "License"); you may not use this file except in compliance with the ! * License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ ! * Software distributed under the License is distributed on an "AS IS" basis, ! * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for ! * the specific language governing rights and limitations under the License. ! * The Original Code is Wiki. The Initial Developer of the Original Code is ! * Technology Concepts and Design, Inc. Copyright (C) 2000 Technology Concepts ! * and Design, Inc. All Rights Reserved. Contributor(s): Lane Sharman ! * (OpenDoors Software) Justin Wells (Semiotek Inc.) Eric B. Ridge (Technology ! * Concepts and Design, Inc.) Alternatively, the contents of this file may be ! * used under the terms of the GNU General Public License Version 2 or later ! * (the "GPL"), in which case the provisions of the GPL are applicable instead ! * of those above. If you wish to allow use of your version of this file only ! * under the terms of the GPL and not to allow others to use your version of ! * this file under the MPL, indicate your decision by deleting the provisions ! * above and replace them with the notice and other provisions required by the ! * GPL. If you do not delete the provisions above, a recipient may use your ! * version of this file under either the MPL or the GPL. This product includes ! * sofware developed by OpenDoors Software. This product includes software ! * developed by Justin Wells and Semiotek Inc. for use in the WebMacro ! * ServletFramework (http://www.webmacro.org). */ package org.tcdi.opensource.wiki; *************** *** 45,199 **** /** ! * A simple singleton to provide easy access to some ! * common, and mundane, WikiTasks. * ! * @author Eric B. Ridge */ public class WikiUtil { ! public static final int MAX_RANDOM_PAGES = 5; ! private static WikiUtil _instance = new WikiUtil (); ! ! /** return the only instance of the WikiUtil class */ ! public static WikiUtil getInstance() { ! return _instance; ! } - /** we're a singleton. can't create us! */ - private WikiUtil () { - - } - - /** - * Using the provided WikiSystem, guessWikiTitle() will find - * the fist page that most closely matches a wiki-fied version of - * the provided phrase by linearly searching pages in the WikiSystem, - * if the phrase isn't already an existing page. - * - * @param phrase the phrase to be guessed as a WikiTitle - * @param wiki the WikiSystem to use for linear searching - */ - public static String guessWikiTitle(String phrase, WikiSystem wiki) { - if (wiki.containsPage(phrase)) - return phrase; // instant match! - - String title = formatAsWikiTitle(phrase).toLowerCase(); - Enumeration enum = wiki.getPageNames(); - while (enum.hasMoreElements()) { // find first page that starts with title - String pageName = (String) enum.nextElement(); - if (pageName.toLowerCase().startsWith(title) && pageName.indexOf('.') == -1) - return pageName; - } - - return phrase; - } - - /** - * takes provided phrase and turns it into a WikiTerm by - * .toUpperCase() first letter, and first letter of each word. - * Strips all non-alpha characters - * - * @param phrase a phrase to convert to a WikiTerm - * @return a wiki-fied version of phrase - */ - public static String formatAsWikiTitle(String phrase) { - if (phrase == null) - return null; - - StringBuffer sb = new StringBuffer(); - - char[] chars = phrase.toCharArray(); - for (int x=0; x<chars.length; x++) { - if (x == 0 || chars[x-1] == ' ') - chars[x] = Character.toUpperCase(chars[x]); - - if (Character.isLetter(chars[x])) - sb.append(chars[x]); - } - - return sb.toString(); - } - - /** - * takes a WikiTerm and puts spaces between each term. - * example: WikiTerm --> Wiki Term - * - * @param word a propertly formed WikiTerm - * @return a spaced out version of word - */ - public static String unformatWikiTitle(String word) { - if (word == null) - return ""; - char[] chars = word.toCharArray(); - StringBuffer sb = new StringBuffer(chars.length); - int size = word.length(); - for (int x=0; x<size; x++) { - char ch = chars[x]; - if (x>0 && !Character.isLowerCase(ch)) - sb.append (" "); - sb.append (ch); - } - - - return sb.toString(); - } - - - /** - * returns a String array of 5 random wiki page names - */ - public static String[] getRandomPages(WikiSystem wiki) { - - java.util.Random r = new Random(); - String[] pageNames = wiki.getCurrentPageNames(); - String[] randomPages = new String[MAX_RANDOM_PAGES]; - for (int x=0; x<5; x++) - randomPages[x] = pageNames[r.nextInt(pageNames.length)]; ! return randomPages; ! } ! ! ! ! /** ! * @param str String to generate an MD5 with ! * @return a cookie-safe MD5 of provided string ! */ ! public static String getMD5(String str) { ! try { ! MessageDigest md = MessageDigest.getInstance("MD5"); ! md.update(str.getBytes()); ! byte[] bytes = md.digest(); ! return new String(makeCookieSafe(bytes)); ! } catch (Exception e) { ! throw new RuntimeException (e.toString()); ! } ! } ! ! /** ! * takes a byte[] and converts it to a char[] ! * that is safe to store as a cookie. ! */ ! private static char[] makeCookieSafe(byte[] bytes) { ! char[] chars = new String(bytes).toCharArray(); ! int BOT = 48; ! int TOP = 125; ! ! // I'm sure there's a better way to make sure ! // all characters are between BOT and TOP ! // but I'm too tired to think of it. ! for (int x=0; x<chars.length; x++) { ! while (chars[x] < BOT || chars[x] > TOP) { ! if (chars[x] < BOT) ! chars[x] += BOT; ! else if (chars[x] > TOP) ! chars[x] -= TOP; ! } ! ! if (chars[x] == ';') { // never allow a semi-colon as a value: change to BOT character ! // this is invalid inside a cookie ! chars[x] = (char) BOT; } ! } ! return chars; ! } } --- 29,214 ---- /** ! * A simple singleton to provide easy access to some common, and mundane, ! * WikiTasks. * ! * @author Eric B. Ridge */ public class WikiUtil { ! /** ! * Description of the Field ! */ ! public final static int MAX_RANDOM_PAGES = 5; ! private static WikiUtil _instance = new WikiUtil(); ! /** ! * we're a singleton. can't create us! ! */ ! private WikiUtil() { } ! ! ! /** ! * takes provided phrase and turns it into a WikiTerm by .toUpperCase() ! * first letter, and first letter of each word. Strips all non-alpha ! * characters ! * ! * @param phrase a phrase to convert to a WikiTerm ! * @return a wiki-fied version of phrase ! */ ! public static String formatAsWikiTitle(String phrase) { ! if (phrase == null) { ! return null; ! } ! ! StringBuffer sb = new StringBuffer(); ! ! char[] chars = phrase.toCharArray(); ! for (int x = 0; x < chars.length; x++) { ! if (x == 0 || chars[x - 1] == ' ') { ! chars[x] = Character.toUpperCase(chars[x]); ! } ! //accept page names consisting of letters and digits only ! if (Character.isLetter(chars[x]) || Character.isDigit(chars[x])) { ! sb.append(chars[x]); ! } ! } ! ! return sb.toString(); ! } ! ! ! /** ! * return the only instance of the WikiUtil class ! * ! * @return The instance value ! */ ! public static WikiUtil getInstance() { ! return _instance; ! } ! ! ! ! /** ! * @param str String to generate an MD5 with ! * @return a cookie-safe MD5 of provided string ! */ ! public static String getMD5(String str) { ! try { ! MessageDigest md = MessageDigest.getInstance("MD5"); ! md.update(str.getBytes()); ! byte[] bytes = md.digest(); ! return new String(makeCookieSafe(bytes)); ! } catch (Exception e) { ! throw new RuntimeException(e.toString()); ! } ! } ! ! ! /** ! * returns a String array of 5 random wiki page names ! * ! * @param wiki Description of the Parameter ! * @return The randomPages value ! */ ! public static String[] getRandomPages(WikiSystem wiki) { ! ! java.util.Random r = new Random(); ! String[] pageNames = wiki.getCurrentPageNames(); ! String[] randomPages = new String[MAX_RANDOM_PAGES]; ! for (int x = 0; x < 5; x++) { ! randomPages[x] = pageNames[r.nextInt(pageNames.length)]; ! } ! ! return randomPages; ! } ! ! ! /** ! * Using the provided WikiSystem, guessWikiTitle() will find the fist page ! * that most closely matches a wiki-fied version of the provided phrase by ! * linearly searching pages in the WikiSystem, if the phrase isn't already ! * an existing page. ! * ! * @param phrase the phrase to be guessed as a WikiTitle ! * @param wiki the WikiSystem to use for linear searching ! * @return Description of the Return Value ! */ ! public static String guessWikiTitle(String phrase, WikiSystem wiki) { ! if (wiki.containsPage(phrase)) { ! return phrase; ! } ! // instant match! ! ! String title = formatAsWikiTitle(phrase).toLowerCase(); ! Enumeration enum = wiki.getPageNames(); ! while (enum.hasMoreElements()) { ! // find first page that starts with title ! String pageName = (String) enum.nextElement(); ! if (pageName.toLowerCase().startsWith(title) && pageName.indexOf('.') == -1) { ! return pageName; ! } ! } ! ! return phrase; ! } ! ! ! /** ! * takes a byte[] and converts it to a char[] that is safe to store as a ! * cookie. ! * ! * @param bytes Description of the Parameter ! * @return Description of the Return Value ! */ ! private static char[] makeCookieSafe(byte[] bytes) { ! char[] chars = new String(bytes).toCharArray(); ! int BOT = 48; ! int TOP = 125; ! ! // I'm sure there's a better way to make sure ! // all characters are between BOT and TOP ! // but I'm too tired to think of it. ! for (int x = 0; x < chars.length; x++) { ! while (chars[x] < BOT || chars[x] > TOP) { ! if (chars[x] < BOT) { ! chars[x] += BOT; ! } else if (chars[x] > TOP) { ! chars[x] -= TOP; } ! } ! ! if (chars[x] == ';') { ! // never allow a semi-colon as a value: change to BOT character ! // this is invalid inside a cookie ! chars[x] = (char) BOT; ! } ! } ! return chars; ! } ! ! ! /** ! * takes a WikiTerm and puts spaces between each term. example: WikiTerm --> ! * Wiki Term ! * ! * @param word a propertly formed WikiTerm ! * @return a spaced out version of word ! */ ! public static String unformatWikiTitle(String word) { ! if (word == null) { ! return ""; ! } ! char[] chars = word.toCharArray(); ! StringBuffer sb = new StringBuffer(chars.length); ! int size = word.length(); ! for (int x = 0; x < size; x++) { ! char ch = chars[x]; ! if (x > 0 && !(Character.isLowerCase(ch) || Character.isDigit(ch))) { ! sb.append(" "); ! } ! sb.append(ch); ! } ! ! return sb.toString(); ! } } |
From: <ke...@us...> - 2003-03-27 05:16:35
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/engine In directory sc8-pr-cvs1:/tmp/cvs-serv21578 Modified Files: BuildContext.java MethodWrapper.java Variable.java Added Files: FunctionVariable.java Log Message: Added FunctionVariable class Removed final modifier from Variable.isSimpleName Changed BuildContext to handle FunctionVariables Changed MethodWrapper to handle null and void return types properly --- NEW FILE: FunctionVariable.java --- /* * FunctionVariable.java * * Created on March 21, 2003, 12:15 AM */ package org.webmacro.engine; import org.webmacro.Context; import org.webmacro.PropertyException; /** * * @author Keats */ public class FunctionVariable extends Variable { final public static Object TYPE = new Object(); /** Creates a new instance of FunctionVariable */ public FunctionVariable(Object names[]) { super(names); } /** The code to get the value represented by the variable from the * supplied context. * */ public Object getValue(Context context) throws PropertyException { return context.getProperty(_names[0]); } /** The code to set the value represented by the variable in the * supplied context. * */ public void setValue(Context c, Object v) throws PropertyException { throw new PropertyException("Cannot set the value of a function: " + _vname); } /** * Return the String name of the variable prefixed with a string * representing its type, in this case "function:". */ public String toString(){ return "function:" + _vname; } public boolean isSimpleName() { return false; } } Index: BuildContext.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/engine/BuildContext.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** BuildContext.java 15 Dec 2002 10:22:36 -0000 1.23 --- BuildContext.java 27 Mar 2003 05:16:32 -0000 1.24 *************** *** 62,68 **** } - - - /** * Find out whether the named variable is a tool, local variable, --- 62,65 ---- *************** *** 168,174 **** ((Builder) names[i]).build(this) : names[i]; } - String firstName = c[0].toString(); ! Object type = getVariableType(firstName); if (type == Variable.PROPERTY_TYPE) { if (containsKey(firstName)) { --- 165,176 ---- ((Builder) names[i]).build(this) : names[i]; } String firstName = c[0].toString(); ! Object type = null; ! if (c[0] instanceof FunctionCall){ ! type = FunctionVariable.TYPE; ! } ! else { ! type = getVariableType(firstName); ! } if (type == Variable.PROPERTY_TYPE) { if (containsKey(firstName)) { *************** *** 192,195 **** --- 194,200 ---- v = new GlobalVariable(c); } + else if (type == FunctionVariable.TYPE) { + v = new FunctionVariable(c); + } else { throw new BuildException("Unrecognized Variable Type: " + type); Index: MethodWrapper.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/engine/MethodWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MethodWrapper.java 11 Nov 2002 19:22:37 -0000 1.2 --- MethodWrapper.java 27 Mar 2003 05:16:33 -0000 1.3 *************** *** 1,31 **** /* ! * Copyright (C) 1998-2000 Semiotek Inc. All Rights Reserved. ! * ! * Redistribution and use in source and binary forms, with or without ! * modification, are permitted under the terms of either of the following ! * Open Source licenses: ! * ! * The GNU General Public License, version 2, or any later version, as ! * published by the Free Software Foundation ! * (http://www.fsf.org/copyleft/gpl.html); ! * ! * or ! * ! * The Semiotek Public License (http://webmacro.org/LICENSE.) ! * ! * This software is provided "as is", with NO WARRANTY, not even the ! * implied warranties of fitness to purpose, or merchantability. You ! * assume all risks and liabilities associated with its use. * ! * See www.webmacro.org for more information on the WebMacro project. */ package org.webmacro.engine; import java.lang.reflect.Method; import org.webmacro.*; ! /** * * @author Keats - * @since May 24, 2002 */ public class MethodWrapper { --- 1,15 ---- /* ! * MethodWrapper.java * ! * Created on May 24, 2002, 12:01 AM */ + package org.webmacro.engine; import java.lang.reflect.Method; import org.webmacro.*; ! import java.io.IOException; /** * * @author Keats */ public class MethodWrapper { *************** *** 76,85 **** Class[] types = IntrospectionUtils.createTypesFromArgs(args); for (int i = 0; i < _methods.length; i++){ ! Method m = _methods[i]; Class[] sig = m.getParameterTypes(); if (IntrospectionUtils.matches(sig,types)) { try { ! Object ret = _methods[i].invoke(_instance, args); ! return ret; } catch (Exception e){ --- 60,73 ---- Class[] types = IntrospectionUtils.createTypesFromArgs(args); for (int i = 0; i < _methods.length; i++){ ! Method m = (Method) _methods[i]; Class[] sig = m.getParameterTypes(); if (IntrospectionUtils.matches(sig,types)) { try { ! Object obj = m.invoke(_instance, args); ! if (obj == null ! && m.getReturnType() == java.lang.Void.TYPE) ! return org.webmacro.engine.VoidMacro.instance; ! else ! return obj; } catch (Exception e){ Index: Variable.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/engine/Variable.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Variable.java 11 Jun 2002 17:43:22 -0000 1.24 --- Variable.java 27 Mar 2003 05:16:33 -0000 1.25 *************** *** 134,138 **** * one element) */ ! public final boolean isSimpleName() { return (_names.length == 1); } --- 134,138 ---- * one element) */ ! public boolean isSimpleName() { return (_names.length == 1); } |
From: <ke...@us...> - 2003-03-27 05:10:02
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory sc8-pr-cvs1:/tmp/cvs-serv19326 Modified Files: TestFunction.java Log Message: added tests for functions that return null or void. Index: TestFunction.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestFunction.java 15 Jun 2002 05:50:35 -0000 1.1 --- TestFunction.java 27 Mar 2003 05:09:58 -0000 1.2 *************** *** 20,24 **** --- 20,37 ---- } + public void voidFunc1(){ + } + + public void voidFunc2(String dummyArg){ + if (dummyArg == null) throw new RuntimeException(); + } + + public Object nullFunc(){ + return null; + } + public void stuffContext (Context context) throws Exception { + context.setEvaluationExceptionHandler( + new org.webmacro.engine.CrankyEvaluationExceptionHandler()); context.putFunction("toList", java.util.Arrays.class, "asList"); context.putGlobalFunction("escape", org.webmacro.util.HTMLEscaper.class, "escape"); *************** *** 26,29 **** --- 39,45 ---- String abcs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; context.putFunction("mySubstr", abcs, "substring"); + context.putFunction("voidFunc1", this, "voidFunc1"); + context.putFunction("voidFunc2", this, "voidFunc2"); + context.putFunction("nullFunc", this, "nullFunc"); } *************** *** 43,46 **** --- 59,69 ---- assertStringTemplateEquals("$mySubstr(24)", "YZ"); assertStringTemplateEquals("$mySubstr(0,3)", "ABC"); + } + + public void testVoidFunction() throws Exception { + assertStringTemplateEquals("$voidFunc1()", ""); + assertStringTemplateEquals("$voidFunc2('bogus arg')", ""); + assertStringTemplateEquals("#if ($nullFunc()==null){true} #else {false}", "true"); + assertStringTemplateThrows("$nullFunc()", org.webmacro.PropertyException.NullValueException.class); } } |
From: <bri...@us...> - 2003-03-27 00:35:35
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv13677/src/org/webmacro/servlet Modified Files: Servlet20Broker.java Servlet22Broker.java ServletBroker.java Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: Servlet20Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/Servlet20Broker.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Servlet20Broker.java 11 Jun 2002 17:43:22 -0000 1.4 --- Servlet20Broker.java 27 Mar 2003 00:35:30 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- import java.io.*; import java.net.URL; + import java.util.*; import javax.servlet.*; *************** *** 45,57 **** protected ClassLoader _servletClassLoader; ! protected Servlet20Broker(ServletContext sc, ! ClassLoader cl) throws InitException { super(sc); _servletClassLoader = cl; ! String propertySource = WEBMACRO_DEFAULTS + ", " + WEBMACRO_PROPERTIES ! + ", " + "(System Properties)"; loadDefaultSettings(); loadSettings(WEBMACRO_PROPERTIES, true); loadSystemSettings(); initLog(_config); --- 46,63 ---- protected ClassLoader _servletClassLoader; ! private Servlet20Broker(ServletContext sc, ! ClassLoader cl, ! Properties additionalProperties) throws InitException { super(sc); _servletClassLoader = cl; ! String propertySource = WEBMACRO_DEFAULTS + ", " + WEBMACRO_PROPERTIES; loadDefaultSettings(); loadSettings(WEBMACRO_PROPERTIES, true); + if (additionalProperties != null && additionalProperties.keySet().size() > 0) { + propertySource += ", (additional Properties)"; + loadSettings(additionalProperties); + } + propertySource += ", (System Properties)"; loadSystemSettings(); initLog(_config); *************** *** 61,72 **** } ! public static Broker getBroker(Servlet s) throws InitException { ServletContext sc = s.getServletConfig().getServletContext(); ClassLoader cl = s.getClass().getClassLoader(); try { ! Broker b = findBroker(cl); if (b == null) { ! b = new Servlet20Broker(sc, cl); ! register(cl, b); } else --- 67,82 ---- } ! public static Broker getBroker(Servlet s, Properties additionalProperties) throws InitException { ServletContext sc = s.getServletConfig().getServletContext(); ClassLoader cl = s.getClass().getClassLoader(); try { ! Object key = cl; ! if (additionalProperties != null && additionalProperties.keySet().size() > 0) ! key = new PropertiesPair(cl, additionalProperties); ! ! Broker b = findBroker(key); if (b == null) { ! b = new Servlet20Broker(sc, cl, additionalProperties); ! register(key, b); } else Index: Servlet22Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/Servlet22Broker.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Servlet22Broker.java 27 Dec 2002 23:36:37 -0000 1.10 --- Servlet22Broker.java 27 Mar 2003 00:35:30 -0000 1.11 *************** *** 54,59 **** * in the application root. */ ! protected Servlet22Broker(ServletContext sc, ! ClassLoader cl) throws InitException { super(sc); _servletClassLoader = cl; --- 54,60 ---- * in the application root. */ ! private Servlet22Broker(ServletContext sc, ! ClassLoader cl, ! Properties additionalProperties) throws InitException { super(sc); _servletClassLoader = cl; *************** *** 67,72 **** propertySource += ", " + WEBMACRO_PROPERTIES; } ! propertySource += ", (WAR file)" + ", " + "(System Properties)"; loadServletSettings(Broker.SETTINGS_PREFIX); loadSystemSettings(); initLog(_config); --- 68,78 ---- propertySource += ", " + WEBMACRO_PROPERTIES; } ! propertySource += ", (WAR file)"; loadServletSettings(Broker.SETTINGS_PREFIX); + if (additionalProperties != null && additionalProperties.keySet().size() > 0) { + propertySource += ", (additional Properties)"; + loadSettings(additionalProperties); + } + propertySource += ", (System Properties)"; loadSystemSettings(); initLog(_config); *************** *** 104,115 **** ! public static Broker getBroker(Servlet s) throws InitException { ServletContext sc = s.getServletConfig().getServletContext(); ClassLoader cl = s.getClass().getClassLoader(); try { ! Broker b = findBroker(sc); if (b == null) { ! b = new Servlet22Broker(sc, cl); ! register(sc, b); } else --- 110,125 ---- ! public static Broker getBroker(Servlet s, Properties additionalProperties) throws InitException { ServletContext sc = s.getServletConfig().getServletContext(); ClassLoader cl = s.getClass().getClassLoader(); try { ! Object key = sc; ! if (additionalProperties != null && additionalProperties.keySet().size() > 0) ! key = new PropertiesPair(sc, additionalProperties); ! ! Broker b = findBroker(key); if (b == null) { ! b = new Servlet22Broker(sc, cl, additionalProperties); ! register(key, b); } else *************** *** 154,158 **** u = _servletClassLoader.getResource(name); } ! if (u == null) u = super.getResource(name); return u; --- 164,168 ---- u = _servletClassLoader.getResource(name); } ! if (u == null) u = super.getResource(name); return u; Index: ServletBroker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/ServletBroker.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ServletBroker.java 11 Jun 2002 17:43:22 -0000 1.5 --- ServletBroker.java 27 Mar 2003 00:35:30 -0000 1.6 *************** *** 32,35 **** --- 32,36 ---- package org.webmacro.servlet; + import java.util.*; import javax.servlet.*; *************** *** 56,60 **** } ! public static Broker getBroker(Servlet s) throws InitException { int minorVersion, majorVersion; --- 57,61 ---- } ! public static Broker getBroker(Servlet s, Properties additionalProperties) throws InitException { int minorVersion, majorVersion; *************** *** 72,84 **** if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) ! b = Servlet22Broker.getBroker(s); else ! b = Servlet20Broker.getBroker(s); b.startClient(); return b; } public ServletContext getServletContext() { return _servletContext; } } --- 73,118 ---- if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) ! b = Servlet22Broker.getBroker(s, additionalProperties); else ! b = Servlet20Broker.getBroker(s, additionalProperties); b.startClient(); return b; } + public static Broker getBroker(Servlet s) throws InitException { + return getBroker(s, null); + } + public ServletContext getServletContext() { return _servletContext; + } + + protected static final class PropertiesPair { + private final Object obj; + private final Properties p; + + public PropertiesPair(Object s, Properties p) { + this.obj = s; + this.p = p; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof PropertiesPair)) return false; + + final PropertiesPair servletPropertiesPair = (PropertiesPair) o; + + if (!p.equals(servletPropertiesPair.p)) return false; + if (!obj.equals(servletPropertiesPair.obj)) return false; + + return true; + } + + public int hashCode() { + int result; + result = obj.hashCode(); + result = 29 * result + p.hashCode(); + return result; + } } } |
From: <bri...@us...> - 2003-03-27 00:35:35
|
Update of /cvsroot/webmacro/webmacro/test In directory sc8-pr-cvs1:/tmp/cvs-serv13677/test Modified Files: build.xml Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: build.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/build.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** build.xml 10 Jan 2003 16:49:45 -0000 1.9 --- build.xml 27 Mar 2003 00:35:30 -0000 1.10 *************** *** 6,13 **** <property name="test" value="Test*" /> - <taskdef name="junit" - classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" /> - <path id="class.path"> <pathelement path="${java.class.path}" /> </path> --- 6,11 ---- <property name="test" value="Test*" /> <path id="class.path"> + <fileset dir="lib" includes="*.jar" /> <pathelement path="${java.class.path}" /> </path> *************** *** 24,27 **** --- 22,30 ---- <pathelement path="${java.class.path}" /> </path> + + <taskdef name="junit" + classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" > + <classpath refid="class.path"/> + </taskdef> |
From: <bri...@us...> - 2003-03-27 00:35:35
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser In directory sc8-pr-cvs1:/tmp/cvs-serv13677/src/org/webmacro/parser Modified Files: WMParser_impl.java WMParser_implTokenManager.java Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: WMParser_impl.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** WMParser_impl.java 15 Dec 2002 10:22:36 -0000 1.45 --- WMParser_impl.java 27 Mar 2003 00:35:30 -0000 1.46 *************** *** 37,41 **** this.broker = broker; this.templateName = templateName; - } --- 37,40 ---- Index: WMParser_implTokenManager.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implTokenManager.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** WMParser_implTokenManager.java 11 Nov 2002 04:53:12 -0000 1.23 --- WMParser_implTokenManager.java 27 Mar 2003 00:35:30 -0000 1.24 *************** *** 17,22 **** // Required by SetState void backup(int n) { input_stream.backup(n); } - public java.io.PrintStream debugStream = System.out; - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_4(int pos, long active0) { --- 17,20 ---- |
From: <bri...@us...> - 2003-03-27 00:35:35
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv13677/test/unit/org/webmacro Modified Files: TestMultipleInstances.java Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: TestMultipleInstances.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestMultipleInstances.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestMultipleInstances.java 23 Mar 2003 02:00:35 -0000 1.4 --- TestMultipleInstances.java 27 Mar 2003 00:35:31 -0000 1.5 *************** *** 1,4 **** --- 1,6 ---- package org.webmacro; + import java.util.*; + import junit.framework.TestCase; import org.webmacro.engine.StringTemplate; *************** *** 57,60 **** --- 59,94 ---- } + + public void testDefaultConstructor() throws InitException { + WM wm1 = new WM(); + WM wm2 = new WM(); + + assertEquals(wm1.toString(), wm2.toString()); + assertEquals(wm1.getBroker(), wm2.getBroker()); + + Properties p3 = new Properties(); + p3.put("foo", "goo"); + p3.put("moo", "zoo"); + + Properties p4 = new Properties(); + p4.put("foo", "goo"); + p4.put("moo", "zoo"); + + Properties p5 = new Properties(); + p5.put("foo", "goo"); + p5.put("moo", "zoo"); + p5.put("goo", "flu"); + + WM wm3 = new WM(p3); + WM wm4 = new WM(p4); + WM wm5 = new WM(p5); + assertTrue(wm1.getBroker() != wm3.getBroker()); + assertTrue(wm3.getBroker() == wm4.getBroker()); + assertTrue(wm3.getBroker() != wm5.getBroker()); + + p3.put("oops", "loops"); + WM wm6 = new WM(p3); + assertTrue(wm3.getBroker() != wm6.getBroker()); + } /** Execute a string as a template against the current context, |
From: <bri...@us...> - 2003-03-27 00:35:34
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv13677/src/org/webmacro Modified Files: Broker.java WM.java Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: Broker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/Broker.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Broker.java 23 Jul 2002 16:36:11 -0000 1.32 --- Broker.java 27 Mar 2003 00:35:30 -0000 1.33 *************** *** 122,125 **** --- 122,143 ---- } + /** + * Equivalent to Broker("WebMacro.properties"), except that it doesn't + * complain if WebMacro.properties can't be found, and it loads properties + * from a specified Properties. + */ + protected Broker(Properties props) throws InitException { + this( ( Broker ) null, "Ad-hoc Properties " + props.hashCode()); + String propertySource = WEBMACRO_DEFAULTS + ", " + WEBMACRO_PROPERTIES + + ", (caller-supplied Properties), (System Properties)"; + loadDefaultSettings(); + loadSettings( WEBMACRO_PROPERTIES, true ); + loadSettings(props); + loadSystemSettings(); + initLog(); + _log.notice( "Loaded settings from " + propertySource ); + init(); + } + /** * Search the classpath for the properties file under *************** *** 370,373 **** --- 388,408 ---- } + public static Broker getBroker(Properties p) throws InitException { + try { + Broker b = findBroker( p ); + if ( b == null ) { + b = new Broker(p); + register( p, b ); + } + b.startClient(); + return b; + } + catch ( InitException e ) { + Log log = LogSystem.getSystemLog( "wm" ); + log.error( "Failed to initialize WebMacro with default config" ); + throw e; + } + } + public static Broker getBroker( String settingsFile ) throws InitException { try { *************** *** 430,433 **** --- 465,472 ---- return false; } + + protected void loadSettings(Properties p) { + _config.load( p ); + } protected void loadSystemSettings() { Index: WM.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/WM.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** WM.java 27 Nov 2002 04:18:57 -0000 1.39 --- WM.java 27 Mar 2003 00:35:30 -0000 1.40 *************** *** 25,28 **** --- 25,29 ---- import java.io.*; + import java.util.*; import javax.servlet.*; import javax.servlet.http.*; *************** *** 73,76 **** --- 74,88 ---- /** + * Constructs a WM which gets its properties (optionally) from the + * file WebMacro.properties, as found on the class path, and from properties + * specified in a provided Properties. No servlet + * integration. Templates will be loaded from the class path or from + * TemplatePath. Most users will want to use the WM(Servlet) constructor. + */ + public WM(Properties p) throws InitException { + this(Broker.getBroker(p)); + } + + /** * Constructs a WM which gets its properties from the file specified, * which must exist on the class path or be an absolute path. No servlet *************** *** 90,93 **** --- 102,113 ---- this(ServletBroker.getBroker(s)); } + + /** + * Constructs a WM is tied to a Servlet broker, with an additional set of + * properties passed in from the caller. + */ + public WM(Servlet s, Properties additionalProperties) throws InitException { + this(ServletBroker.getBroker(s, additionalProperties)); + } /** |
From: <bri...@us...> - 2003-03-27 00:35:34
|
Update of /cvsroot/webmacro/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv13677 Modified Files: build.xml Log Message: Add WM(Properties), WM(Servlet, Properties), constructors and test case Index: build.xml =================================================================== RCS file: /cvsroot/webmacro/webmacro/build.xml,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** build.xml 4 Jan 2003 21:51:42 -0000 1.32 --- build.xml 27 Mar 2003 00:35:30 -0000 1.33 *************** *** 55,61 **** <property name="javacc.home" value="${ENV.JAVACC_HOME}" /> - <taskdef name="javacc" - classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC" /> - <path id="class.path"> <fileset dir="lib"> --- 55,58 ---- *************** *** 68,71 **** --- 65,73 ---- </path> <property name="classpath.resolved" refid="class.path"/> + + <taskdef name="javacc" + classname="org.apache.tools.ant.taskdefs.optional.javacc.JavaCC"> + <classpath refid="class.path"/> + </taskdef> <target name="prepare"> |
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv5682/test/unit/org/webmacro Modified Files: TestBroker.java TestContext.java TestFastWriter.java TestMultipleInstances.java TestStaticIdentityCM.java TestVersion.java Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: TestBroker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestBroker.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestBroker.java 21 Jun 2001 01:28:09 -0000 1.2 --- TestBroker.java 23 Mar 2003 02:00:34 -0000 1.3 *************** *** 31,35 **** _broker.setBrokerLocal ("MyName", "Mud"); ! assert (_broker.getBrokerLocal ("MyName") .toString().equals ("Mud")); } --- 31,35 ---- _broker.setBrokerLocal ("MyName", "Mud"); ! assertTrue (_broker.getBrokerLocal ("MyName") .toString().equals ("Mud")); } *************** *** 37,42 **** public void testGetSettings() throws Exception { Settings s = _broker.getSettings(); ! assert (s != null); ! assert (_broker.getSetting("ErrorTemplate") .equals ("error.wm")); } --- 37,42 ---- public void testGetSettings() throws Exception { Settings s = _broker.getSettings(); ! assertTrue (s != null); ! assertTrue (_broker.getSetting("ErrorTemplate") .equals ("error.wm")); } *************** *** 44,61 **** public void testGetProvider() throws Exception { Provider p = _broker.getProvider ("template"); ! assert (p != null); } public void testGetLog() throws Exception { Log l = _broker.getLog ("template"); ! assert (l != null); l = _broker.getLog ("NewLog"); ! assert (l != null); } public void testGetResource() throws Exception { java.net.URL url = _broker.getResource ("WebMacro.defaults"); ! assert (url != null); } } --- 44,61 ---- public void testGetProvider() throws Exception { Provider p = _broker.getProvider ("template"); ! assertTrue (p != null); } public void testGetLog() throws Exception { Log l = _broker.getLog ("template"); ! assertTrue (l != null); l = _broker.getLog ("NewLog"); ! assertTrue (l != null); } public void testGetResource() throws Exception { java.net.URL url = _broker.getResource ("WebMacro.defaults"); ! assertTrue (url != null); } } Index: TestContext.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestContext.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestContext.java 14 Dec 2001 05:58:29 -0000 1.1 --- TestContext.java 23 Mar 2003 02:00:34 -0000 1.2 *************** *** 28,32 **** _context.put ("Foo", null); Object o = _context.get("Foo"); ! assert (_context.get("Foo") == null); } --- 28,32 ---- _context.put ("Foo", null); Object o = _context.get("Foo"); ! assertTrue (_context.get("Foo") == null); } *************** *** 34,38 **** _context.put ("Foo", 123); Integer i = (Integer) _context.get ("Foo"); ! assert (i.intValue() == 123); } --- 34,38 ---- _context.put ("Foo", 123); Integer i = (Integer) _context.get ("Foo"); ! assertTrue (i.intValue() == 123); } *************** *** 40,44 **** _context.put ("Foo", true); Boolean b = (Boolean) _context.get ("Foo"); ! assert (b.booleanValue() == true); } --- 40,44 ---- _context.put ("Foo", true); Boolean b = (Boolean) _context.get ("Foo"); ! assertTrue (b.booleanValue() == true); } *************** *** 47,51 **** _context.put ("Foo", (byte)123); Byte b = (Byte) _context.get ("Foo"); ! assert (b.byteValue() == (byte) 123); } --- 47,51 ---- _context.put ("Foo", (byte)123); Byte b = (Byte) _context.get ("Foo"); ! assertTrue (b.byteValue() == (byte) 123); } *************** *** 53,57 **** _context.put ("Foo", (char)123); Character c = (Character) _context.get ("Foo"); ! assert (c.charValue() == (char)123); } --- 53,57 ---- _context.put ("Foo", (char)123); Character c = (Character) _context.get ("Foo"); ! assertTrue (c.charValue() == (char)123); } *************** *** 59,63 **** _context.put ("Foo", this.getClass()); Object o = _context.get ("Foo"); ! assert (o instanceof org.webmacro.engine.StaticClassWrapper); } --- 59,63 ---- _context.put ("Foo", this.getClass()); Object o = _context.get ("Foo"); ! assertTrue (o instanceof org.webmacro.engine.StaticClassWrapper); } *************** *** 65,69 **** _context.put ("Foo", 123.4D); Double d= (Double) _context.get ("Foo"); ! assert (d.doubleValue() == 123.4D); } --- 65,69 ---- _context.put ("Foo", 123.4D); Double d= (Double) _context.get ("Foo"); ! assertTrue (d.doubleValue() == 123.4D); } *************** *** 71,75 **** _context.put ("Foo", 123L); Long l = (Long) _context.get ("Foo"); ! assert (l.longValue() == 123L); } --- 71,75 ---- _context.put ("Foo", 123L); Long l = (Long) _context.get ("Foo"); ! assertTrue (l.longValue() == 123L); } *************** *** 77,81 **** _context.put ("Foo", (short) 123); Short s = (Short) _context.get ("Foo"); ! assert (s.shortValue() == (short) 123); } --- 77,81 ---- _context.put ("Foo", (short) 123); Short s = (Short) _context.get ("Foo"); ! assertTrue (s.shortValue() == (short) 123); } Index: TestFastWriter.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestFastWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestFastWriter.java 17 Dec 2002 06:45:29 -0000 1.1 --- TestFastWriter.java 23 Mar 2003 02:00:35 -0000 1.2 *************** *** 43,47 **** System.err.println (size + " bytes in " + ((end-start)/1000D) + " seconds."); ! assert (after.equals(data)); } --- 43,47 ---- System.err.println (size + " bytes in " + ((end-start)/1000D) + " seconds."); ! assertTrue (after.equals(data)); } Index: TestMultipleInstances.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestMultipleInstances.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestMultipleInstances.java 5 Jan 2002 22:19:33 -0000 1.3 --- TestMultipleInstances.java 23 Mar 2003 02:00:35 -0000 1.4 *************** *** 47,51 **** executeStringTemplate(_instanceOne, _instanceOne.getContext(), template); } catch (Exception e) { ! assert(e.toString().indexOf("No such directive #foo") > -1); } --- 47,51 ---- executeStringTemplate(_instanceOne, _instanceOne.getContext(), template); } catch (Exception e) { ! assertTrue(e.toString().indexOf("No such directive #foo") > -1); } *************** *** 54,58 **** System.err.println ("----------- instance 2 -----------------"); output = executeStringTemplate(_instanceTwo, _instanceTwo.getContext(), template); ! assert(output.equals("foo")); } --- 54,58 ---- System.err.println ("----------- instance 2 -----------------"); output = executeStringTemplate(_instanceTwo, _instanceTwo.getContext(), template); ! assertTrue(output.equals("foo")); } Index: TestStaticIdentityCM.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestStaticIdentityCM.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestStaticIdentityCM.java 27 Sep 2001 10:57:23 -0000 1.1 --- TestStaticIdentityCM.java 23 Mar 2003 02:00:36 -0000 1.2 *************** *** 47,51 **** } for (int i=0; i < THREADS; i++) { ! assert("Test integrity check failed in thread "+i, threads[i].correct); } --- 47,51 ---- } for (int i=0; i < THREADS; i++) { ! assertTrue("Test integrity check failed in thread "+i, threads[i].correct); } *************** *** 59,63 **** String key1 = new String("foo"); String key2 = new String("foo"); ! assert("test preconditions not met: keys should be different", key1 != key2 && key1.equals(key2)); Object cached1 = new Object(); --- 59,63 ---- String key1 = new String("foo"); String key2 = new String("foo"); ! assertTrue("test preconditions not met: keys should be different", key1 != key2 && key1.equals(key2)); Object cached1 = new Object(); *************** *** 65,71 **** cm.put(key1,cached1); cm.put(key2,cached2); ! assert("cm returned wrong object", cm.get(key1) == cached1); ! assert("cm returned wrong object", cm.get(key2) == cached2); } --- 65,71 ---- cm.put(key1,cached1); cm.put(key2,cached2); ! assertTrue("cm returned wrong object", cm.get(key1) == cached1); ! assertTrue("cm returned wrong object", cm.get(key2) == cached2); } Index: TestVersion.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestVersion.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestVersion.java 7 Jan 2003 06:30:30 -0000 1.3 --- TestVersion.java 23 Mar 2003 02:00:36 -0000 1.4 *************** *** 25,33 **** */ public void testVersion () throws Exception { ! assert (!WebMacro.VERSION.equals("@VERSION@")); } public void testBuildDate() throws Exception { ! assert (!WebMacro.BUILD_DATE.equals("@BUILD_DATE@")); } } --- 25,33 ---- */ public void testVersion () throws Exception { ! assertTrue (!WebMacro.VERSION.equals("@VERSION@")); } public void testBuildDate() throws Exception { ! assertTrue (!WebMacro.BUILD_DATE.equals("@BUILD_DATE@")); } } |
From: <lan...@us...> - 2003-03-23 02:01:09
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/engine In directory sc8-pr-cvs1:/tmp/cvs-serv5682/src/org/webmacro/engine Modified Files: MacroBuilder.java Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: MacroBuilder.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/engine/MacroBuilder.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MacroBuilder.java 15 Dec 2002 10:22:36 -0000 1.4 --- MacroBuilder.java 23 Mar 2003 02:00:34 -0000 1.5 *************** *** 39,42 **** --- 39,43 ---- private ListBuilder argsBuilder; private int lineNo, colNo; + private String[] nullArgs = new String[0]; public MacroBuilder(String name, *************** *** 54,59 **** public Object build(BuildContext bc) throws BuildException { MacroDefinition md = bc.getMacro(name); ! if (md == null) throw new BuildException ("#" + name + ": no such Macro or Directive"); Object[] args = argsBuilder.buildAsArray(bc); return md.expand(args, bc); --- 55,65 ---- public Object build(BuildContext bc) throws BuildException { MacroDefinition md = bc.getMacro(name); ! if (md == null) { ! boolean relax = bc.getBroker().getBooleanSetting("RelaxedDirectiveBuilding"); ! if (relax) ! return "#" + name + " "; ! else throw new BuildException ("#" + name + ": no such Macro or Directive"); + } Object[] args = argsBuilder.buildAsArray(bc); return md.expand(args, bc); |
From: <lan...@us...> - 2003-03-23 02:01:08
|
Update of /cvsroot/webmacro/webmacro/macros/html In directory sc8-pr-cvs1:/tmp/cvs-serv5682/macros/html Modified Files: frames.wmm Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: frames.wmm =================================================================== RCS file: /cvsroot/webmacro/webmacro/macros/html/frames.wmm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** frames.wmm 10 Jan 2003 16:49:45 -0000 1.2 --- frames.wmm 23 Mar 2003 02:00:33 -0000 1.3 *************** *** 20,25 **** 'popup', 'resizable=$scriptProps.resizeable,toolbar=no,status=no,location=no,scrollbars=yes,width=$scriptProps.width,height=$scriptProps.height,screenX=0,screenY=0,alwaysRaised=yes')"> ! $urlProps.hrefLabel</a> ! } ## splitWindow()(contentProps, frameProps) where: --- 20,24 ---- 'popup', 'resizable=$scriptProps.resizeable,toolbar=no,status=no,location=no,scrollbars=yes,width=$scriptProps.width,height=$scriptProps.height,screenX=0,screenY=0,alwaysRaised=yes')"> ! $urlProps.hrefLabel</a>} ## splitWindow()(contentProps, frameProps) where: |
From: <lan...@us...> - 2003-03-23 02:01:08
|
Update of /cvsroot/webmacro/webmacro/macros/ecomm In directory sc8-pr-cvs1:/tmp/cvs-serv5682/macros/ecomm Modified Files: all.wmm Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: all.wmm =================================================================== RCS file: /cvsroot/webmacro/webmacro/macros/ecomm/all.wmm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** all.wmm 17 Nov 2002 16:26:21 -0000 1.1 --- all.wmm 23 Mar 2003 02:00:32 -0000 1.2 *************** *** 4,5 **** --- 4,6 ---- } #include as macro "ecomm/paypal.wmm" + #include as macro "ecomm/verisign.wmm" |
From: <lan...@us...> - 2003-03-23 02:01:06
|
Update of /cvsroot/webmacro/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv5682 Modified Files: WebMacro.defaults Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: WebMacro.defaults =================================================================== RCS file: /cvsroot/webmacro/webmacro/WebMacro.defaults,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** WebMacro.defaults 3 Jan 2003 17:38:13 -0000 1.36 --- WebMacro.defaults 23 Mar 2003 02:00:31 -0000 1.37 *************** *** 100,104 **** - # # Error Handling --- 100,103 ---- *************** *** 163,166 **** --- 162,177 ---- # Don't change these values unless you know what you're doing. They # allow you to fine-tune, extend, and customize WebMacro's behavior. + + # + # Relaxed Directive Building. + # + # If set to true, text blocks produced by tools such as DreamWeaver + # and other html editors will not choke the parse/build phase + # when they introduce strings with a preceding # such as + # #ffffff, #BeginDirective and #Comment. By default the property is + # set to false. Therefore, WebMacro will fail fast on this type of text. + + RelaxedDirectiveBuilding: False + |
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template In directory sc8-pr-cvs1:/tmp/cvs-serv5682/test/unit/org/webmacro/template Modified Files: AbstractVariableTestCase.java EncodingTestCase.java TemplateTestCase.java TestAbuse.java TestBlocks.java TestCountDirective.java TestDirectiveParser.java TestGetSet.java TestIf.java TestMacro.java TestParseInclude.java TestShortCircuit.java ecomm.wm Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: AbstractVariableTestCase.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/AbstractVariableTestCase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractVariableTestCase.java 15 Dec 2002 07:21:24 -0000 1.4 --- AbstractVariableTestCase.java 23 Mar 2003 02:00:37 -0000 1.5 *************** *** 26,116 **** public void testGoodVariable () throws Exception { ! assert(false); } public void testGoodMethod () throws Exception { ! assert(false); } public void testGoodProperty () throws Exception { ! assert(false); } public void testNoSuchVariable () throws Exception { ! assert(false); } public void testNoSuchMethod () throws Exception { ! assert(false); } public void testNoSuchProperty () throws Exception { ! assert(false); } public void testVoidMethod () throws Exception { ! assert(false); } public void testNullMethod () throws Exception { ! assert(false); } public void testThrowsMethod() throws Exception { ! assert(false); } /** A variable in the context who's .toString() method returns null */ public void testNullVariable () throws Exception { ! assert(false); } public void testEvalGoodVariable () throws Exception { ! assert(false); } public void testEvalGoodMethod () throws Exception { ! assert(false); } public void testEvalGoodProperty () throws Exception { ! assert(false); } public void testEvalNoSuchVariable () throws Exception { ! assert(false); } public void testEvalNoSuchMethod () throws Exception { ! assert(false); } public void testNoSuchMethodWithArguments () throws Exception { ! assert(false); } public void testEvalNoSuchMethodWithArguments () throws Exception { ! assert(false); } public void testEvalNoSuchProperty () throws Exception { ! assert(false); } public void testEvalVoidMethod () throws Exception { ! assert(false); } public void testEvalNullMethod () throws Exception { ! assert(false); } public void testEvalThrowsMethod() throws Exception { ! assert(false); } public void testEvalNullVariable () throws Exception { ! assert(false); } --- 26,116 ---- public void testGoodVariable () throws Exception { ! assertTrue(false); } public void testGoodMethod () throws Exception { ! assertTrue(false); } public void testGoodProperty () throws Exception { ! assertTrue(false); } public void testNoSuchVariable () throws Exception { ! assertTrue(false); } public void testNoSuchMethod () throws Exception { ! assertTrue(false); } public void testNoSuchProperty () throws Exception { ! assertTrue(false); } public void testVoidMethod () throws Exception { ! assertTrue(false); } public void testNullMethod () throws Exception { ! assertTrue(false); } public void testThrowsMethod() throws Exception { ! assertTrue(false); } /** A variable in the context who's .toString() method returns null */ public void testNullVariable () throws Exception { ! assertTrue(false); } public void testEvalGoodVariable () throws Exception { ! assertTrue(false); } public void testEvalGoodMethod () throws Exception { ! assertTrue(false); } public void testEvalGoodProperty () throws Exception { ! assertTrue(false); } public void testEvalNoSuchVariable () throws Exception { ! assertTrue(false); } public void testEvalNoSuchMethod () throws Exception { ! assertTrue(false); } public void testNoSuchMethodWithArguments () throws Exception { ! assertTrue(false); } public void testEvalNoSuchMethodWithArguments () throws Exception { ! assertTrue(false); } public void testEvalNoSuchProperty () throws Exception { ! assertTrue(false); } public void testEvalVoidMethod () throws Exception { ! assertTrue(false); } public void testEvalNullMethod () throws Exception { ! assertTrue(false); } public void testEvalThrowsMethod() throws Exception { ! assertTrue(false); } public void testEvalNullVariable () throws Exception { ! assertTrue(false); } *************** *** 120,124 **** */ public void testEvaluationOfNullReturnValue() throws Exception { ! assert(false); } --- 120,124 ---- */ public void testEvaluationOfNullReturnValue() throws Exception { ! assertTrue(false); } Index: EncodingTestCase.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/EncodingTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EncodingTestCase.java 17 Oct 2001 10:03:24 -0000 1.2 --- EncodingTestCase.java 23 Mar 2003 02:00:37 -0000 1.3 *************** *** 164,173 **** protected void assertByteArrayEquals(byte[] a,byte[] b) throws Exception { if (a == b) return; ! assert("One byte array is null", ((a != null) && (b != null))); ! assert("Size of binary output differs", a.length == b.length); for (int i=0; i < a.length; i++) { ! assert("Binary output differs", a[i] == b[i]); } --- 164,173 ---- protected void assertByteArrayEquals(byte[] a,byte[] b) throws Exception { if (a == b) return; ! assertTrue("One byte array is null", ((a != null) && (b != null))); ! assertTrue("Size of binary output differs", a.length == b.length); for (int i=0; i < a.length; i++) { ! assertTrue("Binary output differs", a[i] == b[i]); } Index: TemplateTestCase.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TemplateTestCase.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** TemplateTestCase.java 15 Dec 2002 10:22:37 -0000 1.13 --- TemplateTestCase.java 23 Mar 2003 02:00:38 -0000 1.14 *************** *** 119,125 **** executeStringTemplate(template); if (result == null) ! assert (_context.get("assertEvalutionEquals") == null); else ! assert (result==null ? "null" : result.toString(), result.equals(_context.get("assertEvalutionEquals"))); } --- 119,125 ---- executeStringTemplate(template); if (result == null) ! assertTrue (_context.get("assertEvalutionEquals") == null); else ! assertTrue (result==null ? "null" : result.toString(), result.equals(_context.get("assertEvalutionEquals"))); } *************** *** 142,146 **** + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); ! assert (false); } } --- 142,146 ---- + "evaluate to /" + resultText + "/ " + "result=/" + result + "/"); ! assertTrue (false); } } *************** *** 163,167 **** + resultText + "/"); e.printStackTrace(); ! assert(false); } if (result == null) --- 163,167 ---- + resultText + "/"); e.printStackTrace(); ! assertTrue(false); } if (result == null) *************** *** 172,176 **** + " yielded /" + result + "/, expecting /" + resultText + "/"); ! assert(false); } } --- 172,176 ---- + " yielded /" + result + "/, expecting /" + resultText + "/"); ! assertTrue(false); } } *************** *** 197,201 **** + " yielded /" + result + "/, expecting throw " + exceptionClass); ! assert(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { --- 197,201 ---- + " yielded /" + result + "/, expecting throw " + exceptionClass); ! assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { *************** *** 203,207 **** + " threw " + caught.getClass() + ", expecting " + exceptionClass); ! assert(false); } else if (messageMatchText != null) { --- 203,207 ---- + " threw " + caught.getClass() + ", expecting " + exceptionClass); ! assertTrue(false); } else if (messageMatchText != null) { *************** *** 211,215 **** + " does not match /" + messageMatchText + "/"); ! assert(false); } } --- 211,215 ---- + " does not match /" + messageMatchText + "/"); ! assertTrue(false); } } *************** *** 240,244 **** + resultPattern + "/"); e.printStackTrace(System.err); ! assert(false); } if (result == null) --- 240,244 ---- + resultPattern + "/"); e.printStackTrace(System.err); ! assertTrue(false); } if (result == null) *************** *** 250,254 **** + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); ! assert(false); } } --- 250,254 ---- + " yielded /" + result + "/, expecting match /" + resultPattern + "/"); ! assertTrue(false); } } *************** *** 269,273 **** + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); ! assert(false); } else { caught = ((PropertyException)e).getCaught(); --- 269,273 ---- + " yielded /" + caught.getClass() + "/, expecting throw PropertyException"); ! assertTrue(false); } else { caught = ((PropertyException)e).getCaught(); *************** *** 279,283 **** + "PropertyException with caught exception " + exceptionClass); ! assert(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { --- 279,283 ---- + "PropertyException with caught exception " + exceptionClass); ! assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { *************** *** 286,290 **** + "PropertyException with caught exception " + exceptionClass); ! assert(false); } } --- 286,290 ---- + "PropertyException with caught exception " + exceptionClass); ! assertTrue(false); } } Index: TestAbuse.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestAbuse.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestAbuse.java 15 Dec 2002 07:21:24 -0000 1.7 --- TestAbuse.java 23 Mar 2003 02:00:38 -0000 1.8 *************** *** 66,70 **** public void testMultiLineIf () throws Exception { System.err.println ("NEED TO REVISIT: TestAbuse.testMultiLineIf()"); ! assert (true); // String tmpl = "#if (true\n&& true && true\n) {pass} #else {fail}"; // assertStringTemplateEquals (tmpl, "pass"); --- 66,70 ---- public void testMultiLineIf () throws Exception { System.err.println ("NEED TO REVISIT: TestAbuse.testMultiLineIf()"); ! assertTrue (true); // String tmpl = "#if (true\n&& true && true\n) {pass} #else {fail}"; // assertStringTemplateEquals (tmpl, "pass"); Index: TestBlocks.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestBlocks.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestBlocks.java 26 Nov 2002 06:54:45 -0000 1.7 --- TestBlocks.java 23 Mar 2003 02:00:38 -0000 1.8 *************** *** 89,93 **** String output = executeStringTemplate (tmpl); ! assert (output.indexOf ("should not be here") == -1); } --- 89,93 ---- String output = executeStringTemplate (tmpl); ! assertTrue (output.indexOf ("should not be here") == -1); } Index: TestCountDirective.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestCountDirective.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestCountDirective.java 11 Nov 2002 04:53:13 -0000 1.2 --- TestCountDirective.java 23 Mar 2003 02:00:39 -0000 1.3 *************** *** 40,44 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (i.intValue() == c.getCount()); } public void testCountBackwards () throws Exception { --- 40,44 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (i.intValue() == c.getCount()); } public void testCountBackwards () throws Exception { *************** *** 46,51 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (c.toString(), c.getCount() == 10); ! assert (i.toString(), i.intValue() == 1); } public void testCountByTwo () throws Exception { --- 46,51 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (c.toString(), c.getCount() == 10); ! assertTrue (i.toString(), i.intValue() == 1); } public void testCountByTwo () throws Exception { *************** *** 53,58 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (c.toString(), c.getCount() == 5); ! assert (i.toString(), i.intValue() == 9); } public void testCountByZero () throws Exception { --- 53,58 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (c.toString(), c.getCount() == 5); ! assertTrue (i.toString(), i.intValue() == 9); } public void testCountByZero () throws Exception { *************** *** 60,65 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (c.toString(), c.getCount() == 0); ! assert (i == null); } public void testCountForwardsWithNegativeStep () throws Exception { --- 60,65 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (c.toString(), c.getCount() == 0); ! assertTrue (i == null); } public void testCountForwardsWithNegativeStep () throws Exception { *************** *** 67,72 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (c.toString(), c.getCount() == 0); ! assert (i == null); } public void testCountBackwardsWithPositiveStep () throws Exception { --- 67,72 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (c.toString(), c.getCount() == 0); ! assertTrue (i == null); } public void testCountBackwardsWithPositiveStep () throws Exception { *************** *** 74,79 **** Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assert (c.toString(), c.getCount() == 0); ! assert (i == null); } } --- 74,79 ---- Integer i = (Integer) _context.get("i"); Counter c = (Counter) _context.get("Counter"); ! assertTrue (c.toString(), c.getCount() == 0); ! assertTrue (i == null); } } Index: TestDirectiveParser.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestDirectiveParser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestDirectiveParser.java 2 Mar 2002 14:23:47 -0000 1.4 --- TestDirectiveParser.java 23 Mar 2003 02:00:40 -0000 1.5 *************** *** 44,49 **** public void testBadDir() throws Exception { ! assertStringTemplateThrows("#doh", org.webmacro.engine.BuildException.class); } --- 44,56 ---- public void testBadDir() throws Exception { ! boolean relax = _wm.getBroker().getBooleanSetting("RelaxedDirectiveBuilding"); ! if (!relax) { ! assertStringTemplateThrows("#doh", org.webmacro.engine.BuildException.class); + } + else { + assertStringTemplateMatches("#doh", "#doh"); + } + } Index: TestGetSet.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestGetSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestGetSet.java 4 May 2001 00:39:29 -0000 1.2 --- TestGetSet.java 23 Mar 2003 02:00:40 -0000 1.3 *************** *** 69,97 **** assertStringTemplateEquals ("$TestObject.intField", "1"); assertStringTemplateEquals ("#set $TestObject.intField=2", ""); ! assert(to.intField == 2); to.intField = 1; assertStringTemplateEquals ("#set $TestObject.intField=$two", ""); ! assert(to.intField == 2); to.longField = 1; assertStringTemplateEquals ("$TestObject.longField", "1"); assertStringTemplateEquals ("#set $TestObject.longField=2", ""); ! assert(to.longField == 2); to.longField = 1; assertStringTemplateEquals ("$TestObject.longField", "1"); assertStringTemplateEquals ("#set $TestObject.longField=$twoLong", ""); ! assert(to.longField == 2); to.setInt(1); assertStringTemplateEquals ("$TestObject.Int", "1"); assertStringTemplateEquals ("#set $TestObject.Int=2", ""); ! assert(to.getInt() == 2); to.setInt(1); assertStringTemplateEquals ("$TestObject.Int", "1"); assertStringTemplateEquals ("#set $TestObject.Int=$two", ""); ! assert(to.getInt() == 2); } --- 69,97 ---- assertStringTemplateEquals ("$TestObject.intField", "1"); assertStringTemplateEquals ("#set $TestObject.intField=2", ""); ! assertTrue(to.intField == 2); to.intField = 1; assertStringTemplateEquals ("#set $TestObject.intField=$two", ""); ! assertTrue(to.intField == 2); to.longField = 1; assertStringTemplateEquals ("$TestObject.longField", "1"); assertStringTemplateEquals ("#set $TestObject.longField=2", ""); ! assertTrue(to.longField == 2); to.longField = 1; assertStringTemplateEquals ("$TestObject.longField", "1"); assertStringTemplateEquals ("#set $TestObject.longField=$twoLong", ""); ! assertTrue(to.longField == 2); to.setInt(1); assertStringTemplateEquals ("$TestObject.Int", "1"); assertStringTemplateEquals ("#set $TestObject.Int=2", ""); ! assertTrue(to.getInt() == 2); to.setInt(1); assertStringTemplateEquals ("$TestObject.Int", "1"); assertStringTemplateEquals ("#set $TestObject.Int=$two", ""); ! assertTrue(to.getInt() == 2); } *************** *** 116,120 **** to2.obj = new Object(); assertStringTemplateEquals("$TestObject2.setObjectValue($foo)", ""); ! assert(to2.obj == null); } --- 116,120 ---- to2.obj = new Object(); assertStringTemplateEquals("$TestObject2.setObjectValue($foo)", ""); ! assertTrue(to2.obj == null); } Index: TestIf.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestIf.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestIf.java 25 Nov 2002 05:21:33 -0000 1.3 --- TestIf.java 23 Mar 2003 02:00:40 -0000 1.4 *************** *** 15,19 **** public TestIf (String name) { super (name); ! System.setProperty("org.webmacro.LogLevel", "DEBUG"); } --- 15,19 ---- public TestIf (String name) { super (name); ! //System.setProperty("org.webmacro.LogLevel", "DEBUG"); } Index: TestMacro.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestMacro.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestMacro.java 15 Dec 2002 10:22:37 -0000 1.2 --- TestMacro.java 23 Mar 2003 02:00:41 -0000 1.3 *************** *** 5,11 **** import org.webmacro.*; import org.webmacro.engine.StringTemplate; ! import org.webmacro.engine.DefaultEvaluationExceptionHandler; ! import org.webmacro.engine.BuildException; ! import junit.framework.*; --- 5,11 ---- import org.webmacro.*; import org.webmacro.engine.StringTemplate; ! import org.webmacro.engine.DefaultEvaluationExceptionHandler; ! import org.webmacro.engine.BuildException; ! import junit.framework.*; *************** *** 20,28 **** context.put ("string", "Foo!"); } ! ! public void testUndefinedMacro() throws Exception { ! assertStringTemplateThrows ("#foo()", BuildException.class, "#foo: no such [M,m]acro or [D,d]irective at \\w+:\\d+\\.\\d+"); ! assertStringTemplateThrows ("#foo", BuildException.class, "#foo: no such [M,m]acro or [D,d]irective at \\w+:\\d+\\.\\d+"); ! } public void testNoArgs() throws Exception { --- 20,31 ---- context.put ("string", "Foo!"); } ! ! public void testUndefinedMacro() throws Exception { ! boolean relax = _wm.getBroker().getBooleanSetting("RelaxedDirectiveBuilding"); ! if (! relax) { ! assertStringTemplateThrows ("#foo()", BuildException.class, "#foo: no such [M,m]acro or [D,d]irective at \\w+:\\d+\\.\\d+"); ! assertStringTemplateThrows ("#foo", BuildException.class, "#foo: no such [M,m]acro or [D,d]irective at \\w+:\\d+\\.\\d+"); ! } ! } public void testNoArgs() throws Exception { Index: TestParseInclude.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestParseInclude.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TestParseInclude.java 21 Dec 2002 07:30:20 -0000 1.9 --- TestParseInclude.java 23 Mar 2003 02:00:41 -0000 1.10 *************** *** 65,71 **** ! // include /etc/password ! assertStringTemplateMatches("#include \"/etc/passwd\"", ! ".*root:.*"); // include http://www.yahoo.com/ --- 65,72 ---- ! // include the current directory build file ! String fileName = "\"" + System.getProperty("user.dir") + "/build.xml\""; ! assertStringTemplateMatches("#include " + fileName, ! ".*project.*"); // include http://www.yahoo.com/ *************** *** 95,98 **** --- 96,116 ---- + "#setVar($foo, \"brian\")\n" + "#showVar($foo)", "brian"); + + } + /** Tests that the property "RelaxedDirectiveBuilding" is properly interpreted. */ + public void testRelaxedDirectiveBuild() { + + boolean relax = _wm.getBroker().getBooleanSetting("RelaxedDirectiveBuilding"); + System.out.println("RelaxedDirectiveBuilding=" + relax); + try { + String input = "#ffffff #BeginTemplate # A Comment"; + String output = executeStringTemplate(input); + if (relax) assertEquals(input, output); + else fail("Exception not thrown when evaluating template."); + } + catch (Exception e) { + if (relax) + fail("relax = true but test template did not build"); + } } *************** *** 102,105 **** --- 120,130 ---- String value = executeFileTemplate("org/webmacro/template/ecomm.wm"); store(System.getProperty("user.dir") + "/" + "ecomm.html", value); + } + + /** executes out of the standard macro/ distribution. */ + public void testVerisignMacros() throws Exception { + // execute the pay pal eCommerce test case and store the output + String value = executeFileTemplate("org/webmacro/template/verisign.wm"); + store(System.getProperty("user.dir") + "/" + "verisign.html", value); } Index: TestShortCircuit.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/TestShortCircuit.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestShortCircuit.java 4 May 2001 00:39:29 -0000 1.2 --- TestShortCircuit.java 23 Mar 2003 02:00:41 -0000 1.3 *************** *** 57,61 **** String tmpl = "#if (true || $BM1.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assert (bm1.whichMethod == null); } --- 57,61 ---- String tmpl = "#if (true || $BM1.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assertTrue (bm1.whichMethod == null); } *************** *** 64,68 **** String tmpl = "#if ($TRUE || $BM1.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assert (bm1.whichMethod == null); } --- 64,68 ---- String tmpl = "#if ($TRUE || $BM1.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assertTrue (bm1.whichMethod == null); } *************** *** 72,77 **** String tmpl = "#if ((true && $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals(tmpl, "pass"); ! assert (bm1.whichMethod.equals ("gimmeTrue")); ! assert (bm2.whichMethod == null); } --- 72,77 ---- String tmpl = "#if ((true && $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals(tmpl, "pass"); ! assertTrue (bm1.whichMethod.equals ("gimmeTrue")); ! assertTrue (bm2.whichMethod == null); } *************** *** 81,86 **** String tmpl = "#if (($TRUE && $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals(tmpl, "pass"); ! assert (bm1.whichMethod.equals ("gimmeTrue")); ! assert (bm2.whichMethod == null); } --- 81,86 ---- String tmpl = "#if (($TRUE && $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals(tmpl, "pass"); ! assertTrue (bm1.whichMethod.equals ("gimmeTrue")); ! assertTrue (bm2.whichMethod == null); } *************** *** 91,101 **** String tmpl = "#if ((true || $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assert (bm1.whichMethod == null); ! assert (bm2.whichMethod == null); tmpl = "#if (true || $BM1.gimmeTrue() || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assert (bm1.whichMethod == null); ! assert (bm2.whichMethod == null); } --- 91,101 ---- String tmpl = "#if ((true || $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assertTrue (bm1.whichMethod == null); ! assertTrue (bm2.whichMethod == null); tmpl = "#if (true || $BM1.gimmeTrue() || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assertTrue (bm1.whichMethod == null); ! assertTrue (bm2.whichMethod == null); } *************** *** 106,111 **** String tmpl = "#if (($TRUE || $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assert (bm1.whichMethod == null); ! assert (bm2.whichMethod == null); } } --- 106,111 ---- String tmpl = "#if (($TRUE || $BM1.gimmeTrue()) || $BM2.gimmeTrue()) {pass} #else {fail}"; assertStringTemplateEquals (tmpl, "pass"); ! assertTrue (bm1.whichMethod == null); ! assertTrue (bm2.whichMethod == null); } } Index: ecomm.wm =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/ecomm.wm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ecomm.wm 26 Nov 2002 15:20:14 -0000 1.1 --- ecomm.wm 23 Mar 2003 02:00:41 -0000 1.2 *************** *** 8,11 **** --- 8,22 ---- ## see the paypalSetup macro for the property name specs. #bean $System = "java.lang.System" scope=static + + ## verisign data... + #bean $App = "org.webmacro.util.SparseProperties" scope=page onNew { + #set $App.LoginName = "lanesharman" + #set $App.PartnerName = "VeriSign" + } + #bean $Tran = "org.webmacro.util.SparseProperties" scope=page onNew { + #set $Tran.Amount = "100.00" + #set $Tran.TranType = "S" + } + #bean $cust = "org.webmacro.util.SparseProperties" scope=page onNew { #set $cust.firstName = $System.getProperty("user.name") |
From: <lan...@us...> - 2003-03-23 02:00:47
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util In directory sc8-pr-cvs1:/tmp/cvs-serv5682/test/unit/org/webmacro/util Modified Files: TestMathTool.java TestSettings.java Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: TestMathTool.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util/TestMathTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestMathTool.java 10 Nov 2002 21:26:55 -0000 1.1 --- TestMathTool.java 23 Mar 2003 02:00:42 -0000 1.2 *************** *** 20,24 **** for (int x=0; x<1000000; x++) { int rnd = MathTool.random(3, 5); ! assert (""+rnd, rnd >= 3 && rnd <=5); } } --- 20,24 ---- for (int x=0; x<1000000; x++) { int rnd = MathTool.random(3, 5); ! assertTrue (""+rnd, rnd >= 3 && rnd <=5); } } Index: TestSettings.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/util/TestSettings.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestSettings.java 4 May 2001 00:39:29 -0000 1.2 --- TestSettings.java 23 Mar 2003 02:00:42 -0000 1.3 *************** *** 23,47 **** // for (int i=0; i<k.length; i++) // System.out.println("/" + k[i] + "/" + s.getSetting(k[i]) + "/"); ! assert(s.getIntegerSetting("one") == 1); ! assert(s.getIntegerSetting("two") == 2); ! assert(s.getIntegerSetting("three") == 3); ! assert(s.getIntegerSetting("four") == 4); ! assert(s.getIntegerSetting("notthere", 0) == 0); ! assert(s.getSetting("a").equals("a")); ! assert(s.getSetting("b").equals("b")); ! assert(s.getSetting("c").equals("c")); ! assert(s.getSetting("d").equals("d")); ! assert(s.getSetting("e").equals("e")); ! assert(s.getSetting("f").equals("f")); ! assert(s.getSetting("a.b.c").equals("abc")); ! assert(s.getSetting("a.*.c").equals("astarc")); ! assert(s.getSetting("quoted").equals("quoted")); ! assert(s.getSetting("quoted2").equals("quoted2")); ! assert(s.getSetting("quoted3").equals(" quoted3 ")); ! assert(s.getSetting("with.spaces").equals("with spaces")); ! assert(s.getSetting("nothing").equals("")); ! assert(s.getSetting("alsonothing").equals("")); } --- 23,47 ---- // for (int i=0; i<k.length; i++) // System.out.println("/" + k[i] + "/" + s.getSetting(k[i]) + "/"); ! assertTrue(s.getIntegerSetting("one") == 1); ! assertTrue(s.getIntegerSetting("two") == 2); ! assertTrue(s.getIntegerSetting("three") == 3); ! assertTrue(s.getIntegerSetting("four") == 4); ! assertTrue(s.getIntegerSetting("notthere", 0) == 0); ! assertTrue(s.getSetting("a").equals("a")); ! assertTrue(s.getSetting("b").equals("b")); ! assertTrue(s.getSetting("c").equals("c")); ! assertTrue(s.getSetting("d").equals("d")); ! assertTrue(s.getSetting("e").equals("e")); ! assertTrue(s.getSetting("f").equals("f")); ! assertTrue(s.getSetting("a.b.c").equals("abc")); ! assertTrue(s.getSetting("a.*.c").equals("astarc")); ! assertTrue(s.getSetting("quoted").equals("quoted")); ! assertTrue(s.getSetting("quoted2").equals("quoted2")); ! assertTrue(s.getSetting("quoted3").equals(" quoted3 ")); ! assertTrue(s.getSetting("with.spaces").equals("with spaces")); ! assertTrue(s.getSetting("nothing").equals("")); ! assertTrue(s.getSetting("alsonothing").equals("")); } *************** *** 52,57 **** s.load("org/webmacro/util/settings2.properties"); ! assert(s.getSetting("a").equals("aa")); ! assert(s.getSetting("bb").equals("bb")); } --- 52,57 ---- s.load("org/webmacro/util/settings2.properties"); ! assertTrue(s.getSetting("a").equals("aa")); ! assertTrue(s.getSetting("bb").equals("bb")); } *************** *** 64,73 **** Settings ssss = new SubSettings(s, "sub.sub"); ! assert(s.getSetting("sub.sub.a").equals("a")); ! assert(ss.getSetting("sub.a").equals("a")); ! assert(ss.getSetting("a").equals("not a")); ! assert(sss.getSetting("a").equals("a")); ! assert(ssss.getSetting("a").equals("a")); ! assert(sssStar.getSetting("a").equals("default")); } } --- 64,73 ---- Settings ssss = new SubSettings(s, "sub.sub"); ! assertTrue(s.getSetting("sub.sub.a").equals("a")); ! assertTrue(ss.getSetting("sub.a").equals("a")); ! assertTrue(ss.getSetting("a").equals("not a")); ! assertTrue(sss.getSetting("a").equals("a")); ! assertTrue(ssss.getSetting("a").equals("a")); ! assertTrue(sssStar.getSetting("a").equals("default")); } } |
From: <lan...@us...> - 2003-03-23 02:00:45
|
Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/macrosandbox In directory sc8-pr-cvs1:/tmp/cvs-serv5682/test/unit/org/webmacro/template/macrosandbox Modified Files: basics.wmm Log Message: Updates include: RelaxedDirectiveBuilding Property. Test Cases for above property. assert() --> assertTrue() allowing compilation under java1.4 some additions/improvements to the standard macro library all tests run without error under jdk 1.3, solaris 2.8. some work needs to be done on test cases to remove unix dependencies. Index: basics.wmm =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/template/macrosandbox/basics.wmm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** basics.wmm 25 Nov 2002 23:55:26 -0000 1.1 --- basics.wmm 23 Mar 2003 02:00:41 -0000 1.2 *************** *** 12,14 **** #macro showVar($a) { #if ($a) { $a} } ! --- 12,16 ---- #macro showVar($a) { #if ($a) { $a} } ! ## the following is not a macro: ! ## #ffccdd #BeginDirective #EndDirective ! ## With RelaxedDirectiveChecking On These should pass on thru |
From: <dr...@us...> - 2003-03-12 17:53:38
|
Update of /cvsroot/webmacro/wiki/src/org/tcdi/opensource/wiki/parser In directory sc8-pr-cvs1:/tmp/cvs-serv23867/src/org/tcdi/opensource/wiki/parser Modified Files: WikiParserTokenManager.java wiki.jj Log Message: - parser fix to allow *'s and +'s in URL's - fix potential NPE's in HTMLURLRenderer when there is no _wiki Index: WikiParserTokenManager.java =================================================================== RCS file: /cvsroot/webmacro/wiki/src/org/tcdi/opensource/wiki/parser/WikiParserTokenManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WikiParserTokenManager.java 27 Nov 2002 07:06:32 -0000 1.4 --- WikiParserTokenManager.java 12 Mar 2003 17:53:33 -0000 1.5 *************** *** 487,491 **** break; case 38: ! if ((0xa7ffe06000000000L & l) == 0L) break; if (kind > 22) --- 487,491 ---- break; case 38: ! if ((0xa7ffec6000000000L & l) == 0L) break; if (kind > 22) *************** *** 494,498 **** break; case 39: ! if ((0xa7ffe06000000000L & l) == 0L) break; if (kind > 22) --- 494,498 ---- break; case 39: ! if ((0xa7ffec6000000000L & l) == 0L) break; if (kind > 22) *************** *** 501,505 **** break; case 40: ! if ((0xa7ffe06000000000L & l) != 0L) jjCheckNAddTwoStates(40, 41); break; --- 501,505 ---- break; case 40: ! if ((0xa7ffec6000000000L & l) != 0L) jjCheckNAddTwoStates(40, 41); break; Index: wiki.jj =================================================================== RCS file: /cvsroot/webmacro/wiki/src/org/tcdi/opensource/wiki/parser/wiki.jj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** wiki.jj 27 Nov 2002 07:06:32 -0000 1.7 --- wiki.jj 12 Mar 2003 17:53:33 -0000 1.8 *************** *** 68,72 **** | < #ALPHANUM: ["a"-"z", "A"-"Z", "0"-"9"] > | < #MAILCHARS: <ALPHANUM> | [".", "_", "-"] > ! | < #URLCHARS: <ALPHANUM> | ["/", ".", "?", "&", "%", "~", ":", "_", "-", "@", "=" ] > | < #UCASE_ALPHANUM: ["A"-"Z", "0"-"9"] > | < #LCASE_ALPHANUM: ["a"-"z", "0"-"9"] > --- 68,72 ---- | < #ALPHANUM: ["a"-"z", "A"-"Z", "0"-"9"] > | < #MAILCHARS: <ALPHANUM> | [".", "_", "-"] > ! | < #URLCHARS: <ALPHANUM> | ["/", ".", "?", "&", "%", "~", ":", "_", "-", "@", "=", "+", "*" ] > | < #UCASE_ALPHANUM: ["A"-"Z", "0"-"9"] > | < #LCASE_ALPHANUM: ["a"-"z", "0"-"9"] > |