Merged dev into feature/CE-938-order-release-automation

This commit is contained in:
2024-06-04 19:55:25 -05:00
65 changed files with 806 additions and 167 deletions

View File

@ -0,0 +1,96 @@
/*
* QQQ - Low-code Application Framework for Engineers.
* Copyright (C) 2021-2024. Kingsrook, LLC
* 651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
* contact@kingsrook.com
* https://github.com/Kingsrook/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
import java.util.List;
import com.kingsrook.qqq.backend.core.BaseTest;
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetInput;
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.TableData;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.metadata.dashboard.QWidgetMetaData;
import com.kingsrook.qqq.backend.core.utils.TestUtils;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/*******************************************************************************
** Unit test for Aggregate2DTableWidgetRenderer
*******************************************************************************/
class Aggregate2DTableWidgetRendererTest extends BaseTest
{
/*******************************************************************************
**
*******************************************************************************/
@Test
void test() throws QException
{
new InsertAction().execute(new InsertInput(TestUtils.TABLE_NAME_PERSON_MEMORY).withRecords(List.of(
new QRecord().withValue("lastName", "Simpson").withValue("homeStateId", 50),
new QRecord().withValue("lastName", "Simpson").withValue("homeStateId", 50),
new QRecord().withValue("lastName", "Simpson").withValue("homeStateId", 50),
new QRecord().withValue("lastName", "Simpson").withValue("homeStateId", 49),
new QRecord().withValue("lastName", "Flanders").withValue("homeStateId", 49),
new QRecord().withValue("lastName", "Flanders").withValue("homeStateId", 49),
new QRecord().withValue("lastName", "Burns").withValue("homeStateId", 50)
)));
RenderWidgetInput input = new RenderWidgetInput();
input.setWidgetMetaData(new QWidgetMetaData()
.withDefaultValue("tableName", TestUtils.TABLE_NAME_PERSON_MEMORY)
.withDefaultValue("valueField", "id")
.withDefaultValue("rowField", "lastName")
.withDefaultValue("columnField", "homeStateId")
.withDefaultValue("orderBys", "row")
);
RenderWidgetOutput output = new Aggregate2DTableWidgetRenderer().render(input);
TableData tableData = (TableData) output.getWidgetData();
System.out.println(tableData.getRows());
TableDataAssert.assertThat(tableData)
.hasRowWithColumnContaining("_row", "Simpson", row ->
row.hasColumnContaining("50", "3")
.hasColumnContaining("49", "1")
.hasColumnContaining("_total", "4"))
.hasRowWithColumnContaining("_row", "Flanders", row ->
row.hasColumnContaining("50", "0")
.hasColumnContaining("49", "2")
.hasColumnContaining("_total", "2"))
.hasRowWithColumnContaining("_row", "Burns", row ->
row.hasColumnContaining("50", "1")
.hasColumnContaining("49", "0")
.hasColumnContaining("_total", "1"))
.hasRowWithColumnContaining("_row", "Total", row ->
row.hasColumnContaining("50", "4")
.hasColumnContaining("49", "3")
.hasColumnContaining("_total", "7"));
List<String> rowLabels = tableData.getRows().stream().map(r -> r.get("_row").toString()).toList();
assertEquals(List.of("Burns", "Flanders", "Simpson", "Total"), rowLabels);
}
}

View File

