-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2905 from nadment/1991
Cleanup XML of action Simple Eval #1991
- Loading branch information
Showing
13 changed files
with
493 additions
and
706 deletions.
There are no files selected for viewing
774 changes: 309 additions & 465 deletions
774
...simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java
Large diffs are not rendered by default.
Oops, something went wrong.
248 changes: 87 additions & 161 deletions
248
...eval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalDialog.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...leeval/src/test/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEvalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
71 changes: 0 additions & 71 deletions
71
...java/org/apache/hop/workflow/actions/simpleeval/WorkflowActionSimpleEvalLoadSaveTest.java
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
plugins/actions/simpleeval/src/test/resources/simple-eval-action.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |