Skip to content

Commit

Permalink
Merge pull request #2905 from nadment/1991
Browse files Browse the repository at this point in the history
Cleanup XML of action Simple Eval #1991
  • Loading branch information
hansva authored May 27, 2023
2 parents 646193b + e36c39e commit a9b1c5d
Show file tree
Hide file tree
Showing 13 changed files with 493 additions and 706 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ActionSimpleEval.Error.FieldNotExist=Feld [{0}] konnte im vorhergehenden Actionr
ActionSimpleEval.Error.NoRows=Das vorherige Result ist leer!
ActionSimpleEval.ValueType.Label=Evaluieren
ActionSimpleEval.SuccessWhenDifferent.Label=Wenn Wert anders ist als
ActionSimple.Error.Exception.UnableLoadXML=Konnte Action nicht aus XML laden
ActionSimpleEval.MinValue.Label=Minimum
ActionSimpleEval.MinValue.Tooltip=Minimum
ActionSimpleEval.CompareValue.Tooltip=Wert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ActionSimpleEval.Log.CompareWithValues=Comparing incoming value [{0}] (min) and
ActionSimpleEval.Error.NoRows=The previous result is empty\!
ActionSimpleEval.ValueType.Label=Evaluate
ActionSimpleEval.SuccessWhenDifferent.Label=If value is different from
ActionSimple.Error.Exception.UnableLoadXML=Unable to load action from XML node
ActionSimpleEval.MinValue.Label=Min
ActionSimpleEval.SuccessWhenRegExp.Label=If value valid regex
ActionSimpleEval.MinValue.Tooltip=Min
Expand All @@ -59,7 +58,7 @@ ActionSimpleEval.FieldTypeString.Label=String
ActionSimpleEval.SuccessBooleanCondition.Label=Success condition
ActionSimpleEval.Log.ValueToevaluate=Value to evaluate is {0}
ActionSimpleEval.Error.UnparsableNumber=Can not convert value [{0}] to number\! {1}
ActionSimpleEval.SuccessCondition.Label=Success condition
ActionSimpleEval.SuccessCondition.Label=Success condition
ActionSimpleEval.FieldTypeNumber.Label=Number
ActionSimpleEval.Mask.Label=Mask
ActionSimpleEval.SuccessWhenSet.Tooltip=Success when the variable is set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
#
#

