Skip to content

Commit

Permalink
[#697] Encodings: Add 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 eba5c56 commit 59a8f09
Show file tree
Hide file tree
Showing 9 changed files with 436 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ public void testCL2() throws Exception {
doSingleModelTest("1.1","0008-LX-arithmetic", "0008-LX-arithmetic-test-01");
doSingleModelTest("1.1","0009-invocation-arithmetic", "0009-invocation-arithmetic-test-01");
doSingleModelTest("1.1","0010-multi-output-U", "0010-multi-output-U-test-01");
doSingleModelTest("1.1","0102-feel-constants", "0102-feel-constants-test-01");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ protected String getExpectedPath() {

@Test
public void testCL2() throws Exception {
// DMN 1.1
doSingleModelTest("1.1", "0004-simpletable-U");
doSingleModelTest("1.1", "0005-simpletable-A");
doSingleModelTest("1.1", "0006-simpletable-P1");
doSingleModelTest("1.1","0007-simpletable-P2");
doSingleModelTest("1.1","0008-LX-arithmetic");
doSingleModelTest("1.1","0009-invocation-arithmetic");
doSingleModelTest("1.1","0010-multi-output-U");
doSingleModelTest("1.1","0102-feel-constants");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"dmnVersion" : "1.1",
"modelVersion" : "2.0",
"platformVersion" : "1.0",
"dmnNamespaces" : [ "https://github.com/dmn-tck/tck" ],
"nativeNamespace" : "",
"types" : [ ],
"elements" : [ {
"@kind" : "decision",
"id" : "d_Decision1",
"informationReferences" : [ ],
"javaOutputTypeName" : "String",
"javaParameterName" : "decision1",
"javaTypeName" : "Decision1",
"knowledgeReferences" : [ ],
"name" : "Decision1",
"namespace" : "https://github.com/dmn-tck/tck",
"protoRequestName" : "proto.Decision1Request",
"protoResponseName" : "proto.Decision1Response",
"transitiveRequiredInput" : [ ],
"typeRef" : {
"localName" : "string",
"namespace" : "http://www.omg.org/spec/FEEL/20140401"
}
}, {
"@kind" : "decision",
"id" : "d_Decision2",
"informationReferences" : [ ],
"javaOutputTypeName" : "String",
"javaParameterName" : "decision2",
"javaTypeName" : "Decision2",
"knowledgeReferences" : [ ],
"name" : "Decision2",
"namespace" : "https://github.com/dmn-tck/tck",
"protoRequestName" : "proto.Decision2Request",
"protoResponseName" : "proto.Decision2Response",
"transitiveRequiredInput" : [ ],
"typeRef" : {
"localName" : "string",
"namespace" : "http://www.omg.org/spec/FEEL/20140401"
}
}, {
"@kind" : "decision",
"id" : "d_Decision3",
"informationReferences" : [ ],
"javaOutputTypeName" : "String",
"javaParameterName" : "decision3",
"javaTypeName" : "Decision3",
"knowledgeReferences" : [ ],
"name" : "Decision3",
"namespace" : "https://github.com/dmn-tck/tck",
"protoRequestName" : "proto.Decision3Request",
"protoResponseName" : "proto.Decision3Response",
"transitiveRequiredInput" : [ ],
"typeRef" : {
"localName" : "string",
"namespace" : "http://www.omg.org/spec/FEEL/20140401"
}
}, {
"@kind" : "decision",
"id" : "d_Decision4",
"informationReferences" : [ ],
"javaOutputTypeName" : "String",
"javaParameterName" : "decision4",
"javaTypeName" : "Decision4",
"knowledgeReferences" : [ ],
"name" : "Decision4",
"namespace" : "https://github.com/dmn-tck/tck",
"protoRequestName" : "proto.Decision4Request",
"protoResponseName" : "proto.Decision4Response",
"transitiveRequiredInput" : [ ],
"typeRef" : {
"localName" : "string",
"namespace" : "http://www.omg.org/spec/FEEL/20140401"
}
} ]
}
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", "Decision1"})
@com.gs.dmn.runtime.annotation.DRGElement(
namespace = "",
name = "Decision1",
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 Decision1 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(
"",
"Decision1",
"",
com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
-1
);

public Decision1() {
}

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

public String apply(com.gs.dmn.runtime.ExecutionContext context_) {
try {
// Start decision 'Decision1'
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 decision1StartTime_ = System.currentTimeMillis();
com.gs.dmn.runtime.listener.Arguments decision1Arguments_ = new com.gs.dmn.runtime.listener.Arguments();
eventListener_.startDRGElement(DRG_ELEMENT_METADATA, decision1Arguments_);

// Evaluate decision 'Decision1'
String output_ = lambda.apply(context_);

// End decision 'Decision1'
eventListener_.endDRGElement(DRG_ELEMENT_METADATA, decision1Arguments_, output_, (System.currentTimeMillis() - decision1StartTime_));

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

public com.gs.dmn.runtime.LambdaExpression<String> lambda =
new com.gs.dmn.runtime.LambdaExpression<String>() {
public String 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 "foo bar";
}
};
}
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", "Decision2"})
@com.gs.dmn.runtime.annotation.DRGElement(
namespace = "",
name = "Decision2",
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 Decision2 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(
"",
"Decision2",
"",
com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
-1
);

public Decision2() {
}

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

public String apply(com.gs.dmn.runtime.ExecutionContext context_) {
try {
// Start decision 'Decision2'
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 decision2StartTime_ = System.currentTimeMillis();
com.gs.dmn.runtime.listener.Arguments decision2Arguments_ = new com.gs.dmn.runtime.listener.Arguments();
eventListener_.startDRGElement(DRG_ELEMENT_METADATA, decision2Arguments_);

// Evaluate decision 'Decision2'
String output_ = lambda.apply(context_);

// End decision 'Decision2'
eventListener_.endDRGElement(DRG_ELEMENT_METADATA, decision2Arguments_, output_, (System.currentTimeMillis() - decision2StartTime_));

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

public com.gs.dmn.runtime.LambdaExpression<String> lambda =
new com.gs.dmn.runtime.LambdaExpression<String>() {
public String 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 "šomeÚnicodeŠtriňg";
}
};
}
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", "Decision3"})
@com.gs.dmn.runtime.annotation.DRGElement(
namespace = "",
name = "Decision3",
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 Decision3 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(
"",
"Decision3",
"",
com.gs.dmn.runtime.annotation.DRGElementKind.DECISION,
com.gs.dmn.runtime.annotation.ExpressionKind.LITERAL_EXPRESSION,
com.gs.dmn.runtime.annotation.HitPolicy.UNKNOWN,
-1
);

public Decision3() {
}

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

public String apply(com.gs.dmn.runtime.ExecutionContext context_) {
try {
// Start decision 'Decision3'
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 decision3StartTime_ = System.currentTimeMillis();
com.gs.dmn.runtime.listener.Arguments decision3Arguments_ = new com.gs.dmn.runtime.listener.Arguments();
eventListener_.startDRGElement(DRG_ELEMENT_METADATA, decision3Arguments_);

// Evaluate decision 'Decision3'
String output_ = lambda.apply(context_);

// End decision 'Decision3'
eventListener_.endDRGElement(DRG_ELEMENT_METADATA, decision3Arguments_, output_, (System.currentTimeMillis() - decision3StartTime_));

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

public com.gs.dmn.runtime.LambdaExpression<String> lambda =
new com.gs.dmn.runtime.LambdaExpression<String>() {
public String 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 "横綱";
}
};
}
Loading

0 comments on commit 59a8f09

Please sign in to comment.