@ -0,0 +1,215 @@
/*
* Copyright © 2022-2023. ColdTrack <contact@coldtrack.com>. All Rights Reserved.
*/
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Predicate;
import com.kingsrook.qqq.backend.core.model.actions.widgets.RenderWidgetOutput;
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.QWidgetData;
import com.kingsrook.qqq.backend.core.model.dashboard.widgets.TableData;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
/*******************************************************************************
** AssertJ assert class for widget TableData
*******************************************************************************/
public class TableDataAssert extends AbstractAssert<TableDataAssert, TableData>
{
/*******************************************************************************
**
*******************************************************************************/
protected TableDataAssert(TableData actual, Class<?> selfType)
{
super(actual, selfType);
}
/*******************************************************************************
**
*******************************************************************************/
public static TableDataAssert assertThat(RenderWidgetOutput widgetOutput)
{
Assertions.assertThat(widgetOutput).isNotNull();
QWidgetData widgetData = widgetOutput.getWidgetData();
Assertions.assertThat(widgetData).isNotNull();
Assertions.assertThat(widgetData).isInstanceOf(TableData.class);
return (new TableDataAssert((TableData) widgetData, TableDataAssert.class));
}
/*******************************************************************************
**
*******************************************************************************/
public static TableDataAssert assertThat(TableData actual)
{
return (new TableDataAssert(actual, TableDataAssert.class));
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasSize(int expectedSize)
{
Assertions.assertThat(actual.getRows()).hasSize(expectedSize);
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasSizeAtLeast(int sizeAtLeast)
{
Assertions.assertThat(actual.getRows()).hasSizeGreaterThanOrEqualTo(sizeAtLeast);
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert doesNotHaveRowWithColumnContaining(String columnName, String containingValue)
{
for(Map<String, Object> row : actual.getRows())
{
if(row.containsKey(columnName))
{
String value = String.valueOf(row.get(columnName));
if(value != null && value.contains(containingValue))
{
failWithMessage("Failed because a row was found with a value in the [" + columnName + "] column containing [" + containingValue + "]"
+ (containingValue.equals(value) ? "" : " (full value: [" + value + "])."));
}
}
}
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnContaining(String columnName, String containingValue)
{
hasRowWithColumnContaining(columnName, containingValue, (row) ->
{
});
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnContaining(String columnName, String containingValue, Consumer<TableDataRowAssert> rowAsserter)
{
return hasRowWithColumnPredicate(columnName, value -> value != null && value.contains(containingValue), "containing [" + containingValue + "]", rowAsserter);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnMatching(String columnName, String matchingValue)
{
hasRowWithColumnMatching(columnName, matchingValue, (row) ->
{
});
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnMatching(String columnName, String matchingValue, Consumer<TableDataRowAssert> rowAsserter)
{
return hasRowWithColumnPredicate(columnName, value -> value != null && value.matches(matchingValue), "matching [" + matchingValue + "]", rowAsserter);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnEqualTo(String columnName, String equalToValue)
{
hasRowWithColumnEqualTo(columnName, equalToValue, (row) ->
{
});
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataAssert hasRowWithColumnEqualTo(String columnName, String equalToValue, Consumer<TableDataRowAssert> rowAsserter)
{
return hasRowWithColumnPredicate(columnName, value -> Objects.equals(value, equalToValue), "equalTo [" + equalToValue + "]", rowAsserter);
}
/*******************************************************************************
**
*******************************************************************************/
private TableDataAssert hasRowWithColumnPredicate(String columnName, Predicate<String> predicate, String predicateDescription, Consumer<TableDataRowAssert> rowAsserter)
{
List<String> foundValuesInColumn = new ArrayList<>();
for(Map<String, Object> row : actual.getRows())
{
if(row.containsKey(columnName))
{
String value = String.valueOf(row.get(columnName));
foundValuesInColumn.add(value);
if(predicate.test(value))
{
TableDataRowAssert tableDataRowAssert = TableDataRowAssert.assertThat(row);
rowAsserter.accept(tableDataRowAssert);
return (this);
}
}
}
if(actual.getRows().isEmpty())
{
failWithMessage("Failed because there are no rows in the table.");
}
else if(foundValuesInColumn.isEmpty())
{
failWithMessage("Failed to find any rows with a column named: [" + columnName + "]");
}
else
{
failWithMessage("Failed to find a row with column [" + columnName + "] " + predicateDescription
+ ".\nFound values were:\n" + StringUtils.join("\n", foundValuesInColumn));
}
return (null);
}
}

View File

@ -0,0 +1,192 @@
/*
* Copyright © 2022-2023. ColdTrack <contact@coldtrack.com>. All Rights Reserved.
*/
package com.kingsrook.qqq.backend.core.actions.dashboard.widgets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
import com.kingsrook.qqq.backend.core.utils.ValueUtils;
import org.assertj.core.api.AbstractAssert;
import org.assertj.core.api.Assertions;
import static org.junit.jupiter.api.Assertions.fail;
/*******************************************************************************
** AssertJ assert class for a row of data from a widget TableData
*******************************************************************************/
public class TableDataRowAssert extends AbstractAssert<TableDataRowAssert, Map<String, Object>>
{
/*******************************************************************************
**
*******************************************************************************/
protected TableDataRowAssert(Map<String, Object> actual, Class<?> selfType)
{
super(actual, selfType);
}
/*******************************************************************************
**
*******************************************************************************/
public static TableDataRowAssert assertThat(Map<String, Object> actual)
{
return (new TableDataRowAssert(actual, TableDataRowAssert.class));
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert hasColumnContaining(String columnName, String containingValue)
{
String value = String.valueOf(actual.get(columnName));
Assertions.assertThat(value)
.withFailMessage("Expected column [" + columnName + "] in row [" + actual + "] to contain [" + containingValue + "], but it didn't")
.contains(containingValue);
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert hasNoSubRows()
{
Object subRowsObject = actual.get("subRows");
if(subRowsObject != null)
{
@SuppressWarnings("unchecked")
List<Map<String, Object>> subRowsList = (List<Map<String, Object>>) subRowsObject;
if(!subRowsList.isEmpty())
{
fail("Row [" + actual + "] should not have had any subRows, but it did.");
}
}
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert hasSubRowWithColumnContaining(String columnName, String containingValue)
{
hasSubRowWithColumnContaining(columnName, containingValue, (row) ->
{
});
return (this);
}
/*******************************************************************************
**
*******************************************************************************/
private TableDataRowAssert hasSubRowWithColumnPredicate(String columnName, Function<Object, Boolean> predicate, String predicateDescription, Consumer<TableDataRowAssert> rowAsserter)
{
Object subRowsObject = actual.get("subRows");
Assertions.assertThat(subRowsObject)
.withFailMessage("subRows should not be null").isNotNull()
.withFailMessage("subRows should be a List").isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> subRowsList = (List<Map<String, Object>>) subRowsObject;
List<String> foundValuesInColumn = new ArrayList<>();
for(Map<String, Object> row : subRowsList)
{
if(row.containsKey(columnName))
{
String value = String.valueOf(row.get(columnName));
foundValuesInColumn.add(value);
if(value != null && predicate.apply(value))
{
TableDataRowAssert tableDataRowAssert = TableDataRowAssert.assertThat(row);
rowAsserter.accept(tableDataRowAssert);
return (this);
}
}
}
if(foundValuesInColumn.isEmpty())
{
failWithMessage("Failed to find any rows with a column named: [" + columnName + "]");
}
else
{
failWithMessage("Failed to find a row with column [" + columnName + "] " + predicateDescription
+ ".\nFound values were:\n" + StringUtils.join("\n", foundValuesInColumn));
}
return (null);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert hasSubRowWithColumnMatching(String columnName, String matchesValue, Consumer<TableDataRowAssert> rowAsserter)
{
Function<Object, Boolean> predicate = (value) -> ValueUtils.getValueAsString(value).matches(matchesValue);
return hasSubRowWithColumnPredicate(columnName, predicate, " matching [" + matchesValue + "]", rowAsserter);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert hasSubRowWithColumnContaining(String columnName, String containingValue, Consumer<TableDataRowAssert> rowAsserter)
{
Function<Object, Boolean> predicate = (value) -> ValueUtils.getValueAsString(value).contains(containingValue);
return hasSubRowWithColumnPredicate(columnName, predicate, " containing [" + containingValue + "]", rowAsserter);
}
/*******************************************************************************
**
*******************************************************************************/
public TableDataRowAssert doesNotHaveSubRowWithColumnContaining(String columnName, String containingValue)
{
Object subRowsObject = actual.get("subRows");
if(subRowsObject != null)
{
Assertions.assertThat(subRowsObject).withFailMessage("subRows should be a List").isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> subRowsList = (List<Map<String, Object>>) subRowsObject;
for(Map<String, Object> row : subRowsList)
{
if(row.containsKey(columnName))
{
String value = String.valueOf(row.get(columnName));
if(value != null && value.contains(containingValue))
{
failWithMessage("Failed because a row was found with a value in the [" + columnName + "] column containing [" + containingValue + "]"
+ (containingValue.equals(value) ? "" : " (full value: [" + value + "])."));
}
}
}
}
return (this);
}
}

View File

@ -27,13 +27,21 @@ import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import com.kingsrook.qqq.backend.core.BaseTest;
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
import com.kingsrook.qqq.backend.core.context.QContext;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.exceptions.QUserFacingException;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
import com.kingsrook.qqq.backend.core.utils.TestUtils;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -53,7 +61,7 @@ public class RunBackendStepActionTest extends BaseTest
{
TestCallback callback = new TestCallback();
RunBackendStepInput request = new RunBackendStepInput();
request.setProcessName("greet");
request.setProcessName(TestUtils.PROCESS_NAME_GREET_PEOPLE);
request.setStepName("prepare");
request.setCallback(callback);
RunBackendStepOutput result = new RunBackendStepAction().execute(request);
@ -67,6 +75,60 @@ public class RunBackendStepActionTest extends BaseTest
/*******************************************************************************
**
*******************************************************************************/
@Test
void testMinMaxInputRecords() throws QException
{
////////////////////////////////////////////
// put a min-input-records on the process //
////////////////////////////////////////////
QContext.getQInstance().getProcess(TestUtils.PROCESS_NAME_GREET_PEOPLE).withMinInputRecords(5);
//////////////////////////////////////////////////////////////////////////////////////
// insert fewer than that min - then run w/ non-filtered filter, and assert we fail //
//////////////////////////////////////////////////////////////////////////////////////
for(int i = 0; i < 3; i++)
{
new InsertAction().execute(new InsertInput(TestUtils.TABLE_NAME_PERSON_MEMORY).withRecord(new QRecord().withValue("firstName", String.valueOf(i))));
}
Supplier<RunBackendStepInput> inputSupplier = () ->
{
RunBackendStepInput input = new RunBackendStepInput();
input.setProcessName(TestUtils.PROCESS_NAME_GREET_PEOPLE);
input.setStepName("prepare");
input.setCallback(QProcessCallbackFactory.forFilter(new QQueryFilter()));
return (input);
};
assertThatThrownBy(() -> new RunBackendStepAction().execute(inputSupplier.get()))
.isInstanceOf(QUserFacingException.class)
.hasMessageContaining("Too few records");
////////////////////////////////////////////////////
// insert a few more - and then it should succeed //
////////////////////////////////////////////////////
for(int i = 3; i < 10; i++)
{
new InsertAction().execute(new InsertInput(TestUtils.TABLE_NAME_PERSON_MEMORY).withRecord(new QRecord().withValue("firstName", String.valueOf(i))));
}
new RunBackendStepAction().execute(inputSupplier.get());
////////////////////////////////////////////////////////////
// now put a max on the process, and it should fail again //
////////////////////////////////////////////////////////////
QContext.getQInstance().getProcess(TestUtils.PROCESS_NAME_GREET_PEOPLE).withMaxInputRecords(8);
assertThatThrownBy(() -> new RunBackendStepAction().execute(inputSupplier.get()))
.isInstanceOf(QUserFacingException.class)
.hasMessageContaining("Too many records");
}
/*******************************************************************************
**
*******************************************************************************/
@ -100,20 +162,20 @@ public class RunBackendStepActionTest extends BaseTest
for(QFieldMetaData field : fields)
{
rs.put(field.getName(), switch(field.getType())
{
case STRING -> "ABC";
case INTEGER -> 42;
case LONG -> 42L;
case DECIMAL -> new BigDecimal("47");
case BOOLEAN -> true;
case DATE, TIME, DATE_TIME -> null;
case TEXT -> """
ABC
XYZ""";
case HTML -> "<b>Oh my</b>";
case PASSWORD -> "myPa**word";
case BLOB -> new byte[] { 1, 2, 3, 4 };
});
{
case STRING -> "ABC";
case INTEGER -> 42;
case LONG -> 42L;
case DECIMAL -> new BigDecimal("47");
case BOOLEAN -> true;
case DATE, TIME, DATE_TIME -> null;
case TEXT -> """
ABC
XYZ""";
case HTML -> "<b>Oh my</b>";
case PASSWORD -> "myPa**word";
case BLOB -> new byte[] { 1, 2, 3, 4 };
});
}
return (rs);
}

View File

@ -1327,7 +1327,7 @@ public class QInstanceValidatorTest extends BaseTest
{
TableAutomationAction action = getAction0(qInstance);
action.setCodeReference(null);
action.setProcessName(TestUtils.PROCESS_NAME_GREET_PEOPLE);
action.setProcessName(TestUtils.PROCESS_NAME_BASEPULL);
},
"different table");
}
@ -2281,7 +2281,7 @@ public class QInstanceValidatorTest extends BaseTest
///////////////////////////////////////////////
public abstract class TestAbstractClass extends AbstractTransformStep implements BackendStep
{
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
}
}
@ -2293,7 +2293,7 @@ public class QInstanceValidatorTest extends BaseTest
///////////////////////////////////////////////
private class TestPrivateClass extends AbstractTransformStep implements BackendStep
{
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
}
@ -2320,7 +2320,7 @@ public class QInstanceValidatorTest extends BaseTest
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
}

View File

@ -111,7 +111,7 @@ class BulkInsertTransformStepTest extends BaseTest
newQRecord("uuid-D", "SKU-2", 1) // violate sku/storeId UK from pre-existing records
));
bulkInsertTransformStep.preRun(input, output);
bulkInsertTransformStep.run(input, output);
bulkInsertTransformStep.runOnePage(input, output);
///////////////////////////////////////////////////////
// assert about the records that passed successfully //
@ -193,7 +193,7 @@ class BulkInsertTransformStepTest extends BaseTest
newQRecord("uuid-D", "SKU-2", 1) // violate sku/storeId UK from pre-existing records
));
bulkInsertTransformStep.preRun(input, output);
bulkInsertTransformStep.run(input, output);
bulkInsertTransformStep.runOnePage(input, output);
///////////////////////////////////////////////////////
// assert that all records pass.

View File

@ -76,7 +76,7 @@ class LoadViaInsertOrUpdateStepTest extends BaseTest
input.setRecords(inputRecordList);
input.addValue(LoadViaInsertOrUpdateStep.FIELD_DESTINATION_TABLE, TestUtils.TABLE_NAME_PERSON_MEMORY);
RunBackendStepOutput output = new RunBackendStepOutput();
new LoadViaInsertOrUpdateStep().run(input, output);
new LoadViaInsertOrUpdateStep().runOnePage(input, output);
List<QRecord> qRecords = TestUtils.queryTable(qInstance, TestUtils.TABLE_NAME_PERSON_MEMORY);
assertEquals(2, qRecords.size());

View File

@ -56,7 +56,7 @@ class NoopTransformStepTest extends BaseTest
RunBackendStepOutput output = new RunBackendStepOutput();
NoopTransformStep noopTransformStep = new NoopTransformStep();
noopTransformStep.run(input, output);
noopTransformStep.runOnePage(input, output);
assertEquals(1, output.getRecords().size());
assertEquals(47, output.getRecords().get(0).getValueInteger("id"));

View File

@ -419,7 +419,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
for(QRecord qRecord : runBackendStepInput.getRecords())
{
@ -452,7 +452,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
for(QRecord qRecord : runBackendStepInput.getRecords())
{
@ -518,7 +518,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
for(QRecord qRecord : runBackendStepInput.getRecords())
{
@ -552,7 +552,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
for(QRecord qRecord : runBackendStepInput.getRecords())
{
@ -584,7 +584,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
**
*******************************************************************************/
@Override
public void run(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
{
///////////////////////////////////
// just pass the records through //

View File

@ -29,6 +29,7 @@ import org.junit.jupiter.api.Test;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.EQUALS;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.GREATER_THAN;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.IN;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.IS_NOT_BLANK;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.NOT_EQUALS;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QCriteriaOperator.NOT_IN;
import static com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter.BooleanOperator.OR;
@ -352,4 +353,23 @@ class QQueryFilterDeduperTest extends BaseTest
assertEquals(contradiction, dedupeFilter(contradiction));
}
/*******************************************************************************
**
*******************************************************************************/
@Test
void testInAndIsNotBlank()
{
assertEquals(new QQueryFilter().withCriteria(new QFilterCriteria("f", IN, 1, 2)), dedupeFilter(new QQueryFilter()
.withCriteria(new QFilterCriteria("f", IN, 1, 2))
.withCriteria(new QFilterCriteria("f", IS_NOT_BLANK))
));
assertEquals(new QQueryFilter().withCriteria(new QFilterCriteria("f", IN, 1, 2)), dedupeFilter(new QQueryFilter()
.withCriteria(new QFilterCriteria("f", IS_NOT_BLANK))
.withCriteria(new QFilterCriteria("f", IN, 1, 2))
));
}
}

View File

@ -1132,21 +1132,21 @@ public class TestUtils
{
return new QProcessMetaData()
.withName(PROCESS_NAME_GREET_PEOPLE)
.withTableName(TABLE_NAME_PERSON)
.withTableName(TABLE_NAME_PERSON_MEMORY)
.addStep(new QBackendStepMetaData()
.withName("prepare")
.withCode(new QCodeReference()
.withName(MockBackendStep.class.getName())
.withCodeType(QCodeType.JAVA))
.withInputData(new QFunctionInputMetaData()
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON))
.withRecordListMetaData(new QRecordListMetaData().withTableName(TABLE_NAME_PERSON_MEMORY))
.withFieldList(List.of(
new QFieldMetaData("greetingPrefix", QFieldType.STRING),
new QFieldMetaData("greetingSuffix", QFieldType.STRING)
)))
.withOutputMetaData(new QFunctionOutputMetaData()
.withRecordListMetaData(new QRecordListMetaData()
.withTableName(TABLE_NAME_PERSON)
.withTableName(TABLE_NAME_PERSON_MEMORY)
.withField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
)
.withFieldList(List.of(new QFieldMetaData("outputMessage", QFieldType.STRING))))