ActionSimpleEval.Error.VariableMissing=Falta el nombre de la variable.
ActionSimpleEval.SuccessWhenGreaterOrEqualThan.Label=El valor es mayor \u00F3 igual a
ActionSimpleEval.SuccessNumberCondition.Label=Condici\u00F3n de \u00E9xito
Expand All @@ -32,7 +33,6 @@ ActionSimpleEval.Log.CompareWithValues=Comparando el valor entrante [{0}] (min)
ActionSimpleEval.Error.NoRows=El resultado previo est\u00E1 vac\u00EDo.
ActionSimpleEval.ValueType.Label=Evaluar
ActionSimpleEval.SuccessWhenDifferent.Label=El valor es diferente a
ActionSimple.Error.Exception.UnableLoadXML=Imposible cargar la entrada de trabajo desde el nodo XML
ActionSimpleEval.CheckingVariable=Verificando la variable [{0}]...
ActionSimpleEval.MinValue.Label=M\u00EDnimo
ActionSimpleEval.SuccessWhenRegExp.Label=Si el valor cumple con la ExpReg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ActionSimpleEval.Log.CompareWithValues=Comparaison aves les bornes [{0}] (inf\u0
ActionSimpleEval.Error.NoRows=Le r\u00E9sultat pr\u00E9c\u00E9dent est vide\u202F!
ActionSimpleEval.ValueType.Label=Evaluer
ActionSimpleEval.SuccessWhenDifferent.Label=Si la valeur est diff\u00E9rente de
ActionSimple.Error.Exception.UnableLoadXML=Impossible de charger l''action depuis le n\u0153ud XML
ActionSimpleEval.MinValue.Label=Borne inf\u00E9rieure
ActionSimpleEval.SuccessWhenRegExp.Label=Si la valeur correspond \u00E0 la RegExp
ActionSimpleEval.MinValue.Tooltip=Min
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ActionSimpleEval.Log.CompareWithValues=Comparazione del valore entrante [{0}] (m
ActionSimpleEval.Error.NoRows=Il risultato precedente \u00E8 vuoto\!
ActionSimpleEval.ValueType.Label=Valuta
ActionSimpleEval.SuccessWhenDifferent.Label=Se il valore \u00E8 diverso da
ActionSimple.Error.Exception.UnableLoadXML=Impossibile caricare la action dal nodo XML
ActionSimpleEval.CheckingVariable=Controllo della variabile [{0}] ...
ActionSimpleEval.MinValue.Label=Min
ActionSimpleEval.SuccessWhenRegExp.Label=Se il valore \u00E8 una regex valida
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ ActionSimpleEval.Log.CompareWithValues=\uB4E4\uC5B4\uC628 [{0}] (\uCD5C\uC18C\uA
ActionSimpleEval.Error.NoRows=\uC774\uC804 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4\!
ActionSimpleEval.ValueType.Label=\uD3C9\uAC00
ActionSimpleEval.SuccessWhenDifferent.Label=\uAC12\uC774 \uB2E4\uB978 \uACBD\uC6B0
ActionSimple.Error.Exception.UnableLoadXML=XML \uB178\uB4DC\uC5D0\uC11C Workflow \uC5D4\uD2B8\uB9AC\uB97C \uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4
ActionSimpleEval.CheckingVariable=\uBCC0\uC218 [{0}] \uD655\uC778 \uC911...
ActionSimpleEval.MinValue.Label=\uCD5C\uC18C
ActionSimpleEval.SuccessWhenRegExp.Label=\uAC12\uC774 \uC815\uADDC\uC2DD\uC744 \uB9CC\uC871\uD558\uB294 \uACBD\uC6B0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#
#
#Wed Feb 02 22:38:05 PST 2022
ActionSimple.Error.Exception.UnableLoadXML=N\u00E3o foi poss\u00EDvel carregar a entrada do n\u00F3 XML

ActionSimpleEval.CompareValue.Label=Valor
ActionSimpleEval.CompareValue.Tooltip=Valor
ActionSimpleEval.Description=Avaliar um campo ou uma vari\u00E1vel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.
#
#
ActionSimple.Error.Exception.UnableLoadXML=Unable to load action from XML node

ActionSimpleEval.CheckingVariable=Checking variable [{0}] ...
ActionSimpleEval.CompareValue.Label=\u503C
ActionSimpleEval.CompareValue.Tooltip=\u503C
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.apache.hop.workflow.actions.simpleeval;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import org.apache.hop.core.HopClientEnvironment;
import org.apache.hop.core.database.DatabaseMeta;
import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
import org.apache.hop.workflow.action.ActionSerializationTestUtil;
import org.apache.hop.workflow.actions.simpleeval.ActionSimpleEval.FieldType;
import org.apache.hop.workflow.actions.simpleeval.ActionSimpleEval.SuccessBooleanCondition;
import org.apache.hop.workflow.actions.simpleeval.ActionSimpleEval.SuccessNumberCondition;
import org.apache.hop.workflow.actions.simpleeval.ActionSimpleEval.SuccessStringCondition;
import org.apache.hop.workflow.actions.simpleeval.ActionSimpleEval.ValueType;
import org.junit.Test;

/** Unit tests for Simple Eval action. */
public class ActionSimpleEvalTest {

@Test
public void testSerialization() throws Exception {
HopClientEnvironment.init();
DatabaseMeta databaseMeta = new DatabaseMeta();
databaseMeta.setName("unit-test-db");
databaseMeta.setDatabaseType("NONE");
MemoryMetadataProvider provider = new MemoryMetadataProvider();
provider.getSerializer(DatabaseMeta.class).save(databaseMeta);

ActionSimpleEval action =
ActionSerializationTestUtil.testSerialization(
"/simple-eval-action.xml", ActionSimpleEval.class, provider);

assertEquals("2020", action.getCompareValue());
assertEquals("YEAR", action.getVariableName());
assertEquals(ValueType.VARIABLE, action.getValueType());
assertEquals(FieldType.NUMBER, action.getFieldType());
assertEquals("FieldTest", action.getFieldName());
assertEquals(SuccessStringCondition.EQUAL, action.getSuccessStringCondition());
assertEquals(SuccessNumberCondition.BETWEEN, action.getSuccessNumberCondition());
assertEquals(SuccessBooleanCondition.FALSE, action.getSuccessBooleanCondition());

assertEquals("100", action.getMinValue());
assertEquals("200", action.getMaxValue());

assertFalse(action.isSuccessWhenVarSet());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with ~
this work for additional information regarding copyright ownership. ~ The
ASF licenses this file to You 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. ~ -->
<action>
<name>Simple evaluation</name>
<description />
<type>SIMPLE_EVAL</type>
<attributes />
<comparevalue>2020</comparevalue>
<fieldname>FieldTest</fieldname>
<fieldtype>number</fieldtype>
<mask />
<maxvalue>200</maxvalue>
<minvalue>100</minvalue>
<successbooleancondition>false</successbooleancondition>
<successcondition>equal</successcondition>
<successnumbercondition>between</successnumbercondition>
<successwhenvarset>N</successwhenvarset>
<valuetype>variable</valuetype>
<variablename>YEAR</variablename>
</action>

0 comments on commit a9b1c5d

Please sign in to comment.