Skip to content

Commit

Permalink
[#697] Encodings: Add more unit tests for unicode characters
Browse files Browse the repository at this point in the history
  • Loading branch information
opatrascoiu committed Aug 5, 2024
1 parent a09d6de commit 8ca66df
Show file tree
Hide file tree
Showing 20 changed files with 1,488 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void testCL3() throws Exception {
// DMN 1.3
doSingleModelTest("1.3", "0085-decision-services", "0085-decision-services-test-01", new Pair<>("caching", "true"));
doSingleModelTest("1.3", "0092-feel-lambda", "0092-feel-lambda-test-01");
doSingleModelTest("1.3", "0083-feel-unicode", "0083-feel-unicode-test-01");

// Extensions
doSingleModelTest("1.1", "9001-recursive-function", "9001-recursive-function-test-01");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void testCL3() throws Exception {
// DMN 1.3
doSingleModelTest("1.3","0085-decision-services", new Pair<>("caching", "true"));
doSingleModelTest("1.3","0092-feel-lambda");
doSingleModelTest("1.3","0083-feel-unicode");

// extensions
doSingleModelTest("1.1","9001-recursive-function");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"dmnVersion" : "1.1",
"modelVersion" : "2.0",
"platformVersion" : "1.0",
"dmnNamespaces" : [ "http://www.montera.com.au/spec/DMN/0083-feel-unicode" ],
"nativeNamespace" : "",
"types" : [ ],
"elements" : [ {
"@kind" : "decision",
"id" : "_decision_001",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_001",
"javaTypeName" : "Decision_001",
"knowledgeReferences" : [ ],
"name" : "decision_001",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision001Request",
"protoResponseName" : "proto.Decision001Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_001_a",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_001_a",
"javaTypeName" : "Decision_001_a",
"knowledgeReferences" : [ ],
"name" : "decision_001_a",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision001ARequest",
"protoResponseName" : "proto.Decision001AResponse",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_001_b",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "decision_001_b",
"javaTypeName" : "Decision_001_b",
"knowledgeReferences" : [ ],
"name" : "decision_001_b",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision001BRequest",
"protoResponseName" : "proto.Decision001BResponse",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_002",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_002",
"javaTypeName" : "Decision_002",
"knowledgeReferences" : [ ],
"name" : "decision_002",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision002Request",
"protoResponseName" : "proto.Decision002Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_003",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_003",
"javaTypeName" : "Decision_003",
"knowledgeReferences" : [ ],
"name" : "decision_003",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision003Request",
"protoResponseName" : "proto.Decision003Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_003_a",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_003_a",
"javaTypeName" : "Decision_003_a",
"knowledgeReferences" : [ ],
"name" : "decision_003_a",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision003ARequest",
"protoResponseName" : "proto.Decision003AResponse",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_004",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_004",
"javaTypeName" : "Decision_004",
"knowledgeReferences" : [ ],
"name" : "decision_004",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision004Request",
"protoResponseName" : "proto.Decision004Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_004_a",
"informationReferences" : [ ],
"javaOutputTypeName" : "java.lang.Number",
"javaParameterName" : "decision_004_a",
"javaTypeName" : "Decision_004_a",
"knowledgeReferences" : [ ],
"name" : "decision_004_a",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision004ARequest",
"protoResponseName" : "proto.Decision004AResponse",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_005",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "decision_005",
"javaTypeName" : "Decision_005",
"knowledgeReferences" : [ ],
"name" : "decision_005",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision005Request",
"protoResponseName" : "proto.Decision005Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_005_a",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "decision_005_a",
"javaTypeName" : "Decision_005_a",
"knowledgeReferences" : [ ],
"name" : "decision_005_a",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision005ARequest",
"protoResponseName" : "proto.Decision005AResponse",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_006",
"informationReferences" : [ ],
"javaOutputTypeName" : "com.gs.dmn.runtime.Context",
"javaParameterName" : "decision_006",
"javaTypeName" : "Decision_006",
"knowledgeReferences" : [ ],
"name" : "decision_006",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision006Request",
"protoResponseName" : "proto.Decision006Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_decision_007",
"informationReferences" : [ ],
"javaOutputTypeName" : "com.gs.dmn.runtime.Context",
"javaParameterName" : "decision_007",
"javaTypeName" : "Decision_007",
"knowledgeReferences" : [ ],
"name" : "decision_007",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Decision007Request",
"protoResponseName" : "proto.Decision007Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_endswith_001",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "endswith_001",
"javaTypeName" : "Endswith_001",
"knowledgeReferences" : [ ],
"name" : "endswith_001",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Endswith001Request",
"protoResponseName" : "proto.Endswith001Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_endswith_002",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "endswith_002",
"javaTypeName" : "Endswith_002",
"knowledgeReferences" : [ ],
"name" : "endswith_002",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Endswith002Request",
"protoResponseName" : "proto.Endswith002Response",
"transitiveRequiredInput" : [ ]
}, {
"@kind" : "decision",
"id" : "_substring_004",
"informationReferences" : [ ],
"javaOutputTypeName" : "Boolean",
"javaParameterName" : "substring_004",
"javaTypeName" : "Substring_004",
"knowledgeReferences" : [ ],
"name" : "substring_004",
"namespace" : "http://www.montera.com.au/spec/DMN/0083-feel-unicode",
"protoRequestName" : "proto.Substring004Request",
"protoResponseName" : "proto.Substring004Response",
"transitiveRequiredInput" : [ ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

import java.util.*;
import java.util.stream.Collectors;

@javax.annotation.Generated(value = {"decision.ftl", "decision_001"})
@com.gs.dmn.runtime.annotation.DRGElement(
namespace = "",
name = "decision_001",
label = "",
elementKind = com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
expressionKind = com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
hitPolicy = com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
rulesCount = -1
)
public class Decision_001 extends com.gs.dmn.runtime.JavaTimeDMNBaseDecision {
public static final com.gs.dmn.runtime.listener.DRGElement DRG_ELEMENT_METADATA = new com.gs.dmn.runtime.listener.DRGElement(
"",
"decision_001",
"",
com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
-1
);

public Decision_001() {
}

@java.lang.Override()
public java.lang.Number applyMap(java.util.Map<String, String> input_, com.gs.dmn.runtime.ExecutionContext context_) {
try {
return apply(context_);
} catch (Exception e) {
logError("Cannot apply decision 'Decision_001'", e);
return null;
}
}

public java.lang.Number apply(com.gs.dmn.runtime.ExecutionContext context_) {
try {
// Start decision 'decision_001'
com.gs.dmn.runtime.annotation.AnnotationSet annotationSet_ = context_ != null ? context_.getAnnotations() : null;
com.gs.dmn.runtime.listener.EventListener eventListener_ = context_ != null ? context_.getEventListener() : null;
com.gs.dmn.runtime.external.ExternalFunctionExecutor externalExecutor_ = context_ != null ? context_.getExternalFunctionExecutor() : null;
com.gs.dmn.runtime.cache.Cache cache_ = context_ != null ? context_.getCache() : null;
long decision_001StartTime_ = System.currentTimeMillis();
com.gs.dmn.runtime.listener.Arguments decision_001Arguments_ = new com.gs.dmn.runtime.listener.Arguments();
eventListener_.startDRGElement(DRG_ELEMENT_METADATA, decision_001Arguments_);

// Evaluate decision 'decision_001'
java.lang.Number output_ = lambda.apply(context_);

// End decision 'decision_001'
eventListener_.endDRGElement(DRG_ELEMENT_METADATA, decision_001Arguments_, output_, (System.currentTimeMillis() - decision_001StartTime_));

return output_;
} catch (Exception e) {
logError("Exception caught in 'decision_001' evaluation", e);
return null;
}
}

public com.gs.dmn.runtime.LambdaExpression<java.lang.Number> lambda =
new com.gs.dmn.runtime.LambdaExpression<java.lang.Number>() {
public java.lang.Number apply(Object... args_) {
com.gs.dmn.runtime.ExecutionContext context_ = 0 < args_.length ? (com.gs.dmn.runtime.ExecutionContext) args_[0] : null;
com.gs.dmn.runtime.annotation.AnnotationSet annotationSet_ = context_ != null ? context_.getAnnotations() : null;
com.gs.dmn.runtime.listener.EventListener eventListener_ = context_ != null ? context_.getEventListener() : null;
com.gs.dmn.runtime.external.ExternalFunctionExecutor externalExecutor_ = context_ != null ? context_.getExternalFunctionExecutor() : null;
com.gs.dmn.runtime.cache.Cache cache_ = context_ != null ? context_.getCache() : null;

return stringLength("\t");
}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

import java.util.*;
import java.util.stream.Collectors;

@javax.annotation.Generated(value = {"decision.ftl", "decision_001_a"})
@com.gs.dmn.runtime.annotation.DRGElement(
namespace = "",
name = "decision_001_a",
label = "",
elementKind = com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
expressionKind = com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
hitPolicy = com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
rulesCount = -1
)
public class Decision_001_a extends com.gs.dmn.runtime.JavaTimeDMNBaseDecision {
public static final com.gs.dmn.runtime.listener.DRGElement DRG_ELEMENT_METADATA = new com.gs.dmn.runtime.listener.DRGElement(
"",
"decision_001_a",
"",
com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
-1
);

public Decision_001_a() {
}

@java.lang.Override()
public java.lang.Number applyMap(java.util.Map<String, String> input_, com.gs.dmn.runtime.ExecutionContext context_) {
try {
return apply(context_);
} catch (Exception e) {
logError("Cannot apply decision 'Decision_001_a'", e);
return null;
}
}

public java.lang.Number apply(com.gs.dmn.runtime.ExecutionContext context_) {
try {
// Start decision 'decision_001_a'
com.gs.dmn.runtime.annotation.AnnotationSet annotationSet_ = context_ != null ? context_.getAnnotations() : null;
com.gs.dmn.runtime.listener.EventListener eventListener_ = context_ != null ? context_.getEventListener() : null;
com.gs.dmn.runtime.external.ExternalFunctionExecutor externalExecutor_ = context_ != null ? context_.getExternalFunctionExecutor() : null;
com.gs.dmn.runtime.cache.Cache cache_ = context_ != null ? context_.getCache() : null;
long decision_001_aStartTime_ = System.currentTimeMillis();
com.gs.dmn.runtime.listener.Arguments decision_001_aArguments_ = new com.gs.dmn.runtime.listener.Arguments();
eventListener_.startDRGElement(DRG_ELEMENT_METADATA, decision_001_aArguments_);

// Evaluate decision 'decision_001_a'
java.lang.Number output_ = lambda.apply(context_);

// End decision 'decision_001_a'
eventListener_.endDRGElement(DRG_ELEMENT_METADATA, decision_001_aArguments_, output_, (System.currentTimeMillis() - decision_001_aStartTime_));

return output_;
} catch (Exception e) {
logError("Exception caught in 'decision_001_a' evaluation", e);
return null;
}
}

public com.gs.dmn.runtime.LambdaExpression<java.lang.Number> lambda =
new com.gs.dmn.runtime.LambdaExpression<java.lang.Number>() {
public java.lang.Number apply(Object... args_) {
com.gs.dmn.runtime.ExecutionContext context_ = 0 < args_.length ? (com.gs.dmn.runtime.ExecutionContext) args_[0] : null;
com.gs.dmn.runtime.annotation.AnnotationSet annotationSet_ = context_ != null ? context_.getAnnotations() : null;
com.gs.dmn.runtime.listener.EventListener eventListener_ = context_ != null ? context_.getEventListener() : null;
com.gs.dmn.runtime.external.ExternalFunctionExecutor externalExecutor_ = context_ != null ? context_.getExternalFunctionExecutor() : null;
com.gs.dmn.runtime.cache.Cache cache_ = context_ != null ? context_.getCache() : null;

return stringLength("\uD83D\uDC0E");
}
};
}
Loading

0 comments on commit 8ca66df

Please sign in to comment.