From 13341781daecfdb0eff4b456e3e6108ed6392b88 Mon Sep 17 00:00:00 2001 From: Octavian Patrascoiu Date: Mon, 20 May 2024 15:09:28 +0100 Subject: [PATCH] [#662] Remove double dialects --- ...ubleMixedJavaTimeDMNDialectDefinition.java | 100 ----- ...imeKotlinStandardDMNDialectDefinition.java | 101 ----- ...MixedJavaTimeDMNDialectDefinitionTest.java | 63 --- ...otlinStandardDMNDialectDefinitionTest.java | 63 --- .../DoubleMixedCL2DMNInterpreterTest.java | 29 -- .../DoubleMixedCL3DMNInterpreterTest.java | 34 -- .../PureCL3DMNInterpreterTest.java | 4 - .../feel/lib/DoubleMixedJavaTimeFEELLib.java | 82 ---- .../DoubleMixedJavaTimeDMNBaseDecision.java | 54 --- .../lib/DoubleMixedJavaTimeSignavioLib.java | 159 -------- ...ubleMixedJavaTimeSignavioBaseDecision.java | 58 --- ...bleMixedJavaTimeFEELLibExceptionsTest.java | 63 --- .../lib/DoubleMixedJavaTimeFEELLibTest.java | 363 ------------------ ...oubleMixedJavaTimeDMNBaseDecisionTest.java | 36 -- ...DoubleMixedJavaTimeJsonSerializerTest.java | 81 ---- .../DoubleMixedJavaTimeSignavioLibTest.java | 266 ------------- .../DoubleMixedSignavioLibExceptionsTest.java | 144 ------- ...imeKotlinSignavioDMNDialectDefinition.java | 101 ----- ...dJavaTimeSignavioDMNDialectDefinition.java | 101 ----- ...otlinSignavioDMNDialectDefinitionTest.java | 64 --- ...aTimeSignavioDMNDialectDefinitionTest.java | 64 --- 21 files changed, 2030 deletions(-) delete mode 100644 dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinition.java delete mode 100644 dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition.java delete mode 100644 dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinitionTest.java delete mode 100644 dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinitionTest.java delete mode 100644 dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL2DMNInterpreterTest.java delete mode 100644 dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL3DMNInterpreterTest.java delete mode 100644 dmn-runtime/src/main/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLib.java delete mode 100644 dmn-runtime/src/main/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecision.java delete mode 100644 dmn-runtime/src/main/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLib.java delete mode 100644 dmn-runtime/src/main/java/com/gs/dmn/signavio/runtime/DoubleMixedJavaTimeSignavioBaseDecision.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibExceptionsTest.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibTest.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecisionTest.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/serialization/DoubleMixedJavaTimeJsonSerializerTest.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLibTest.java delete mode 100644 dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedSignavioLibExceptionsTest.java delete mode 100644 dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition.java delete mode 100644 dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinition.java delete mode 100644 dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinitionTest.java delete mode 100644 dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinitionTest.java diff --git a/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinition.java b/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinition.java deleted file mode 100644 index eac6d4b6b..000000000 --- a/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinition.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.dialect; - -import com.gs.dmn.DMNModelRepository; -import com.gs.dmn.context.environment.EnvironmentFactory; -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.feel.lib.FEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeNativeTypeFactory; -import com.gs.dmn.feel.synthesis.type.NativeTypeFactory; -import com.gs.dmn.log.BuildLogger; -import com.gs.dmn.runtime.DoubleMixedJavaTimeDMNBaseDecision; -import com.gs.dmn.serialization.TypeDeserializationConfigurer; -import com.gs.dmn.tck.ast.TestCases; -import com.gs.dmn.transformation.DMNToJavaTransformer; -import com.gs.dmn.transformation.DMNToNativeTransformer; -import com.gs.dmn.transformation.DMNTransformer; -import com.gs.dmn.transformation.InputParameters; -import com.gs.dmn.transformation.basic.BasicDMNToJavaTransformer; -import com.gs.dmn.transformation.lazy.LazyEvaluationDetector; -import com.gs.dmn.transformation.template.TemplateProvider; -import com.gs.dmn.validation.DMNValidator; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeDMNDialectDefinition} - */ -@Deprecated -public class DoubleMixedJavaTimeDMNDialectDefinition extends AbstractStandardDMNDialectDefinition { - // - // DMN Processors - // - @Override - public DMNToNativeTransformer createDMNToNativeTransformer(DMNValidator dmnValidator, DMNTransformer dmnTransformer, TemplateProvider templateProvider, LazyEvaluationDetector lazyEvaluationDetector, TypeDeserializationConfigurer typeDeserializationConfigurer, InputParameters inputParameters, BuildLogger logger) { - return new DMNToJavaTransformer<>(this, dmnValidator, dmnTransformer, templateProvider, lazyEvaluationDetector, typeDeserializationConfigurer, inputParameters, logger); - } - - @Override - public BasicDMNToJavaTransformer createBasicTransformer(DMNModelRepository repository, LazyEvaluationDetector lazyEvaluationDetector, InputParameters inputParameters) { - EnvironmentFactory environmentFactory = createEnvironmentFactory(); - return new BasicDMNToJavaTransformer(this, repository, environmentFactory, createNativeTypeFactory(), lazyEvaluationDetector, inputParameters); - } - - // - // DMN execution - // - @Override - public NativeTypeFactory createNativeTypeFactory() { - return new DoubleMixedJavaTimeNativeTypeFactory(); - } - - @Override - public FEELLib createFEELLib() { - return new DoubleMixedJavaTimeFEELLib(); - } - - @Override - public String getDecisionBaseClass() { - return DoubleMixedJavaTimeDMNBaseDecision.class.getName(); - } - - @Override - public String getNativeNumberType() { - return Double.class.getName(); - } - - @Override - public String getNativeDateType() { - return LocalDate.class.getName(); - } - - @Override - public String getNativeTimeType() { - return OffsetTime.class.getName(); - } - - @Override - public String getNativeDateAndTimeType() { - return ZonedDateTime.class.getName(); - } - - @Override - public String getNativeDurationType() { - return Duration.class.getName(); - } -} diff --git a/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition.java b/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition.java deleted file mode 100644 index e072bc4ba..000000000 --- a/dmn-core/src/main/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.dialect; - -import com.gs.dmn.DMNModelRepository; -import com.gs.dmn.context.environment.EnvironmentFactory; -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.feel.lib.FEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeKotlinNativeTypeFactory; -import com.gs.dmn.feel.synthesis.type.NativeTypeFactory; -import com.gs.dmn.log.BuildLogger; -import com.gs.dmn.runtime.DoubleMixedJavaTimeDMNBaseDecision; -import com.gs.dmn.serialization.TypeDeserializationConfigurer; -import com.gs.dmn.tck.ast.TestCases; -import com.gs.dmn.transformation.DMNToKotlinTransformer; -import com.gs.dmn.transformation.DMNToNativeTransformer; -import com.gs.dmn.transformation.DMNTransformer; -import com.gs.dmn.transformation.InputParameters; -import com.gs.dmn.transformation.basic.BasicDMNToJavaTransformer; -import com.gs.dmn.transformation.basic.BasicDMNToKotlinTransformer; -import com.gs.dmn.transformation.lazy.LazyEvaluationDetector; -import com.gs.dmn.transformation.template.TemplateProvider; -import com.gs.dmn.validation.DMNValidator; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeKotlinStandardDMNDialectDefinition} - */ -@Deprecated -public class DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition extends AbstractStandardDMNDialectDefinition { - // - // DMN Processors - // - @Override - public DMNToNativeTransformer createDMNToNativeTransformer(DMNValidator dmnValidator, DMNTransformer dmnTransformer, TemplateProvider templateProvider, LazyEvaluationDetector lazyEvaluationDetector, TypeDeserializationConfigurer typeDeserializationConfigurer, InputParameters inputParameters, BuildLogger logger) { - return new DMNToKotlinTransformer<>(this, dmnValidator, dmnTransformer, templateProvider, lazyEvaluationDetector, typeDeserializationConfigurer, inputParameters, logger); - } - - @Override - public BasicDMNToJavaTransformer createBasicTransformer(DMNModelRepository repository, LazyEvaluationDetector lazyEvaluationDetector, InputParameters inputParameters) { - EnvironmentFactory environmentFactory = createEnvironmentFactory(); - return new BasicDMNToKotlinTransformer(this, repository, environmentFactory, createNativeTypeFactory(), lazyEvaluationDetector, inputParameters); - } - - // - // DMN execution - // - @Override - public NativeTypeFactory createNativeTypeFactory() { - return new DoubleMixedJavaTimeKotlinNativeTypeFactory(); - } - - @Override - public FEELLib createFEELLib() { - return new DoubleMixedJavaTimeFEELLib(); - } - - @Override - public String getDecisionBaseClass() { - return DoubleMixedJavaTimeDMNBaseDecision.class.getName(); - } - - @Override - public String getNativeNumberType() { - return Double.class.getName(); - } - - @Override - public String getNativeDateType() { - return LocalDate.class.getName(); - } - - @Override - public String getNativeTimeType() { - return OffsetTime.class.getName(); - } - - @Override - public String getNativeDateAndTimeType() { - return ZonedDateTime.class.getName(); - } - - @Override - public String getNativeDurationType() { - return Duration.class.getName(); - } -} diff --git a/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinitionTest.java b/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinitionTest.java deleted file mode 100644 index 561534053..000000000 --- a/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeDMNDialectDefinitionTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.dialect; - -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeNativeTypeFactory; -import com.gs.dmn.runtime.DoubleMixedJavaTimeDMNBaseDecision; -import com.gs.dmn.runtime.interpreter.StandardDMNInterpreter; -import com.gs.dmn.tck.ast.TestCases; -import com.gs.dmn.transformation.DMNToJavaTransformer; -import com.gs.dmn.transformation.basic.BasicDMNToJavaTransformer; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedJavaTimeDMNDialectDefinitionTest extends AbstractStandardDMNDialectDefinitionTest { - @Override - protected DMNDialectDefinition makeDialect() { - return new DoubleMixedJavaTimeDMNDialectDefinition(); - } - - @Override - protected String getExpectedDMNInterpreterClass() { - return StandardDMNInterpreter.class.getName(); - } - - @Override - protected String getExpectedDMNToNativeTransformerClass() { - return DMNToJavaTransformer.class.getName(); - } - - @Override - protected String getBasicTransformerClass() { - return BasicDMNToJavaTransformer.class.getName(); - } - - @Override - protected String getExpectedNativeTypeFactoryClass() { - return DoubleMixedJavaTimeNativeTypeFactory.class.getName(); - } - - @Override - protected String getExpectedFEELLibClass() { - return DoubleMixedJavaTimeFEELLib.class.getName(); - } - - @Override - protected String getExpectedDecisionBaseClass() { - return DoubleMixedJavaTimeDMNBaseDecision.class.getName(); - } -} \ No newline at end of file diff --git a/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinitionTest.java b/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinitionTest.java deleted file mode 100644 index 8f5f55ba2..000000000 --- a/dmn-core/src/test/java/com/gs/dmn/dialect/DoubleMixedJavaTimeKotlinStandardDMNDialectDefinitionTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.dialect; - -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeKotlinNativeTypeFactory; -import com.gs.dmn.runtime.DoubleMixedJavaTimeDMNBaseDecision; -import com.gs.dmn.runtime.interpreter.StandardDMNInterpreter; -import com.gs.dmn.tck.ast.TestCases; -import com.gs.dmn.transformation.DMNToKotlinTransformer; -import com.gs.dmn.transformation.basic.BasicDMNToKotlinTransformer; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedJavaTimeKotlinStandardDMNDialectDefinitionTest extends AbstractStandardDMNDialectDefinitionTest { - @Override - protected DMNDialectDefinition makeDialect() { - return new DoubleMixedJavaTimeKotlinStandardDMNDialectDefinition(); - } - - @Override - protected String getExpectedDMNInterpreterClass() { - return StandardDMNInterpreter.class.getName(); - } - - @Override - protected String getExpectedDMNToNativeTransformerClass() { - return DMNToKotlinTransformer.class.getName(); - } - - @Override - protected String getBasicTransformerClass() { - return BasicDMNToKotlinTransformer.class.getName(); - } - - @Override - protected String getExpectedNativeTypeFactoryClass() { - return DoubleMixedJavaTimeKotlinNativeTypeFactory.class.getName(); - } - - @Override - protected String getExpectedFEELLibClass() { - return DoubleMixedJavaTimeFEELLib.class.getName(); - } - - @Override - protected String getExpectedDecisionBaseClass() { - return DoubleMixedJavaTimeDMNBaseDecision.class.getName(); - } -} \ No newline at end of file diff --git a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL2DMNInterpreterTest.java b/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL2DMNInterpreterTest.java deleted file mode 100644 index 8fd184108..000000000 --- a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL2DMNInterpreterTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.runtime.interpreter; - -import com.gs.dmn.dialect.DMNDialectDefinition; -import com.gs.dmn.dialect.DoubleMixedJavaTimeDMNDialectDefinition; -import com.gs.dmn.tck.ast.TestCases; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedCL2DMNInterpreterTest extends CL2SDMNInterpreterTest { - @Override - protected DMNDialectDefinition getDialectDefinition() { - return new DoubleMixedJavaTimeDMNDialectDefinition(); - } -} diff --git a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL3DMNInterpreterTest.java b/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL3DMNInterpreterTest.java deleted file mode 100644 index 3ba5775c5..000000000 --- a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/DoubleMixedCL3DMNInterpreterTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.runtime.interpreter; - -import com.gs.dmn.dialect.DMNDialectDefinition; -import com.gs.dmn.dialect.DoubleMixedJavaTimeDMNDialectDefinition; -import com.gs.dmn.tck.ast.TestCases; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedCL3DMNInterpreterTest extends CL3DMNInterpreterTest { - @Override - protected DMNDialectDefinition getDialectDefinition() { - return new DoubleMixedJavaTimeDMNDialectDefinition(); - } - - @Override - protected String getTestCasesInputPath() { - return getDMNInputPath() + "/double-mixed"; - } -} diff --git a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/PureCL3DMNInterpreterTest.java b/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/PureCL3DMNInterpreterTest.java index 3e8d5cc8c..5442c28f9 100644 --- a/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/PureCL3DMNInterpreterTest.java +++ b/dmn-core/src/test/java/com/gs/dmn/runtime/interpreter/PureCL3DMNInterpreterTest.java @@ -13,15 +13,11 @@ package com.gs.dmn.runtime.interpreter; import com.gs.dmn.dialect.DMNDialectDefinition; -import com.gs.dmn.dialect.DoubleMixedJavaTimeDMNDialectDefinition; import com.gs.dmn.dialect.PureJavaTimeDMNDialectDefinition; import com.gs.dmn.tck.ast.TestCases; -import javax.xml.datatype.Duration; import java.math.BigDecimal; import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; diff --git a/dmn-runtime/src/main/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLib.java b/dmn-runtime/src/main/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLib.java deleted file mode 100644 index d2854ccb9..000000000 --- a/dmn-runtime/src/main/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLib.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.feel.lib; - -import com.gs.dmn.feel.lib.type.bool.BooleanLib; -import com.gs.dmn.feel.lib.type.bool.BooleanType; -import com.gs.dmn.feel.lib.type.context.ContextType; -import com.gs.dmn.feel.lib.type.function.FunctionType; -import com.gs.dmn.feel.lib.type.list.ListLib; -import com.gs.dmn.feel.lib.type.list.ListType; -import com.gs.dmn.feel.lib.type.numeric.DoubleNumericLib; -import com.gs.dmn.feel.lib.type.numeric.DoubleNumericType; -import com.gs.dmn.feel.lib.type.numeric.NumericLib; -import com.gs.dmn.feel.lib.type.numeric.NumericType; -import com.gs.dmn.feel.lib.type.range.RangeLib; -import com.gs.dmn.feel.lib.type.range.RangeType; -import com.gs.dmn.feel.lib.type.string.StringLib; -import com.gs.dmn.feel.lib.type.string.StringType; -import com.gs.dmn.feel.lib.type.time.*; -import com.gs.dmn.feel.lib.type.time.xml.DoubleDurationType; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeFEELLib} - */ -@Deprecated -public class DoubleMixedJavaTimeFEELLib extends BaseMixedJavaTimeFEELLib { - private static final NumericType NUMERIC_TYPE = new DoubleNumericType(); - private static final DurationType DURATION_TYPE = new DoubleDurationType(); - private static final NumericLib NUMERIC_LIB = new DoubleNumericLib(); - - public static final DoubleMixedJavaTimeFEELLib INSTANCE = new DoubleMixedJavaTimeFEELLib(); - - public DoubleMixedJavaTimeFEELLib() { - this(NUMERIC_TYPE, - DURATION_TYPE, - NUMERIC_LIB - ); - } - - protected DoubleMixedJavaTimeFEELLib( - NumericType numericType, - DurationType durationType, - NumericLib numericLib) { - super(numericType, durationType, numericLib); - } - - protected DoubleMixedJavaTimeFEELLib(NumericType numericType, BooleanType booleanType, StringType stringType, DateType dateType, TimeType timeType, DateTimeType dateTimeType, DurationType durationType, ListType listType, ContextType contextType, RangeType rangeType, FunctionType functionType, NumericLib numericLib, StringLib stringLib, BooleanLib booleanLib, DateTimeLib dateTimeLib, DurationLib durationLib, ListLib listLib, RangeLib rangeLib) { - super(numericType, booleanType, stringType, - dateType, timeType, dateTimeType, durationType, - listType, contextType, rangeType, functionType, - numericLib, stringLib, booleanLib, dateTimeLib, durationLib, listLib, rangeLib - ); - } - - // - // Extra conversion functions - // - @Override - protected Double valueOf(long number) { - return Double.valueOf(number); - } - - @Override - protected int intValue(Double number) { - return number.intValue(); - } -} diff --git a/dmn-runtime/src/main/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecision.java b/dmn-runtime/src/main/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecision.java deleted file mode 100644 index 2dd86822f..000000000 --- a/dmn-runtime/src/main/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecision.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.runtime; - -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.runtime.annotation.AnnotationTarget; -import com.gs.dmn.runtime.annotation.DRGElement; -import com.gs.dmn.runtime.annotation.Rule; - -import javax.xml.datatype.Duration; -import java.lang.reflect.Method; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; -import java.util.Map; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeDMNBaseDecision} - */ -@Deprecated -public class DoubleMixedJavaTimeDMNBaseDecision extends DoubleMixedJavaTimeFEELLib implements DMNDecision, AnnotationTarget { - @Override - public Object applyMap(Map input_, ExecutionContext context_) { - return null; - } - - @Override - public DRGElement getDRGElementAnnotation() { - return this.getClass().getAnnotation(DRGElement.class); - } - - @Override - public Rule getRuleAnnotation(int ruleIndex) { - String methodName = String.format("rule%d", ruleIndex); - Class cls = this.getClass(); - Method[] declaredMethods = cls.getDeclaredMethods(); - for (Method method : declaredMethods) { - if (methodName.equals(method.getName())) { - return method.getAnnotation(Rule.class); - } - } - return null; - } -} diff --git a/dmn-runtime/src/main/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLib.java b/dmn-runtime/src/main/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLib.java deleted file mode 100644 index d0151e11f..000000000 --- a/dmn-runtime/src/main/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLib.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.feel.lib; - -import com.gs.dmn.feel.lib.type.bool.BooleanLib; -import com.gs.dmn.feel.lib.type.bool.BooleanType; -import com.gs.dmn.feel.lib.type.bool.DefaultBooleanLib; -import com.gs.dmn.feel.lib.type.bool.DefaultBooleanType; -import com.gs.dmn.feel.lib.type.context.ContextType; -import com.gs.dmn.feel.lib.type.context.DefaultContextType; -import com.gs.dmn.feel.lib.type.function.DefaultFunctionType; -import com.gs.dmn.feel.lib.type.function.FunctionType; -import com.gs.dmn.feel.lib.type.list.DefaultListType; -import com.gs.dmn.feel.lib.type.list.ListType; -import com.gs.dmn.feel.lib.type.numeric.NumericType; -import com.gs.dmn.feel.lib.type.range.DefaultRangeType; -import com.gs.dmn.feel.lib.type.range.RangeType; -import com.gs.dmn.feel.lib.type.string.StringType; -import com.gs.dmn.feel.lib.type.time.*; -import com.gs.dmn.feel.lib.type.time.mixed.MixedDurationLib; -import com.gs.dmn.signavio.feel.lib.type.list.DefaultSignavioListLib; -import com.gs.dmn.signavio.feel.lib.type.list.SignavioListLib; -import com.gs.dmn.signavio.feel.lib.type.numeric.DoubleSignavioNumberLib; -import com.gs.dmn.signavio.feel.lib.type.numeric.DoubleSignavioNumericType; -import com.gs.dmn.signavio.feel.lib.type.numeric.SignavioNumberLib; -import com.gs.dmn.signavio.feel.lib.type.string.DefaultSignavioStringLib; -import com.gs.dmn.signavio.feel.lib.type.string.DefaultSignavioStringType; -import com.gs.dmn.signavio.feel.lib.type.string.SignavioStringLib; -import com.gs.dmn.signavio.feel.lib.type.time.SignavioDateTimeLib; -import com.gs.dmn.signavio.feel.lib.type.time.mixed.MixedSignavioDateTimeLib; -import com.gs.dmn.signavio.feel.lib.type.time.mixed.SignavioLocalDateType; -import com.gs.dmn.signavio.feel.lib.type.time.mixed.SignavioOffsetTimeType; -import com.gs.dmn.signavio.feel.lib.type.time.mixed.SignavioZonedDateTimeType; -import com.gs.dmn.signavio.feel.lib.type.time.xml.DoubleSignavioDurationType; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeSignavioLib} - */ -@Deprecated -public class DoubleMixedJavaTimeSignavioLib extends BaseSignavioLib { - private static final NumericType NUMERIC_TYPE = new DoubleSignavioNumericType(); - private static final BooleanType BOOLEAN_TYPE = new DefaultBooleanType(); - private static final StringType STRING_TYPE = new DefaultSignavioStringType(); - private static final DateType DATE_TYPE = new SignavioLocalDateType(); - private static final TimeType TIME_TYPE = new SignavioOffsetTimeType(); - private static final DateTimeType DATE_TIME_TYPE = new SignavioZonedDateTimeType(); - private static final DurationType DURATION_TYPE = new DoubleSignavioDurationType(); - private static final ListType LIST_TYPE = new DefaultListType(); - private static final ContextType CONTEXT_TYPE = new DefaultContextType(); - private static final RangeType RANGE_TYPE = new DefaultRangeType(); - private static final FunctionType FUNCTION_TYPE = new DefaultFunctionType(); - - private static final SignavioNumberLib NUMBER_LIB = new DoubleSignavioNumberLib(); - private static final SignavioStringLib STRING_LIB = new DefaultSignavioStringLib(); - private static final BooleanLib BOOLEAN_LIB = new DefaultBooleanLib(); - private static final SignavioDateTimeLib DATE_TIME_LIB = new MixedSignavioDateTimeLib(); - private static final DurationLib DURATION_LIB = new MixedDurationLib(); - private static final SignavioListLib LIST_LIB = new DefaultSignavioListLib(); - - public static final DoubleMixedJavaTimeSignavioLib INSTANCE = new DoubleMixedJavaTimeSignavioLib(); - - public DoubleMixedJavaTimeSignavioLib() { - this(NUMERIC_TYPE, - BOOLEAN_TYPE, - STRING_TYPE, - DATE_TYPE, - TIME_TYPE, - DATE_TIME_TYPE, - DURATION_TYPE, - LIST_TYPE, - CONTEXT_TYPE, - RANGE_TYPE, - FUNCTION_TYPE, - NUMBER_LIB, - STRING_LIB, - BOOLEAN_LIB, - DATE_TIME_LIB, - DURATION_LIB, - LIST_LIB - ); - } - - protected DoubleMixedJavaTimeSignavioLib( - NumericType numericType, BooleanType booleanType, StringType stringType, - DateType dateType, TimeType timeType, DateTimeType dateTimeType, DurationType durationType, - ListType listType, ContextType contextType, RangeType rangeType, FunctionType functionType, - SignavioNumberLib numberLib, - SignavioStringLib stringLib, - BooleanLib booleanLib, - SignavioDateTimeLib dateTimeLib, - DurationLib durationLib, - SignavioListLib listLib) { - super(numericType, booleanType, stringType, - dateType, timeType, dateTimeType, durationType, - listType, contextType, rangeType, functionType, - numberLib, stringLib, booleanLib, dateTimeLib, durationLib, listLib); - } - - // - // Date and time operations - // - public ZonedDateTime dayAdd(ZonedDateTime dateTime, Double daysToAdd) { - try { - return this.dateTimeLib.dayAddDateTime(dateTime, daysToAdd); - } catch (Exception e) { - String message = String.format("dayAdd(%s, %s)", dateTime, daysToAdd); - logError(message, e); - return null; - } - } - - public ZonedDateTime monthAdd(ZonedDateTime dateTime, Double monthsToAdd) { - try { - return this.dateTimeLib.monthAddDateTime(dateTime, monthsToAdd); - } catch (Exception e) { - String message = String.format("monthAdd(%s, %s)", dateTime, monthsToAdd); - logError(message, e); - return null; - } - } - - public ZonedDateTime yearAdd(ZonedDateTime dateTime, Double yearsToAdd) { - try { - return this.dateTimeLib.yearAddDateTime(dateTime, yearsToAdd); - } catch (Exception e) { - String message = String.format("yearAdd(%s, %s)", dateTime, yearsToAdd); - logError(message, e); - return null; - } - } - - // - // Extra conversion functions - // - @Override - protected Double valueOf(long number) { - return Double.valueOf(number); - } - - @Override - protected int intValue(Double number) { - return number.intValue(); - } -} diff --git a/dmn-runtime/src/main/java/com/gs/dmn/signavio/runtime/DoubleMixedJavaTimeSignavioBaseDecision.java b/dmn-runtime/src/main/java/com/gs/dmn/signavio/runtime/DoubleMixedJavaTimeSignavioBaseDecision.java deleted file mode 100644 index 6fd9f72bd..000000000 --- a/dmn-runtime/src/main/java/com/gs/dmn/signavio/runtime/DoubleMixedJavaTimeSignavioBaseDecision.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.runtime; - -import com.gs.dmn.runtime.ExecutionContext; -import com.gs.dmn.runtime.annotation.AnnotationTarget; -import com.gs.dmn.runtime.annotation.DRGElement; -import com.gs.dmn.runtime.annotation.Rule; -import com.gs.dmn.signavio.feel.lib.DoubleMixedJavaTimeSignavioLib; - -import javax.xml.datatype.Duration; -import java.lang.reflect.Method; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; -import java.util.Map; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeSignavioBaseDecision} - */ -@Deprecated -public class DoubleMixedJavaTimeSignavioBaseDecision extends DoubleMixedJavaTimeSignavioLib - implements SignavioDecision, - AnnotationTarget -{ - @Override - public Object applyMap(Map input_, ExecutionContext context_) { - return null; - } - - @Override - public DRGElement getDRGElementAnnotation() { - return this.getClass().getAnnotation(DRGElement.class); - } - - @Override - public Rule getRuleAnnotation(int ruleIndex) { - String methodName = String.format("rule%d", ruleIndex); - Class cls = this.getClass(); - Method[] declaredMethods = cls.getDeclaredMethods(); - for (Method method : declaredMethods) { - if (methodName.equals(method.getName())) { - return method.getAnnotation(Rule.class); - } - } - return null; - } -} diff --git a/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibExceptionsTest.java b/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibExceptionsTest.java deleted file mode 100644 index 71c4de450..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibExceptionsTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.feel.lib; - -import com.gs.dmn.feel.lib.stub.*; -import com.gs.dmn.feel.lib.type.bool.BooleanLib; -import com.gs.dmn.feel.lib.type.bool.BooleanType; -import com.gs.dmn.feel.lib.type.context.ContextType; -import com.gs.dmn.feel.lib.type.function.FunctionType; -import com.gs.dmn.feel.lib.type.list.ListLib; -import com.gs.dmn.feel.lib.type.list.ListType; -import com.gs.dmn.feel.lib.type.numeric.NumericLib; -import com.gs.dmn.feel.lib.type.numeric.NumericType; -import com.gs.dmn.feel.lib.type.range.RangeLib; -import com.gs.dmn.feel.lib.type.range.RangeType; -import com.gs.dmn.feel.lib.type.string.StringLib; -import com.gs.dmn.feel.lib.type.string.StringType; -import com.gs.dmn.feel.lib.type.time.*; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedJavaTimeFEELLibExceptionsTest extends BaseMixedJavaTimeFEELLibExceptionsTest { - @Override - protected DoubleMixedJavaTimeFEELLib getLib() { - NumericType numericType = new NumericTypeStub<>(); - BooleanType booleanType = new BooleanTypeStub(); - StringType stringType = new StringTypeStub(); - DateType dateType = new DateTypeStub<>(); - TimeType timeType = new TimeTypeStub<>(); - DateTimeType dateTimeType = new DateTimeTypeStub<>(); - DurationType durationType = new DurationTypeStub<>(); - ListType listType = new ListTypeStub(); - ContextType contextType = new ContextTypeStub(); - RangeType rangeType = new RangeTypeStub(); - FunctionType functionType = new FunctionTypeStub(); - NumericLib numericLib = new NumericLibStub<>(); - StringLib stringLib = new StringLibStub(); - BooleanLib booleanLib = new BooleanLibStub(); - DateTimeLib dateTimeLib = new DateTimeLibStub<>(); - DurationLib durationLib = new DurationLibStub<>(); - ListLib listLib = new ListLibStub(); - RangeLib rangeLib = new RangeLibStub(); - return new DoubleMixedJavaTimeFEELLib( - numericType, booleanType, stringType, - dateType, timeType, dateTimeType, durationType, - listType, contextType, rangeType, functionType, - numericLib, stringLib, booleanLib, dateTimeLib, durationLib, listLib, rangeLib - ); - } -} \ No newline at end of file diff --git a/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibTest.java b/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibTest.java deleted file mode 100644 index 5ee77b24a..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/feel/lib/DoubleMixedJavaTimeFEELLibTest.java +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.feel.lib; - -import org.junit.jupiter.api.Test; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -import static org.junit.jupiter.api.Assertions.*; - -public class DoubleMixedJavaTimeFEELLibTest extends BaseStandardFEELLibTest { - @Override - protected DoubleMixedJavaTimeFEELLib getLib() { - return new DoubleMixedJavaTimeFEELLib(); - } - - // - // Date operators - // - @Test - public void testDateSubtract() { - super.testDateSubtract(); - - // Subtraction is undefined for the case where only one of the values has a timezone. - assertEqualsDateTime("P1DT0H0M0S", getLib().dateSubtract(makeDate("2021-01-02"), makeDateAndTime("2021-01-01T00:00:00"))); - } - - @Test - public void testDateAddDuration() { - super.testDateAddDuration(); - - assertEqualsDateTime("2016-08-02", getLib().dateAddDuration(makeDate("2016-08-01"), makeDuration("P1D"))); - assertEqualsDateTime("2016-09-01", getLib().dateAddDuration(makeDate("2016-08-31"), makeDuration("P1D"))); - - assertEqualsDateTime("2021-01-02", getLib().dateAddDuration(makeDate("2021-01-01"), makeDuration("PT36H"))); - assertEqualsDateTime("2021-01-01", getLib().dateAddDuration(makeDate("2021-01-01"), makeDuration("PT1H"))); - assertEqualsDateTime("2021-01-01", getLib().dateAddDuration(makeDate("2021-01-01"), makeDuration("PT1M"))); - assertEqualsDateTime("2021-01-01", getLib().dateAddDuration(makeDate("2021-01-01"), makeDuration("PT1S"))); - } - - @Test - public void testDateSubtractDuration() { - super.testDateSubtractDuration(); - - assertEqualsDateTime("2016-08-01", getLib().dateSubtractDuration(makeDate("2016-08-02"), makeDuration("P1D"))); - assertEqualsDateTime("2016-07-31", getLib().dateSubtractDuration(makeDate("2016-08-01"), makeDuration("P1D"))); - - assertEqualsDateTime("2020-12-30", getLib().dateSubtractDuration(makeDate("2021-01-01"), makeDuration("PT36H"))); - assertEqualsDateTime("2021-01-01", getLib().dateSubtractDuration(makeDate("2021-01-02"), makeDuration("PT1H"))); - assertEqualsDateTime("2021-01-01", getLib().dateSubtractDuration(makeDate("2021-01-02"), makeDuration("PT1M"))); - assertEqualsDateTime("2021-01-01", getLib().dateSubtractDuration(makeDate("2021-01-02"), makeDuration("PT1S"))); - assertEqualsDateTime("2020-12-31", getLib().dateSubtractDuration(makeDate("2021-01-02"), makeDuration("PT25H"))); - } - - // - // Time operators - // - @Override - @Test - public void testTimeIs() { - super.testTimeIs(); - - // times with equivalent offset and zone id are not is() - assertTrue(getLib().timeIs(makeTime("12:00:00"), makeTime("12:00:00Z"))); - assertTrue(getLib().timeIs(makeTime("12:00:00"), makeTime("12:00:00+00:00"))); - assertTrue(getLib().timeIs(makeTime("00:00:00+00:00"), makeTime("00:00:00@Etc/UTC"))); - assertTrue(getLib().timeIs(makeTime("00:00:00Z"), makeTime("00:00:00+00:00"))); - assertTrue(getLib().timeIs(makeTime("00:00:00Z"), makeTime("00:00:00@Etc/UTC"))); - assertFalse(getLib().timeIs(makeTime("00:00:00Etc/UTC"), makeTime("00:00:00@Europe/Paris"))); - } - - @Test - public void testTimeSubtract() { - super.testTimeSubtract(); - - assertEquals(makeDuration("-PT1H"), getLib().timeSubtract(makeTime("10:10:10@Australia/Melbourne"), makeTime("11:10:10@Australia/Melbourne"))); - assertEquals(makeDuration("PT1H"), getLib().timeSubtract(makeTime("10:10:10@Australia/Melbourne"), makeTime("09:10:10@Australia/Melbourne"))); - } - - @Test - public void testTimeAddDuration() { - super.testTimeAddDuration(); - - assertEqualsDateTime("10:15:00+10:00", getLib().timeAddDuration(makeTime("10:15:00@Australia/Melbourne"), makeDuration("P1D"))); - assertEqualsDateTime("11:15:00+10:00", getLib().timeAddDuration(makeTime("10:15:00@Australia/Melbourne"), makeDuration("PT1H"))); - } - - // - // Date time operators - // - @Override - @Test - public void testDateTimeIs() { - super.testDateTimeIs(); - - // datetime with equivalent offset and zone id are not is() - assertTrue(getLib().dateTimeIs(makeDateAndTime("2018-12-08T12:00:00"), makeDateAndTime("2018-12-08T12:00:00+00:00"))); - assertTrue(getLib().dateTimeIs(makeDateAndTime("2018-12-08T00:00:00+00:00"), makeDateAndTime("2018-12-08T00:00:00@Etc/UTC"))); - assertTrue(getLib().dateTimeIs(makeDateAndTime("2018-12-08T12:00:00Z"), makeDateAndTime("2018-12-08T12:00:00+00:00"))); - assertTrue(getLib().dateTimeIs(makeDateAndTime("2018-12-08T00:00:00Z"), makeDateAndTime("2018-12-08T00:00:00@Etc/UTC"))); - } - - @Test - public void testDateTimeSubtract() { - super.testDateTimeSubtract(); - - // Subtraction is undefined for the case where only one of the values has a timezone. - assertEqualsDateTime("P0DT23H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-02T10:10:10@Europe/Paris"), makeDateAndTime("2021-01-01T10:10:10"))); - assertEqualsDateTime("-P0DT23H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-01T10:10:10"), makeDateAndTime("2021-01-02T10:10:10@Europe/Paris"))); - assertEqualsDateTime("P0DT22H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-02T10:10:10+02:00"), makeDateAndTime("2021-01-01T10:10:10"))); - assertEqualsDateTime("-P0DT22H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-01T10:10:10"), makeDateAndTime("2021-01-02T10:10:10+02:00"))); - assertEqualsDateTime("P0DT23H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-02T10:10:10+01:00"), makeDateAndTime("2021-01-01T10:10:10"))); - - // Subtraction is undefined for the case where only one of the values has a timezone. - assertEqualsDateTime("-P1DT0H0M0S", getLib().dateTimeSubtract(makeDateAndTime("2021-01-01T00:00:00"), makeDate("2021-01-02"))); - } - - // - // Conversion functions - // - @Override - @Test - public void testDate() { - super.testDate(); - - assertEqualsDateTime("2016-08-01", getLib().date(makeDateAndTime("2016-08-01T12:00:00Z"))); - } - - @Override - @Test - public void testTime() { - super.testTime(); - - // - // conversion from time, date and date time - // - assertEqualsDateTime("12:00:00Z", getLib().time(makeTime("12:00:00Z"))); - assertEqualsDateTime("00:00:00Z", getLib().time(makeDate("2017-08-10"))); - assertEqualsDateTime("11:00:00Z", getLib().time(makeDateAndTime("2016-08-01T11:00:00Z"))); - - // - // conversion from numbers - // - assertEqualsDateTime("12:00:00Z", getLib().time(makeNumber("12"), makeNumber("00"), makeNumber("00"), null)); - - // - // conversion from date, time and date time - // - assertEqualsDateTime("00:00:00Z", getLib().time(makeDate("2017-08-10"))); - assertEqualsDateTime("12:00:00Z", getLib().time(makeTime("12:00:00Z"))); - assertEqualsDateTime("11:00:00Z", getLib().time(makeDateAndTime("2016-08-01T11:00:00Z"))); - } - - @Override - @Test - public void testDateAndTime() { - super.testDateAndTime(); - - // - // conversion from string - // - assertEqualsDateTime("2016-08-01T00:00:00@UTC", getLib().dateAndTime("2016-08-01")); - - // missing Z - assertEqualsDateTime("-2016-01-30T09:05:00Z", getLib().dateAndTime("-2016-01-30T09:05:00")); - assertEqualsDateTime("-2017-02-28T02:02:02Z", getLib().dateAndTime("-2017-02-28T02:02:02")); - - // with zone id - assertEqualsDateTime("2011-12-03T10:15:30@Europe/Paris", getLib().dateAndTime("2011-12-03T10:15:30@Europe/Paris")); - - // year must be in the range [-999,999,999..999,999,999] - assertEqualsDateTime("-999999999-12-31T11:22:33Z", getLib().dateAndTime("-999999999-12-31T11:22:33")); - assertEqualsDateTime("999999999-12-31T11:22:33Z", getLib().dateAndTime("999999999-12-31T11:22:33")); - assertNull(getLib().dateAndTime("-9999999991-12-31T11:22:33")); - assertNull(getLib().dateAndTime("9999999991-12-31T11:22:33")); - } - - @Override - @Test - public void testDuration() { - super.testDuration(); - - assertEqualsDateTime("P1Y8M", getLib().duration("P1Y8M")); - assertEqualsDateTime("P999999999M", getLib().duration("P999999999M")); - assertEqualsDateTime("-P999999999M", getLib().duration("-P999999999M")); - - assertEqualsDateTime("P2DT20H", getLib().duration("P2DT20H")); - assertEqualsDateTime("-PT2H", getLib().duration("-PT2H")); - assertEqualsDateTime("PT0S", getLib().duration("PT0.S")); - - assertNull(getLib().duration("P1Y0M2DT6H58M59.000S")); - - // Overflow in duration(from) - assertEquals("P11999999988M", getLib().duration("P11999999988M").toString()); - assertEquals("P2129706043D", getLib().duration("P2129706043D").toString()); - } - - @Override - @Test - public void testYearsAndMonthsDuration() { - super.testYearsAndMonthsDuration(); - - assertEqualsDateTime("P0Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - assertEqualsDateTime("P1Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2015-12-24T00:00:01-01:00"), makeDateAndTime("2016-12-24T23:59:00-08:00"))); - assertEqualsDateTime("P1Y2M", getLib().yearsAndMonthsDuration(makeDateAndTime("2016-09-30T23:25:00"), makeDateAndTime("2017-12-28T12:12:12"))); - assertEqualsDateTime("P7Y6M", getLib().yearsAndMonthsDuration(makeDateAndTime("2010-05-30T03:55:58"), makeDateAndTime("2017-12-15T00:59:59"))); - assertEqualsDateTime("-P4033Y2M", getLib().yearsAndMonthsDuration(makeDateAndTime("2014-12-31T23:59:59"), makeDateAndTime("-2019-10-01T12:32:59"))); - assertEqualsDateTime("-P4035Y11M", getLib().yearsAndMonthsDuration(makeDateAndTime("2017-09-05T10:20:00-01:00"), makeDateAndTime("-2019-10-01T12:32:59+02:00"))); - - assertEqualsDateTime("-P0Y11M", getLib().yearsAndMonthsDuration(makeDateAndTime("-2016-01-30T09:05:00"), makeDateAndTime("-2017-02-28T02:02:02"))); - assertEqualsDateTime("-P4033Y2M", getLib().yearsAndMonthsDuration(makeDateAndTime("2014-12-31T23:59:59"), makeDateAndTime("-2019-10-01T12:32:59"))); - assertEqualsDateTime("-P4035Y11M", getLib().yearsAndMonthsDuration(makeDateAndTime("2017-09-05T10:20:00-01:00"), makeDateAndTime("-2019-10-01T12:32:59+02:00"))); - assertEqualsDateTime("P2Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2017-09-05T10:20:00+05:00"), makeDateAndTime("2019-10-01T12:32:59"))); - assertEqualsDateTime("P1Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2017-09-05T10:20:00@Etc/UTC"), makeDateAndTime("2018-10-01T23:59:59"))); - assertEqualsDateTime("P4Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2011-08-25T15:59:59@Europe/Paris"), makeDateAndTime("2015-08-25T15:20:59+02:00"))); - assertEqualsDateTime("P2Y9M", getLib().yearsAndMonthsDuration(makeDateAndTime("2015-12-31T23:59:59.9999999"), makeDateAndTime("2018-10-01T12:32:59.111111"))); - assertEqualsDateTime("P3Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2016-09-05T22:20:55.123456+05:00"), makeDateAndTime("2019-10-01T12:32:59.32415645"))); - assertEqualsDateTime("P2Y0M", getLib().yearsAndMonthsDuration(makeDateAndTime("2014-12-31T23:59:59"), makeDateAndTime("2016-12-31T00:00:01"))); - } - - @Test - public void testString() { - assertEquals("null", getLib().string(null)); - - // test number - assertEquals("123.45", getLib().string(makeNumber("123.45"))); - - // test string - assertEquals("true", getLib().string(true)); - - // test date - assertEquals("2016-08-01", getLib().string(makeDate("2016-08-01"))); - assertEquals("999999999-12-31", getLib().string(makeDate("999999999-12-31"))); - assertEquals("-999999999-12-31", getLib().string(makeDate("-999999999-12-31"))); - assertEquals("999999999-12-31", getLib().string(getLib().date(makeNumber(999999999), makeNumber(12), makeNumber(31)))); - assertEquals("-999999999-12-31", getLib().string(getLib().date(makeNumber(-999999999), makeNumber(12), makeNumber(31)))); - - // test time - assertEquals("11:00:01Z", getLib().string(makeTime("11:00:01"))); - assertEquals("11:00:01Z", getLib().string(makeTime("11:00:01Z"))); - assertEquals("00:01:00Z", getLib().string(makeTime("00:01:00@Etc/UTC"))); - assertEquals("00:01:00+01:00", getLib().string(makeTime("00:01:00@Europe/Paris"))); - assertEquals("10:20:00+02:00", getLib().string(getLib().time(makeDateAndTime("2017-08-10T10:20:00@Europe/Paris")))); - assertEquals("11:20:00+06:00", getLib().string(getLib().time(makeDateAndTime("2017-09-04T11:20:00@Asia/Dhaka")))); - assertEquals("11:59:45+02:45:55", getLib().string(getLib().time(makeNumber(11), makeNumber(59), makeNumber(45), getLib().duration("PT2H45M55S")))); - assertEquals("11:59:45-02:45:55", getLib().string(getLib().time(makeNumber(11), makeNumber(59), makeNumber(45), getLib().duration("-PT2H45M55S")))); - assertEquals("00:00:00Z", getLib().string(getLib().time(makeDate("2017-08-10")))); - - // test date time - assertEquals("2016-08-01T11:00:01Z", getLib().string(makeDateAndTime("2016-08-01T11:00:01"))); - assertEquals("2016-08-01T11:00:01Z", getLib().string(makeDateAndTime("2016-08-01T11:00:01Z"))); - assertEquals("99999-12-31T11:22:33Z", getLib().string(makeDateAndTime("99999-12-31T11:22:33"))); - assertEquals("-99999-12-31T11:22:33Z", getLib().string(makeDateAndTime("-99999-12-31T11:22:33"))); - assertEquals("2011-12-31T10:15:30@Europe/Paris", getLib().string(makeDateAndTime("2011-12-31T10:15:30@Europe/Paris"))); - assertEquals("2011-12-31T10:15:30@Etc/UTC", getLib().string(makeDateAndTime("2011-12-31T10:15:30@Etc/UTC"))); - assertEquals("2011-12-31T10:15:30.987@Europe/Paris", getLib().string(makeDateAndTime("2011-12-31T10:15:30.987@Europe/Paris"))); - assertEquals("2011-12-31T10:15:30.123456789@Europe/Paris", getLib().string(makeDateAndTime("2011-12-31T10:15:30.123456789@Europe/Paris"))); - assertEquals("999999999-12-31T23:59:59.999999999@Europe/Paris", getLib().string(makeDateAndTime("999999999-12-31T23:59:59.999999999@Europe/Paris"))); - assertEquals("-999999999-12-31T23:59:59.999999999+02:00", getLib().string(makeDateAndTime("-999999999-12-31T23:59:59.999999999+02:00"))); - assertEquals("2017-01-01T23:59:01+01:00", getLib().string(getLib().dateAndTime(makeDate("2017-01-01"), makeTime("23:59:01@Europe/Paris")))); - assertEquals("2017-01-01T23:59:01.123456789+01:00", getLib().string(getLib().dateAndTime(makeDate("2017-01-01"), makeTime("23:59:01.123456789@Europe/Paris")))); - assertEquals("2017-09-05T09:15:30.987654321+01:00", getLib().string(getLib().dateAndTime(makeDateAndTime("2017-09-05T10:20:00"), makeTime("09:15:30.987654321@Europe/Paris")))); - assertEquals("2017-09-05T09:15:30.987654321+01:00", getLib().string(getLib().dateAndTime(makeDateAndTime("2017-09-05T10:20:00-01:00"), makeTime("09:15:30.987654321@Europe/Paris")))); - assertEquals("2017-09-05T09:15:30.987654321+01:00", getLib().string(getLib().dateAndTime(makeDateAndTime("2017-09-05T10:20:00@Europe/Paris"), makeTime("09:15:30.987654321@Europe/Paris")))); - } - - // - // Extra conversion functions - // - @Override - @Test - public void testToDateTime() { - super.testToDateTime(); - - assertEqualsDateTime("2016-08-01T00:00:00@UTC", getLib().toDateTime(makeDate("2016-08-01"))); - assertEqualsDateTime("2016-08-01T12:00:00Z", getLib().toDateTime(makeDateAndTime("2016-08-01T12:00:00Z"))); - } - - // - // Time properties - // - @Override - @Test - public void testTimeProperties() { - assertNull(getLib().hour(null)); - assertEqualsNumber(makeNumber("12"), getLib().hour(makeTime("12:01:02Z"))); - - assertNull(getLib().minute(null)); - assertEqualsNumber(makeNumber("1"), getLib().minute(makeTime("12:01:02Z"))); - - assertNull(getLib().second(null)); - assertEqualsNumber(makeNumber("2"), getLib().second(makeTime("12:01:02Z"))); - - assertNull(getLib().timeOffset(null)); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeTime("12:01:02"))); - assertEquals(makeDuration("PT1H"), getLib().timeOffset(makeTime("12:01:02+01:00"))); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeTime("12:01:02Z"))); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeTime("12:01:02@Etc/UTC"))); - assertEquals(makeDuration("P0DT1H0M0S"), getLib().timeOffset(makeTime("12:01:02@Europe/Paris"))); - - assertNull(getLib().timezone(null)); - assertEquals("Z", getLib().timezone(makeTime("12:01:02"))); - assertEquals("+01:00", getLib().timezone(makeTime("12:01:02+01:00"))); - assertEquals("Z", getLib().timezone(makeTime("12:01:02Z"))); - assertEquals("Z", getLib().timezone(makeTime("12:01:02@Etc/UTC"))); - assertEquals("+01:00", getLib().timezone(makeTime("12:01:02@Europe/Paris"))); - } - - // - // Date and time properties - // - @Override - @Test - public void testDateAndTimeProperties() { - assertNull(getLib().year(null)); - assertEqualsNumber(makeNumber("2018"), getLib().year(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().month(null)); - assertEqualsNumber(makeNumber("12"), getLib().month(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().day(null)); - assertEqualsNumber(makeNumber("10"), getLib().day(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().weekday(null)); - assertEqualsNumber(makeNumber("1"), getLib().weekday(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().hour(null)); - assertEqualsNumber(makeNumber("12"), getLib().hour(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().minute(null)); - assertEqualsNumber(makeNumber("1"), getLib().minute(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().second(null)); - assertEqualsNumber(makeNumber("2"), getLib().second(makeDateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().timeOffset(null)); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeDateAndTime("2018-12-10T12:01:02"))); - assertEquals(makeDuration("PT1H"), getLib().timeOffset(makeDateAndTime("2018-12-10T12:01:02+01:00"))); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeDateAndTime("2018-12-10T12:01:02Z"))); - assertEquals(makeDuration("P0DT0H0M0.000S"), getLib().timeOffset(makeDateAndTime("2018-12-10T12:01:02@Etc/UTC"))); - assertEquals(makeDuration("PT1H"), getLib().timeOffset(makeDateAndTime("2018-12-10T12:01:02@Europe/Paris"))); - - assertNull(getLib().timezone(null)); - assertEquals("Z", getLib().timezone(makeDateAndTime("2018-12-10T12:01:02"))); - assertEquals("+01:00", getLib().timezone(makeDateAndTime("2018-12-10T12:01:02+01:00"))); - assertEquals("Z", getLib().timezone(makeDateAndTime("2018-12-10T12:01:02Z"))); - assertEquals("Etc/UTC", getLib().timezone(makeDateAndTime("2018-12-10T12:01:02@Etc/UTC"))); - assertEquals("Europe/Paris", getLib().timezone(makeDateAndTime("2018-12-10T12:01:02@Europe/Paris"))); - } -} diff --git a/dmn-runtime/src/test/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecisionTest.java b/dmn-runtime/src/test/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecisionTest.java deleted file mode 100644 index 0d7436c43..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/runtime/DoubleMixedJavaTimeDMNBaseDecisionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.runtime; - -import com.gs.dmn.runtime.annotation.DRGElement; -import com.gs.dmn.runtime.annotation.Rule; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertNull; - -public class DoubleMixedJavaTimeDMNBaseDecisionTest { - private final DoubleMixedJavaTimeDMNBaseDecision baseDecision = new DoubleMixedJavaTimeDMNBaseDecision(); - - @Test - public void testGetDRGElementAnnotation() { - DRGElement drgElementAnnotation = this.baseDecision.getDRGElementAnnotation(); - assertNull(drgElementAnnotation); - } - - @Test - public void testGetRuleAnnotation() { - Rule ruleAnnotation = this.baseDecision.getRuleAnnotation(0); - assertNull(ruleAnnotation); - } - -} \ No newline at end of file diff --git a/dmn-runtime/src/test/java/com/gs/dmn/serialization/DoubleMixedJavaTimeJsonSerializerTest.java b/dmn-runtime/src/test/java/com/gs/dmn/serialization/DoubleMixedJavaTimeJsonSerializerTest.java deleted file mode 100644 index 641b53af6..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/serialization/DoubleMixedJavaTimeJsonSerializerTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.serialization; - -import com.gs.dmn.feel.lib.DoubleMixedJavaTimeFEELLib; -import com.gs.dmn.feel.lib.FEELLib; -import com.gs.dmn.runtime.Pair; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; -import java.util.Arrays; -import java.util.List; - -import static com.gs.dmn.serialization.JsonSerializer.OBJECT_MAPPER; -import static com.gs.dmn.serialization.MixedJavaTimeJsonSerializerTest.DATE_TIME_TEST_DATA; -import static com.gs.dmn.serialization.MixedJavaTimeJsonSerializerTest.TIME_TEST_DATA; - -public class DoubleMixedJavaTimeJsonSerializerTest extends AbstractJsonSerializerTest { - @Override - protected FEELLib makeFEELLib() { - return new DoubleMixedJavaTimeFEELLib(); - } - - @Override - protected Double readNumber(String literal) throws Exception { - return OBJECT_MAPPER.readValue(literal, Double.class); - } - - @Override - protected LocalDate readDate(String literal) throws Exception { - return OBJECT_MAPPER.readValue(literal, LocalDate.class); - } - - @Override - protected OffsetTime readTime(String literal) throws Exception { - return OBJECT_MAPPER.readValue(literal, OffsetTime.class); - } - - @Override - protected ZonedDateTime readDateTime(String literal) throws Exception { - return OBJECT_MAPPER.readValue(literal, ZonedDateTime.class); - } - - @Override - protected Duration readDuration(String literal) throws Exception { - return OBJECT_MAPPER.readValue(literal, Duration.class); - } - - @Override - protected List> getNumberTestData() { - return Arrays.asList( - new Pair<>("123", "123.0"), - new Pair<>("-123", "-123.0"), - new Pair<>("123.45", "123.45"), - new Pair<>("-123.45", "-123.45") - ); - } - - @Override - protected List> getTimeTestData() { - return TIME_TEST_DATA; - } - - @Override - protected List> getDateTimeTestData() { - return DATE_TIME_TEST_DATA; - } -} - diff --git a/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLibTest.java b/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLibTest.java deleted file mode 100644 index b18d405cd..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedJavaTimeSignavioLibTest.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.feel.lib; - -import org.junit.jupiter.api.Test; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; -import java.util.Calendar; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - -public class DoubleMixedJavaTimeSignavioLibTest extends BaseSignavioLibTest { - @Override - protected DoubleMixedJavaTimeSignavioLib getLib() { - return new DoubleMixedJavaTimeSignavioLib(); - } - - // - // Date & time functions - // - @Test - public void testDay() { - assertNull(getLib().day(null)); - - assertEqualsNumber(makeNumber("10"), getLib().day(makeDate("2015-12-10"))); - assertNull(getLib().day(makeDate("xxx"))); - } - - @Test - public void testDayAdd() { - assertNull(getLib().dayAdd((ZonedDateTime) null, null)); - assertNull(getLib().dayAdd((ZonedDateTime) null, makeNumber("360"))); - assertNull(getLib().dayAdd(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), null)); - - assertEqualsDateTime("2015-12-25T12:15:00.001+01:00", getLib().dayAdd(makeDateAndTime("2015-12-24T12:15:00.001+01:00"), makeNumber("1"))); - assertEqualsDateTime("2016-12-18T12:15:00.001+01:00", getLib().dayAdd(makeDateAndTime("2015-12-24T12:15:00.001+01:00"), makeNumber("360"))); - assertEqualsDateTime("2015-12-25", getLib().dayAdd(makeDate("2015-12-24"), makeNumber("1"))); - assertEqualsDateTime("2016-12-18", getLib().dayAdd(makeDate("2015-12-24"), makeNumber("360"))); - assertEqualsDateTime("2015-12-23", getLib().dayAdd(makeDate("2015-12-24"), makeNumber("-1"))); - assertNull(getLib().dayAdd(makeDateAndTime("x"), makeNumber("360"))); - } - - @Test - public void testDayDiff() { - assertNull(getLib().dayDiff(null, null)); - assertNull(getLib().dayDiff(null, makeDate("2015-12-25"))); - assertNull(getLib().dayDiff(makeDate("2015-12-25"), null)); - assertNull(getLib().dayDiff(null, makeDateAndTime("2015-12-25T00:00:00"))); - assertNull(getLib().dayDiff(makeDateAndTime("2015-12-24T00:00:00"), null)); - - assertEquals(makeNumber("1"), getLib().dayDiff(makeDate("2015-12-24"), makeDate("2015-12-25"))); - assertEquals(makeNumber("0"), getLib().dayDiff(makeDate("2015-12-24"), makeDate("2015-12-24"))); - assertEquals(makeNumber("-1"), getLib().dayDiff(makeDate("2015-12-24"), makeDate("2015-12-23"))); - - assertEquals(makeNumber("1"), getLib().dayDiff(makeDateAndTime("2015-12-24T00:00:00"), makeDateAndTime("2015-12-25T00:00:00"))); - assertEquals(makeNumber("0"), getLib().dayDiff(makeDateAndTime("2015-12-24T12:25:00"), makeDateAndTime("2015-12-24T00:00:00"))); - assertEquals(makeNumber("-1"), getLib().dayDiff(makeDateAndTime("2015-12-24T00:00:00"), makeDateAndTime("2015-12-23T00:00:00"))); - } - - @Test - public void testHour() { - assertNull(getLib().hour(makeDateAndTime(null))); - - assertEquals(makeNumber("12"), getLib().hour(makeTime("12:15:00.000+01:00"))); - assertEquals(makeNumber("12"), getLib().hour(makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - assertNull(getLib().hour(makeDateAndTime("xxx"))); - } - - @Test - public void testHourDiff() { - assertNull(getLib().hourDiff(null, null)); - assertNull(getLib().hourDiff(null, makeTime("12:15:00.000+01:00"))); - assertNull(getLib().hourDiff(makeTime("12:15:00.000+01:00"), null)); - - assertEquals(makeNumber("0"), getLib().hourDiff(makeTime("12:15:00.000+01:00"), makeTime("12:15:00.000+01:00"))); - assertEquals(makeNumber("3"), getLib().hourDiff(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), makeDateAndTime("2015-12-24T15:15:00.000+01:00"))); - assertEquals(makeNumber("27"), getLib().hourDiff(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), makeDateAndTime("2015-12-25T15:15:00.000+01:00"))); - assertEquals(makeNumber("-24"), getLib().hourDiff(makeDateAndTime("2015-12-25T12:15:00.000+01:00"), makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - assertEquals(makeNumber("-27"), getLib().hourDiff(makeDateAndTime("2015-12-25T15:15:00.000+01:00"), makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - assertEquals(makeNumber("8757"), getLib().hourDiff(makeDateAndTime("2015-12-25T15:15:00.000+01:00"), makeDateAndTime("2016-12-24T12:15:00.000+01:00"))); - } - - @Test - public void testMinute() { - assertNull(getLib().minute(null)); - - assertEquals(makeNumber("15"), getLib().minute(makeTime("12:15:00.000+01:00"))); - assertEquals(makeNumber("15"), getLib().minute(makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - } - - @Test - public void testMinuteDiff() { - assertNull(getLib().minutesDiff(null, null)); - assertNull(getLib().minutesDiff(null, makeTime("12:15:00.000+01:00"))); - assertNull(getLib().minutesDiff(makeTime("12:15:00.000+01:00"), null)); - - assertEquals(makeNumber("0"), getLib().minutesDiff(makeTime("12:15:00.000+01:00"), makeTime("12:15:00.000+01:00"))); - assertEquals(makeNumber("5"), getLib().minutesDiff(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), makeDateAndTime("2015-12-24T12:20:00.000+01:00"))); - assertEquals(makeNumber("65"), getLib().minutesDiff(makeDateAndTime("2015-12-24T12:15:00.000+01:00"), makeDateAndTime("2015-12-24T13:20:00.000+01:00"))); - assertEquals(makeNumber("-65"), getLib().minutesDiff(makeDateAndTime("2015-12-24T13:20:00.000+01:00"), makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - assertEquals(makeNumber("525420"), getLib().minutesDiff(makeDateAndTime("2015-12-25T15:15:00.000+01:00"), makeDateAndTime("2016-12-24T12:15:00.000+01:00"))); - } - - @Test - public void testMonth() { - assertNull(getLib().month(null)); - - assertEquals(makeNumber("12"), getLib().month(makeDate("2015-12-02"))); - assertEquals(makeNumber("12"), getLib().month(makeDateAndTime("2015-12-24T12:15:00.000+01:00"))); - } - - @Test - public void testMonthAdd() { - assertNull(getLib().monthAdd((LocalDate) null, null)); - assertNull(getLib().monthAdd((LocalDate) null, makeNumber("1"))); - assertNull(getLib().monthAdd(makeDate("2015-01-05"), null)); - - assertEqualsDateTime("2015-02-05", getLib().monthAdd(makeDate("2015-01-05"), makeNumber("1"))); - assertEqualsDateTime("2016-01-05", getLib().monthAdd(makeDate("2015-01-05"), makeNumber("12"))); - assertEqualsDateTime("2014-11-05", getLib().monthAdd(makeDate("2015-01-05"), makeNumber("-2"))); - assertEqualsDateTime("2015-02-05T12:15:00.001+01:00", getLib().monthAdd(makeDateAndTime("2015-01-05T12:15:00.001+01:00"), makeNumber("1"))); - assertEqualsDateTime("2016-01-05T12:15:00.001+01:00", getLib().monthAdd(makeDateAndTime("2015-01-05T12:15:00.001+01:00"), makeNumber("12"))); - assertEqualsDateTime("2014-11-05T12:15:00.001+01:00", getLib().monthAdd(makeDateAndTime("2015-01-05T12:15:00.001+01:00"), makeNumber("-2"))); - assertNull(getLib().monthAdd(makeDateAndTime("xxx"), makeNumber("12"))); - assertNull(getLib().monthAdd((LocalDate) null, makeNumber("12"))); - } - - @Test - public void testMonthDiff() { - assertNull(getLib().monthDiff(null, null)); - assertNull(getLib().monthDiff(null, makeDate("2015-01-05"))); - assertNull(getLib().monthDiff(makeDate("2015-01-05"), null)); - - assertEquals(makeNumber("0"), getLib().monthDiff(makeDate("2015-01-05"), makeDate("2015-01-05"))); - assertEquals(makeNumber("4"), getLib().monthDiff(makeDate("2015-01-05"), makeDate("2015-05-05"))); - assertEquals(makeNumber("16"), getLib().monthDiff(makeDate("2015-01-05"), makeDate("2016-05-05"))); - assertEquals(makeNumber("-4"), getLib().monthDiff(makeDate("2015-05-05"), makeDate("2015-01-05"))); - - assertEquals(makeNumber("0"), getLib().monthDiff(makeDateAndTime("2015-01-05T12:15:00.000+01:00"), makeDateAndTime("2015-01-05T12:15:00.000+01:00"))); - assertEquals(makeNumber("4"), getLib().monthDiff(makeDateAndTime("2015-01-05T12:15:00.000+01:00"), makeDateAndTime("2015-05-05T12:15:00.000+01:00"))); - assertEquals(makeNumber("16"), getLib().monthDiff(makeDateAndTime("2015-01-05T12:15:00.000+01:00"), makeDateAndTime("2016-05-05T12:15:00.000+01:00"))); - assertEquals(makeNumber("-4"), getLib().monthDiff(makeDateAndTime("2015-05-05T12:15:00.000+01:00"), makeDateAndTime("2015-01-05T12:15:00.000+01:00"))); - } - - @Test - public void testNow() { - ZonedDateTime actual = getLib().now(); - Calendar expected = Calendar.getInstance(); - assertEquals(expected.get(Calendar.YEAR), actual.getYear()); - assertEquals(expected.get(Calendar.MONTH) + 1, actual.getMonthValue()); - assertEquals(expected.get(Calendar.DAY_OF_MONTH), actual.getDayOfMonth()); - } - - @Test - public void testToday() { - LocalDate actual = getLib().today(); - LocalDate expected = LocalDate.now(); - assertEquals(expected.getYear(), actual.getYear()); - assertEquals(expected.getMonthValue(), actual.getMonthValue()); - assertEquals(expected.getDayOfMonth(), actual.getDayOfMonth()); - } - - - @Test - public void testWeekday() { - assertNull(getLib().weekday(null)); - - assertEquals(makeNumber("7"), getLib().weekday(makeDate("2016-12-25"))); - assertEquals(makeNumber("6"), getLib().weekday(makeDate("0003-02-01"))); - assertEquals(makeNumber("2"), getLib().weekday(makeDate("2016-11-01"))); - assertEquals(makeNumber("7"), getLib().weekday(makeDateAndTime("2016-11-20T12:15:00.000+01:00"))); - } - - @Test - public void testYear() { - assertNull(getLib().year(null)); - - assertEquals(makeNumber("2016"), getLib().year(makeDate("2016-11-01"))); - assertEquals(makeNumber("2015"), getLib().year(makeDateAndTime("2015-11-20T12:15:00.000+01:00"))); - } - - @Test - public void testYearAdd() { - assertNull(getLib().yearAdd((LocalDate) null, null)); - assertNull(getLib().yearAdd((LocalDate) null, makeNumber("1"))); - assertNull(getLib().yearAdd(makeDate("2015-01-05"), null)); - - assertEqualsDateTime("2016-01-05", getLib().yearAdd(makeDate("2015-01-05"), makeNumber("1"))); - assertEqualsDateTime("2027-01-05", getLib().yearAdd(makeDate("2015-01-05"), makeNumber("12"))); - assertEqualsDateTime("2016-01-05T12:15:00.001+01:00", getLib().yearAdd(makeDateAndTime("2015-01-05T12:15:00.001+01:00"), makeNumber("1"))); - assertEqualsDateTime("2027-01-05T12:15:00.001+01:00", getLib().yearAdd(makeDateAndTime("2015-01-05T12:15:00.001+01:00"), makeNumber("12"))); - assertNull(getLib().yearAdd(makeDateAndTime("xxx"), makeNumber("12"))); - assertNull(getLib().yearAdd((LocalDate) null, makeNumber("12"))); - } - - @Test - public void testYearDiff() { - assertNull(getLib().yearDiff(null, null)); - assertNull(getLib().yearDiff(null, makeDate("2015-01-05"))); - assertNull(getLib().yearDiff(makeDate("2015-01-05"), null)); - - assertEquals(makeNumber("0"), getLib().yearDiff(makeDate("2015-01-05"), makeDate("2015-01-05"))); - assertEquals(makeNumber("1"), getLib().yearDiff(makeDate("2015-01-05"), makeDate("2016-05-05"))); - assertEquals(makeNumber("1"), getLib().yearDiff(makeDate("2015-01-05"), makeDate("2016-01-05"))); - assertEquals(makeNumber("-1"), getLib().yearDiff(makeDate("2016-01-05"), makeDate("2015-01-05"))); - assertEquals(makeNumber("0"), getLib().yearDiff(makeDate("2016-01-05"), makeDate("2015-05-05"))); - - assertEquals(makeNumber("0"), getLib().yearDiff(makeDateAndTime("2015-01-01T12:15:00.000+01:00"), makeDateAndTime("2015-01-05T15:15:00.000+01:00"))); - assertEquals(makeNumber("1"), getLib().yearDiff(makeDateAndTime("2015-01-05T12:15:00.000+01:00"), makeDateAndTime("2016-05-05T15:15:00.000+01:00"))); - assertEquals(makeNumber("1"), getLib().yearDiff(makeDateAndTime("2015-01-05T12:15:00.000+01:00"), makeDateAndTime("2016-01-05T15:15:00.000+01:00"))); - assertEquals(makeNumber("-1"), getLib().yearDiff(makeDateAndTime("2016-01-05T12:15:00.000+01:00"), makeDateAndTime("2015-01-05T15:15:00.000+01:00"))); - assertEquals(makeNumber("0"), getLib().yearDiff(makeDateAndTime("2016-01-05T12:15:00.000+01:00"), makeDateAndTime("2015-05-05T15:15:00.000+01:00"))); - } - - // - // Time properties - // - @Override - @Test - public void testTimeProperties() { - assertNull(getLib().hour(null)); - assertEqualsNumber(makeNumber("12"), getLib().hour(getLib().time("12:01:02Z"))); - - assertNull(getLib().minute(null)); - assertEqualsNumber(makeNumber("1"), getLib().minute(getLib().time("12:01:02Z"))); - } - - // - // Date and time properties - // - @Override - @Test - public void testDateAndTimeProperties() { - assertNull(getLib().year(null)); - assertEqualsNumber(makeNumber("2018"), getLib().year(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().month(null)); - assertEqualsNumber(makeNumber("12"), getLib().month(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().day(null)); - assertEqualsNumber(makeNumber("10"), getLib().day(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().weekday(null)); - assertEqualsNumber(makeNumber("1"), getLib().weekday(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().hour(null)); - assertEqualsNumber(makeNumber("12"), getLib().hour(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - - assertNull(getLib().minute(null)); - assertEqualsNumber(makeNumber("1"), getLib().minute(getLib().dateAndTime("2018-12-10T12:01:02Z"))); - } -} diff --git a/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedSignavioLibExceptionsTest.java b/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedSignavioLibExceptionsTest.java deleted file mode 100644 index b13a3dd76..000000000 --- a/dmn-runtime/src/test/java/com/gs/dmn/signavio/feel/lib/DoubleMixedSignavioLibExceptionsTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.feel.lib; - -import com.gs.dmn.feel.lib.stub.*; -import com.gs.dmn.feel.lib.type.bool.BooleanLib; -import com.gs.dmn.feel.lib.type.bool.BooleanType; -import com.gs.dmn.feel.lib.type.context.ContextType; -import com.gs.dmn.feel.lib.type.function.FunctionType; -import com.gs.dmn.feel.lib.type.list.ListType; -import com.gs.dmn.feel.lib.type.numeric.NumericType; -import com.gs.dmn.feel.lib.type.range.RangeType; -import com.gs.dmn.feel.lib.type.string.StringType; -import com.gs.dmn.feel.lib.type.time.*; -import com.gs.dmn.signavio.feel.lib.stub.SignavioDateTimeLibStub; -import com.gs.dmn.signavio.feel.lib.stub.SignavioListLibStub; -import com.gs.dmn.signavio.feel.lib.stub.SignavioNumberLibStub; -import com.gs.dmn.signavio.feel.lib.stub.SignavioStringLibStub; -import com.gs.dmn.signavio.feel.lib.type.list.SignavioListLib; -import com.gs.dmn.signavio.feel.lib.type.numeric.SignavioNumberLib; -import com.gs.dmn.signavio.feel.lib.type.string.SignavioStringLib; -import com.gs.dmn.signavio.feel.lib.type.time.SignavioDateTimeLib; -import org.junit.jupiter.api.Test; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -import static org.junit.jupiter.api.Assertions.assertNull; - -public class DoubleMixedSignavioLibExceptionsTest extends BaseSignavioLibExceptionsTest { - @Override - protected DoubleMixedJavaTimeSignavioLib getLib() { - NumericType numericType = new NumericTypeStub<>(); - BooleanType booleanType = new BooleanTypeStub(); - StringType stringType = new StringTypeStub(); - DateType dateType = new DateTypeStub<>(); - TimeType timeType = new TimeTypeStub<>(); - DateTimeType dateTimeType = new DateTimeTypeStub<>(); - DurationType durationType = new DurationTypeStub<>(); - ListType listType = new ListTypeStub(); - ContextType contextType = new ContextTypeStub(); - RangeType rangeType = new RangeTypeStub(); - FunctionType functionType = new FunctionTypeStub(); - SignavioNumberLib numberLib = new SignavioNumberLibStub<>(); - SignavioStringLib stringLib = new SignavioStringLibStub(); - BooleanLib booleanLib = new BooleanLibStub(); - SignavioDateTimeLib dateTimeLib = new SignavioDateTimeLibStub<>(); - DurationLib durationLib = new DurationLibStub<>(); - SignavioListLib listLib = new SignavioListLibStub(); - return new DoubleMixedJavaTimeSignavioLib( - numericType, booleanType, stringType, - dateType, timeType, dateTimeType, durationType, - listType, contextType, rangeType, functionType, - numberLib, stringLib, booleanLib, dateTimeLib, durationLib, listLib - ); - } - - // - // Date and time operations - // - @Override - @Test - public void testDay() { - super.testDay(); - - assertNull(getLib().day(null)); - } - - @Override - @Test - public void testDayAdd() { - super.testDayAdd(); - - assertNull(getLib().dayAdd((ZonedDateTime) null, null)); - } - - @Override - @Test - public void testHour() { - super.testHour(); - - assertNull(getLib().hour(null)); - } - - @Override - @Test - public void testMinute() { - super.testMinute(); - - assertNull(getLib().minute(null)); - } - - @Override - @Test - public void testMonth() { - super.testMonth(); - - assertNull(getLib().month(null)); - } - - @Override - @Test - public void testMonthAdd() { - super.testMonthAdd(); - - assertNull(getLib().monthAdd((ZonedDateTime) null, null)); - } - - @Override - @Test - public void testWeekday() { - super.testWeekday(); - - assertNull(getLib().weekday(null)); - } - - @Override - @Test - public void testYear() { - super.testYear(); - - assertNull(getLib().year(null)); - } - - @Override - @Test - public void testYearAdd() { - super.testYearAdd(); - - assertNull(getLib().yearAdd((ZonedDateTime) null, null)); - } -} \ No newline at end of file diff --git a/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition.java b/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition.java deleted file mode 100644 index 64b2f5b46..000000000 --- a/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.dialect; - -import com.gs.dmn.DMNModelRepository; -import com.gs.dmn.context.environment.EnvironmentFactory; -import com.gs.dmn.feel.lib.FEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeKotlinNativeTypeFactory; -import com.gs.dmn.feel.synthesis.type.NativeTypeFactory; -import com.gs.dmn.log.BuildLogger; -import com.gs.dmn.serialization.TypeDeserializationConfigurer; -import com.gs.dmn.signavio.feel.lib.DoubleMixedJavaTimeSignavioLib; -import com.gs.dmn.signavio.runtime.DoubleMixedJavaTimeSignavioBaseDecision; -import com.gs.dmn.signavio.testlab.TestLab; -import com.gs.dmn.signavio.transformation.SignavioDMNToKotlinTransformer; -import com.gs.dmn.signavio.transformation.basic.BasicSignavioDMNToKotlinTransformer; -import com.gs.dmn.transformation.DMNToNativeTransformer; -import com.gs.dmn.transformation.DMNTransformer; -import com.gs.dmn.transformation.InputParameters; -import com.gs.dmn.transformation.basic.BasicDMNToJavaTransformer; -import com.gs.dmn.transformation.lazy.LazyEvaluationDetector; -import com.gs.dmn.transformation.template.TemplateProvider; -import com.gs.dmn.validation.DMNValidator; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link com.gs.dmn.dialect.MixedJavaTimeKotlinStandardDMNDialectDefinition} - */ -@Deprecated -public class DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition extends AbstractSignavioDMNDialectDefinition { - // - // DMN processors - // - @Override - public DMNToNativeTransformer createDMNToNativeTransformer(DMNValidator dmnValidator, DMNTransformer dmnTransformer, TemplateProvider templateProvider, LazyEvaluationDetector lazyEvaluationDetector, TypeDeserializationConfigurer typeDeserializationConfigurer, InputParameters inputParameters, BuildLogger logger) { - return new SignavioDMNToKotlinTransformer<>(this, dmnValidator, dmnTransformer, templateProvider, lazyEvaluationDetector, typeDeserializationConfigurer, inputParameters, logger); - } - - @Override - public BasicDMNToJavaTransformer createBasicTransformer(DMNModelRepository repository, LazyEvaluationDetector lazyEvaluationDetector, InputParameters inputParameters) { - EnvironmentFactory environmentFactory = createEnvironmentFactory(); - return new BasicSignavioDMNToKotlinTransformer(this, repository, environmentFactory, createNativeTypeFactory(), lazyEvaluationDetector, inputParameters); - } - - // - // Execution engine - // - @Override - public NativeTypeFactory createNativeTypeFactory() { - return new DoubleMixedJavaTimeKotlinNativeTypeFactory(); - } - - @Override - public FEELLib createFEELLib() { - return new DoubleMixedJavaTimeSignavioLib(); - } - - @Override - public String getDecisionBaseClass() { - return DoubleMixedJavaTimeSignavioBaseDecision.class.getName(); - } - - @Override - public String getNativeNumberType() { - return Double.class.getName(); - } - - @Override - public String getNativeDateType() { - return LocalDate.class.getName(); - } - - @Override - public String getNativeTimeType() { - return OffsetTime.class.getName(); - } - - @Override - public String getNativeDateAndTimeType() { - return ZonedDateTime.class.getName(); - } - - @Override - public String getNativeDurationType() { - return Duration.class.getName(); - } -} diff --git a/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinition.java b/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinition.java deleted file mode 100644 index 69a072d8b..000000000 --- a/dmn-signavio/src/main/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinition.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.dialect; - -import com.gs.dmn.DMNModelRepository; -import com.gs.dmn.context.environment.EnvironmentFactory; -import com.gs.dmn.feel.lib.FEELLib; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeNativeTypeFactory; -import com.gs.dmn.feel.synthesis.type.NativeTypeFactory; -import com.gs.dmn.log.BuildLogger; -import com.gs.dmn.serialization.TypeDeserializationConfigurer; -import com.gs.dmn.signavio.feel.lib.DoubleMixedJavaTimeSignavioLib; -import com.gs.dmn.signavio.runtime.DoubleMixedJavaTimeSignavioBaseDecision; -import com.gs.dmn.signavio.testlab.TestLab; -import com.gs.dmn.signavio.transformation.SignavioDMNToJavaTransformer; -import com.gs.dmn.signavio.transformation.basic.BasicSignavioDMNToJavaTransformer; -import com.gs.dmn.transformation.DMNToNativeTransformer; -import com.gs.dmn.transformation.DMNTransformer; -import com.gs.dmn.transformation.InputParameters; -import com.gs.dmn.transformation.basic.BasicDMNToJavaTransformer; -import com.gs.dmn.transformation.lazy.LazyEvaluationDetector; -import com.gs.dmn.transformation.template.TemplateProvider; -import com.gs.dmn.validation.DMNValidator; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -/** - * @deprecated As of release 8.3.0, replaced by {@link PureJavaTimeSignavioDMNDialectDefinition} - */ -@Deprecated -public class DoubleMixedJavaTimeSignavioDMNDialectDefinition extends AbstractSignavioDMNDialectDefinition { - // - // DMN processors - // - @Override - public DMNToNativeTransformer createDMNToNativeTransformer(DMNValidator dmnValidator, DMNTransformer dmnTransformer, TemplateProvider templateProvider, LazyEvaluationDetector lazyEvaluationDetector, TypeDeserializationConfigurer typeDeserializationConfigurer, InputParameters inputParameters, BuildLogger logger) { - return new SignavioDMNToJavaTransformer<>(this, dmnValidator, dmnTransformer, templateProvider, lazyEvaluationDetector, typeDeserializationConfigurer, inputParameters, logger); - } - - @Override - public BasicDMNToJavaTransformer createBasicTransformer(DMNModelRepository repository, LazyEvaluationDetector lazyEvaluationDetector, InputParameters inputParameters) { - EnvironmentFactory environmentFactory = createEnvironmentFactory(); - return new BasicSignavioDMNToJavaTransformer(this, repository, environmentFactory, createNativeTypeFactory(), lazyEvaluationDetector, inputParameters); - } - - // - // Execution engine - // - @Override - public NativeTypeFactory createNativeTypeFactory() { - return new DoubleMixedJavaTimeNativeTypeFactory(); - } - - @Override - public FEELLib createFEELLib() { - return new DoubleMixedJavaTimeSignavioLib(); - } - - @Override - public String getDecisionBaseClass() { - return DoubleMixedJavaTimeSignavioBaseDecision.class.getName(); - } - - @Override - public String getNativeNumberType() { - return Double.class.getName(); - } - - @Override - public String getNativeDateType() { - return LocalDate.class.getName(); - } - - @Override - public String getNativeTimeType() { - return OffsetTime.class.getName(); - } - - @Override - public String getNativeDateAndTimeType() { - return ZonedDateTime.class.getName(); - } - - @Override - public String getNativeDurationType() { - return Duration.class.getName(); - } -} diff --git a/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinitionTest.java b/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinitionTest.java deleted file mode 100644 index dcc7de863..000000000 --- a/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinitionTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.dialect; - -import com.gs.dmn.dialect.DMNDialectDefinition; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeKotlinNativeTypeFactory; -import com.gs.dmn.signavio.feel.lib.DoubleMixedJavaTimeSignavioLib; -import com.gs.dmn.signavio.runtime.DoubleMixedJavaTimeSignavioBaseDecision; -import com.gs.dmn.signavio.runtime.interpreter.SignavioDMNInterpreter; -import com.gs.dmn.signavio.testlab.TestLab; -import com.gs.dmn.signavio.transformation.SignavioDMNToKotlinTransformer; -import com.gs.dmn.signavio.transformation.basic.BasicSignavioDMNToKotlinTransformer; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinitionTest extends AbstractSignavioDMNDialectDefinitionTest { - @Override - protected DMNDialectDefinition makeDialect() { - return new DoubleMixedJavaTimeKotlinSignavioDMNDialectDefinition(); - } - - @Override - protected String getExpectedDMNInterpreterClass() { - return SignavioDMNInterpreter.class.getName(); - } - - @Override - protected String getExpectedDMNToNativeTransformerClass() { - return SignavioDMNToKotlinTransformer.class.getName(); - } - - @Override - protected String getBasicTransformerClass() { - return BasicSignavioDMNToKotlinTransformer.class.getName(); - } - - @Override - protected String getExpectedNativeTypeFactoryClass() { - return DoubleMixedJavaTimeKotlinNativeTypeFactory.class.getName(); - } - - @Override - protected String getExpectedFEELLibClass() { - return DoubleMixedJavaTimeSignavioLib.class.getName(); - } - - @Override - protected String getExpectedDecisionBaseClass() { - return DoubleMixedJavaTimeSignavioBaseDecision.class.getName(); - } -} \ No newline at end of file diff --git a/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinitionTest.java b/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinitionTest.java deleted file mode 100644 index c1a5831de..000000000 --- a/dmn-signavio/src/test/java/com/gs/dmn/signavio/dialect/DoubleMixedJavaTimeSignavioDMNDialectDefinitionTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2016 Goldman Sachs. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package com.gs.dmn.signavio.dialect; - -import com.gs.dmn.dialect.DMNDialectDefinition; -import com.gs.dmn.feel.synthesis.type.DoubleMixedJavaTimeNativeTypeFactory; -import com.gs.dmn.signavio.feel.lib.DoubleMixedJavaTimeSignavioLib; -import com.gs.dmn.signavio.runtime.DoubleMixedJavaTimeSignavioBaseDecision; -import com.gs.dmn.signavio.runtime.interpreter.SignavioDMNInterpreter; -import com.gs.dmn.signavio.testlab.TestLab; -import com.gs.dmn.signavio.transformation.SignavioDMNToJavaTransformer; -import com.gs.dmn.signavio.transformation.basic.BasicSignavioDMNToJavaTransformer; - -import javax.xml.datatype.Duration; -import java.time.LocalDate; -import java.time.OffsetTime; -import java.time.ZonedDateTime; - -public class DoubleMixedJavaTimeSignavioDMNDialectDefinitionTest extends AbstractSignavioDMNDialectDefinitionTest { - @Override - protected DMNDialectDefinition makeDialect() { - return new DoubleMixedJavaTimeSignavioDMNDialectDefinition(); - } - - @Override - protected String getExpectedDMNInterpreterClass() { - return SignavioDMNInterpreter.class.getName(); - } - - @Override - protected String getExpectedDMNToNativeTransformerClass() { - return SignavioDMNToJavaTransformer.class.getName(); - } - - @Override - protected String getBasicTransformerClass() { - return BasicSignavioDMNToJavaTransformer.class.getName(); - } - - @Override - protected String getExpectedNativeTypeFactoryClass() { - return DoubleMixedJavaTimeNativeTypeFactory.class.getName(); - } - - @Override - protected String getExpectedFEELLibClass() { - return DoubleMixedJavaTimeSignavioLib.class.getName(); - } - - @Override - protected String getExpectedDecisionBaseClass() { - return DoubleMixedJavaTimeSignavioBaseDecision.class.getName(); - } -} \ No newline at end of file