|
8 | 8 | /*
|
9 | 9 | ==================================================================
|
10 | 10 | First created on: Mar/28/2021
|
11 |
| -Last modified on: Sep/27/2023 |
| 11 | +Last modified on: Oct/11/2023 |
12 | 12 |
|
13 | 13 | This application is meant for doing several hundred
|
14 | 14 | functional tests to provide as much coverage as possible to
|
@@ -6961,6 +6961,97 @@ composite FunctionalTests {
|
6961 | 6961 | } else {
|
6962 | 6962 | printStringLn("Testcase A51.21: Evaluation execution failed. Error=" + (rstring)error);
|
6963 | 6963 | }
|
| 6964 | + |
| 6965 | + // A51.22 (Nested expression pattern 22) |
| 6966 | + // The following is a rule used in a real-world use case at |
| 6967 | + // one of the best IBM Streams customers. It has the first and |
| 6968 | + // third subexpressions as self-enclosed. It then has the second |
| 6969 | + // subexpression with four levels of multi-level nested SEs. |
| 6970 | + // In that second SE, it evaluates certain conditions such that |
| 6971 | + // they will collectively contribute to returning a final false result. |
| 6972 | + // |
| 6973 | + // Tuple schema needed for this rule's data. |
| 6974 | + type NodeProperties_T = rstring ParentTool, rstring MES_CEID, rstring REV_CEID, |
| 6975 | + rstring EquipmentGroup, rstring FunctionalArea, rstring EntityType, |
| 6976 | + rstring Cluster, list<rstring> Processes, list<rstring> VirtualLines, |
| 6977 | + rstring OwnedBy, rstring Location, rstring CurrentSite, list<rstring> ToolGroups; |
| 6978 | + |
| 6979 | + type NodeStatus_T = list<rstring> Lots, rstring Availability, rstring Comments, |
| 6980 | + rstring EntityState, rstring Event, rstring StatusCategory1, |
| 6981 | + rstring StatusCategory2, rstring StatusCategory3, rstring StatusCategory4, |
| 6982 | + map<rstring,rstring> AttributesMap, rstring StatusCategory5, |
| 6983 | + rstring StatusCategory6,rstring StatusCategory7, rstring StatusCategory8, |
| 6984 | + rstring StatusCategory9, rstring UserName; |
| 6985 | + |
| 6986 | + type NodeV_T = NodeProperties_T Properties, NodeStatus_T Status, |
| 6987 | + timestamp PublishTime, rstring MWTimestamp; |
| 6988 | + |
| 6989 | + type Node_T = rstring Key, NodeV_T Value; |
| 6990 | + |
| 6991 | + // Variable declaration that uses the tuple schema defined above. |
| 6992 | + mutable Node_T myNode = (Node_T){}; |
| 6993 | + myNode.Value.Status.Event = "PATCHING"; |
| 6994 | + myNode.Value.Status.UserName = ""; |
| 6995 | + myNode.Value.Status.EntityState = ""; |
| 6996 | + myNode.Value.Properties.OwnedBy = 'SAD'; |
| 6997 | + myNode.Value.Status.Availability = "Down"; |
| 6998 | + myNode.Value.Status.StatusCategory2 = 'StatusCategory2'; |
| 6999 | + myNode.Value.Status.StatusCategory3 = 'StatusCategory3'; |
| 7000 | + myNode.Value.Status.StatusCategory4 = 'StatusCategory4'; |
| 7001 | + |
| 7002 | + _rule = "(Value.Status.Event equalsCI 'PATCHING') && ((Value.Status.UserName containsCI 'EWR') || (Value.Status.EntityState equalsCI 'ENGINEERING') || ((Value.Properties.OwnedBy containsCI 'FER') && ((Value.Status.Availability equalsCI 'Up') || ((Value.Status.Availability equalsCI 'Down') && (Value.Status.StatusCategory3 containsCI 'StatusCategory3'))))) && (Value.Status.StatusCategory4 equalsCI 'StatusCategory4')"; |
| 7003 | + result = eval_predicate(_rule, myNode, error, $EVAL_PREDICATE_TRACING); |
| 7004 | + |
| 7005 | + if(result == true) { |
| 7006 | + printStringLn("Testcase A51.22: Evaluation criteria is met."); |
| 7007 | + } else if(result == false && error == 0) { |
| 7008 | + printStringLn("Testcase A51.22: Evaluation criteria is not met."); |
| 7009 | + } else { |
| 7010 | + printStringLn("Testcase A51.22: Evaluation execution failed. Error=" + (rstring)error); |
| 7011 | + } |
| 7012 | + |
| 7013 | + // A51.23 (Nested expression pattern 23) |
| 7014 | + // The following rule is same as the previous one except |
| 7015 | + // it checks with a slightly different tuple attribute |
| 7016 | + // values to meet all the evaluation conditions and |
| 7017 | + // then to return true. |
| 7018 | + // |
| 7019 | + // Set these two tuple attributes to specific values. |
| 7020 | + myNode.Value.Status.UserName = "EWR"; |
| 7021 | + myNode.Value.Status.EntityState = "ENGINEERING"; |
| 7022 | + |
| 7023 | + _rule = "(Value.Status.Event equalsCI 'PATCHING') && ((Value.Status.UserName containsCI 'EWR') || (Value.Status.EntityState equalsCI 'ENGINEERING') || ((Value.Properties.OwnedBy containsCI 'SAD') && ((Value.Status.Availability equalsCI 'Up') || ((Value.Status.Availability equalsCI 'Down') && (Value.Status.StatusCategory3 containsCI 'StatusCategory3'))))) && (Value.Status.StatusCategory4 equalsCI 'StatusCategory4')"; |
| 7024 | + result = eval_predicate(_rule, myNode, error, $EVAL_PREDICATE_TRACING); |
| 7025 | + |
| 7026 | + if(result == true) { |
| 7027 | + printStringLn("Testcase A51.23: Evaluation criteria is met."); |
| 7028 | + } else if(result == false && error == 0) { |
| 7029 | + printStringLn("Testcase A51.23: Evaluation criteria is not met."); |
| 7030 | + } else { |
| 7031 | + printStringLn("Testcase A51.23: Evaluation execution failed. Error=" + (rstring)error); |
| 7032 | + } |
| 7033 | + |
| 7034 | + // A51.24 (Nested expression pattern 24) |
| 7035 | + // The following rule is same as the previous one except |
| 7036 | + // it checks with a slightly different tuple attribute |
| 7037 | + // values to meet all the evaluation conditions and |
| 7038 | + // then to return true. |
| 7039 | + // |
| 7040 | + // Set these three tuple attributes to specific values. |
| 7041 | + myNode.Value.Status.EntityState = "SIGNALING"; |
| 7042 | + myNode.Value.Properties.OwnedBy = 'D1D'; |
| 7043 | + myNode.Value.Status.Availability = "Up"; |
| 7044 | + |
| 7045 | + _rule = "(Value.Status.EntityState equalsCI 'SIGNALING') && ((Value.Properties.OwnedBy notStartsWithCI 'D1D') || ((Value.Properties.OwnedBy startsWithCI 'D1D') && (Value.Status.Availability equalsCI 'Up')))"; |
| 7046 | + result = eval_predicate(_rule, myNode, error, $EVAL_PREDICATE_TRACING); |
| 7047 | + |
| 7048 | + if(result == true) { |
| 7049 | + printStringLn("Testcase A51.24: Evaluation criteria is met."); |
| 7050 | + } else if(result == false && error == 0) { |
| 7051 | + printStringLn("Testcase A51.24: Evaluation criteria is not met."); |
| 7052 | + } else { |
| 7053 | + printStringLn("Testcase A51.24: Evaluation execution failed. Error=" + (rstring)error); |
| 7054 | + } |
6964 | 7055 | // -------------------------
|
6965 | 7056 |
|
6966 | 7057 | // A52.1 (list<TUPLE>)
|
|
0 commit comments