mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 05:01:07 +00:00
Merged feature/checkstyle-updates into dev
This commit is contained in:
@ -344,6 +344,9 @@ public class RecordAutomationStatusUpdater
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private record Key(QTableMetaData table, TriggerEvent triggerEvent) {}
|
||||
|
||||
}
|
||||
|
@ -55,10 +55,10 @@ public abstract class AbstractPreInsertCustomizer implements TableCustomizerInte
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// allow the customizer to specify when it should be executed as part of the //
|
||||
// insert action. default (per method in this class) is AFTER_ALL_VALIDATIONS //
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
/***************************************************************************
|
||||
** allow the customizer to specify when it should be executed as part of the
|
||||
** insert action. default (per method in this class) is AFTER_ALL_VALIDATIONS
|
||||
***************************************************************************/
|
||||
public enum WhenToRun
|
||||
{
|
||||
BEFORE_ALL_VALIDATIONS,
|
||||
|
@ -50,6 +50,9 @@ import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
|
||||
*******************************************************************************/
|
||||
public abstract class ChildInserterPostInsertCustomizer extends AbstractPostInsertCustomizer
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum RelationshipType
|
||||
{
|
||||
PARENT_POINTS_AT_CHILD,
|
||||
|
@ -152,5 +152,8 @@ public class AuditDetailAccumulator implements Serializable
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private record TableNameAndPrimaryKey(String tableName, Serializable primaryKey) {}
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ public class NowWithOffset extends AbstractFilterExpression<Instant>
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum Operator
|
||||
{PLUS, MINUS}
|
||||
|
||||
|
@ -43,6 +43,9 @@ public class ThisOrLastPeriod extends AbstractFilterExpression<Instant>
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum Operator
|
||||
{THIS, LAST}
|
||||
|
||||
|
@ -28,6 +28,9 @@ package com.kingsrook.qqq.backend.core.model.dashboard.widgets;
|
||||
*******************************************************************************/
|
||||
public class AlertData extends QWidgetData
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum AlertType
|
||||
{
|
||||
ERROR,
|
||||
|
@ -33,6 +33,9 @@ public class BlockTooltip
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum Placement
|
||||
{BOTTOM, LEFT, RIGHT, TOP}
|
||||
|
||||
|
@ -39,6 +39,9 @@ public class ParentWidgetMetaData extends QWidgetMetaData
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum LayoutType
|
||||
{
|
||||
GRID,
|
||||
|
@ -32,6 +32,9 @@ import com.kingsrook.qqq.backend.core.model.metadata.tables.UniqueKey;
|
||||
*******************************************************************************/
|
||||
public class CacheUseCase
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum Type
|
||||
{
|
||||
PRIMARY_KEY_TO_PRIMARY_KEY, // e.g., the primary key in the cache table equals the primary key in the source table.
|
||||
|
@ -26,7 +26,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SuppressWarnings({ "checkstyle:javadoc", "DanglingJavadoc" })
|
||||
/*******************************************************************************
|
||||
** List.of is "great", but annoying because it makes unmodifiable lists...
|
||||
** So, replace it with this, which returns ArrayLists, which "don't suck"
|
||||
|
@ -27,7 +27,6 @@ import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
@SuppressWarnings({ "checkstyle:javadoc", "DanglingJavadoc" })
|
||||
/*******************************************************************************
|
||||
** Map.of is "great", but annoying because it makes unmodifiable maps, and it
|
||||
** NPE's on nulls... So, replace it with this, which returns HashMaps (or maps
|
||||
|
@ -1,5 +1,22 @@
|
||||
/*
|
||||
* Copyright © 2022-2023. ColdTrack <contact@coldtrack.com>. All Rights Reserved.
|
||||
* 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;
|
||||
|
@ -1,5 +1,22 @@
|
||||
/*
|
||||
* Copyright © 2022-2023. ColdTrack <contact@coldtrack.com>. All Rights Reserved.
|
||||
* 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;
|
||||
|
@ -67,7 +67,8 @@ class ProcessMetaDataActionTest extends BaseTest
|
||||
@Test
|
||||
public void test_notFound()
|
||||
{
|
||||
assertThrows(QNotFoundException.class, () -> {
|
||||
assertThrows(QNotFoundException.class, () ->
|
||||
{
|
||||
ProcessMetaDataInput request = new ProcessMetaDataInput();
|
||||
request.setProcessName("willNotBeFound");
|
||||
new ProcessMetaDataAction().execute(request);
|
||||
|
@ -65,7 +65,8 @@ class TableMetaDataActionTest extends BaseTest
|
||||
@Test
|
||||
public void test_notFound()
|
||||
{
|
||||
assertThrows(QUserFacingException.class, () -> {
|
||||
assertThrows(QUserFacingException.class, () ->
|
||||
{
|
||||
TableMetaDataInput request = new TableMetaDataInput();
|
||||
request.setTableName("willNotBeFound");
|
||||
new TableMetaDataAction().execute(request);
|
||||
|
@ -51,16 +51,16 @@ public class RunProcessUpdateStepListTest extends BaseTest
|
||||
{
|
||||
private static final String PROCESS_NAME = RunProcessUpdateStepListTest.class.getSimpleName();
|
||||
|
||||
private final static String STEP_START = "start";
|
||||
private final static String STEP_A = "a";
|
||||
private final static String STEP_B = "b";
|
||||
private final static String STEP_C = "c";
|
||||
private final static String STEP_1 = "1";
|
||||
private final static String STEP_2 = "2";
|
||||
private final static String STEP_3 = "3";
|
||||
private final static String STEP_END = "end";
|
||||
private static final String STEP_START = "start";
|
||||
private static final String STEP_A = "a";
|
||||
private static final String STEP_B = "b";
|
||||
private static final String STEP_C = "c";
|
||||
private static final String STEP_1 = "1";
|
||||
private static final String STEP_2 = "2";
|
||||
private static final String STEP_3 = "3";
|
||||
private static final String STEP_END = "end";
|
||||
|
||||
private final static List<String> LETTERS_STEP_LIST = List.of(
|
||||
private static final List<String> LETTERS_STEP_LIST = List.of(
|
||||
STEP_START,
|
||||
STEP_A,
|
||||
STEP_B,
|
||||
@ -68,7 +68,7 @@ public class RunProcessUpdateStepListTest extends BaseTest
|
||||
STEP_END
|
||||
);
|
||||
|
||||
private final static List<String> NUMBERS_STEP_LIST = List.of(
|
||||
private static final List<String> NUMBERS_STEP_LIST = List.of(
|
||||
STEP_START,
|
||||
STEP_1,
|
||||
STEP_2,
|
||||
|
@ -36,10 +36,10 @@ import com.kingsrook.qqq.backend.core.BaseTest;
|
||||
import com.kingsrook.qqq.backend.core.context.QContext;
|
||||
import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DateTimeDisplayValueBehavior;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DisplayFormat;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldMetaData;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.QFieldType;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.fields.DateTimeDisplayValueBehavior;
|
||||
import com.kingsrook.qqq.backend.core.model.metadata.tables.QTableMetaData;
|
||||
import com.kingsrook.qqq.backend.core.utils.TestUtils;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -169,10 +169,10 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
public void test_validateNullTablesAndProcesses()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
qInstance.setTables(null);
|
||||
qInstance.setProcesses(null);
|
||||
},
|
||||
{
|
||||
qInstance.setTables(null);
|
||||
qInstance.setProcesses(null);
|
||||
},
|
||||
true,
|
||||
"At least 1 table must be defined");
|
||||
}
|
||||
@ -187,10 +187,10 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
public void test_validateEmptyTablesAndProcesses()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
qInstance.setTables(new HashMap<>());
|
||||
qInstance.setProcesses(new HashMap<>());
|
||||
},
|
||||
{
|
||||
qInstance.setTables(new HashMap<>());
|
||||
qInstance.setProcesses(new HashMap<>());
|
||||
},
|
||||
true,
|
||||
"At least 1 table must be defined");
|
||||
}
|
||||
@ -548,7 +548,8 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
////////////////////////////////////////
|
||||
// make sure our always failer fails. //
|
||||
////////////////////////////////////////
|
||||
assertValidationFailureReasonsAllowingExtraReasons((qInstance) -> {
|
||||
assertValidationFailureReasonsAllowingExtraReasons((qInstance) ->
|
||||
{
|
||||
}, "always fail");
|
||||
}
|
||||
finally
|
||||
@ -558,7 +559,8 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
////////////////////////////////////////////////////
|
||||
// make sure if remove all plugins, we don't fail //
|
||||
////////////////////////////////////////////////////
|
||||
assertValidationSuccess((qInstance) -> {
|
||||
assertValidationSuccess((qInstance) ->
|
||||
{
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -627,6 +629,9 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
*******************************************************************************/
|
||||
public static class CustomizerWithNoVoidConstructor
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public CustomizerWithNoVoidConstructor(boolean b)
|
||||
{
|
||||
|
||||
@ -640,6 +645,9 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
*******************************************************************************/
|
||||
private static class CustomizerWithPrivateVisibility extends AbstractPostQueryCustomizer
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public CustomizerWithPrivateVisibility()
|
||||
{
|
||||
System.out.println("eh?");
|
||||
@ -664,6 +672,9 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
*******************************************************************************/
|
||||
public static class CustomizerWithOnlyPrivateConstructor
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private CustomizerWithOnlyPrivateConstructor()
|
||||
{
|
||||
|
||||
@ -1108,15 +1119,16 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
@Test
|
||||
void testPossibleValueSourceMisConfiguredEnum()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) -> {
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_STATE);
|
||||
possibleValueSource.setTableName("person");
|
||||
possibleValueSource.setSearchFields(List.of("id"));
|
||||
possibleValueSource.setOrderByFields(List.of(new QFilterOrderBy("id")));
|
||||
possibleValueSource.setCustomCodeReference(new QCodeReference());
|
||||
possibleValueSource.setEnumValues(null);
|
||||
possibleValueSource.setType(QPossibleValueSourceType.ENUM);
|
||||
},
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_STATE);
|
||||
possibleValueSource.setTableName("person");
|
||||
possibleValueSource.setSearchFields(List.of("id"));
|
||||
possibleValueSource.setOrderByFields(List.of(new QFilterOrderBy("id")));
|
||||
possibleValueSource.setCustomCodeReference(new QCodeReference());
|
||||
possibleValueSource.setEnumValues(null);
|
||||
possibleValueSource.setType(QPossibleValueSourceType.ENUM);
|
||||
},
|
||||
"should not have a tableName",
|
||||
"should not have searchFields",
|
||||
"should not have orderByFields",
|
||||
@ -1135,15 +1147,16 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
@Test
|
||||
void testPossibleValueSourceMisConfiguredTable()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) -> {
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_SHAPE);
|
||||
possibleValueSource.setTableName(null);
|
||||
possibleValueSource.setSearchFields(null);
|
||||
possibleValueSource.setOrderByFields(new ArrayList<>());
|
||||
possibleValueSource.setCustomCodeReference(new QCodeReference());
|
||||
possibleValueSource.setEnumValues(List.of(new QPossibleValue<>("test")));
|
||||
possibleValueSource.setType(QPossibleValueSourceType.TABLE);
|
||||
},
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_SHAPE);
|
||||
possibleValueSource.setTableName(null);
|
||||
possibleValueSource.setSearchFields(null);
|
||||
possibleValueSource.setOrderByFields(new ArrayList<>());
|
||||
possibleValueSource.setCustomCodeReference(new QCodeReference());
|
||||
possibleValueSource.setEnumValues(List.of(new QPossibleValue<>("test")));
|
||||
possibleValueSource.setType(QPossibleValueSourceType.TABLE);
|
||||
},
|
||||
"should not have enum values",
|
||||
"should not have a customCodeReference",
|
||||
"is missing a tableName",
|
||||
@ -1165,15 +1178,16 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
@Test
|
||||
void testPossibleValueSourceMisConfiguredCustom()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) -> {
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_CUSTOM);
|
||||
possibleValueSource.setTableName("person");
|
||||
possibleValueSource.setSearchFields(List.of("id"));
|
||||
possibleValueSource.setOrderByFields(List.of(new QFilterOrderBy("id")));
|
||||
possibleValueSource.setCustomCodeReference(null);
|
||||
possibleValueSource.setEnumValues(List.of(new QPossibleValue<>("test")));
|
||||
possibleValueSource.setType(QPossibleValueSourceType.CUSTOM);
|
||||
},
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
QPossibleValueSource possibleValueSource = qInstance.getPossibleValueSource(TestUtils.POSSIBLE_VALUE_SOURCE_CUSTOM);
|
||||
possibleValueSource.setTableName("person");
|
||||
possibleValueSource.setSearchFields(List.of("id"));
|
||||
possibleValueSource.setOrderByFields(List.of(new QFilterOrderBy("id")));
|
||||
possibleValueSource.setCustomCodeReference(null);
|
||||
possibleValueSource.setEnumValues(List.of(new QPossibleValue<>("test")));
|
||||
possibleValueSource.setType(QPossibleValueSourceType.CUSTOM);
|
||||
},
|
||||
"should not have enum values",
|
||||
"should not have a tableName",
|
||||
"should not have searchFields",
|
||||
@ -1272,10 +1286,10 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
"action missing a name");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
List<TableAutomationAction> actions = qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY).getAutomationDetails().getActions();
|
||||
actions.add(actions.get(0));
|
||||
},
|
||||
{
|
||||
List<TableAutomationAction> actions = qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY).getAutomationDetails().getActions();
|
||||
actions.add(actions.get(0));
|
||||
},
|
||||
"more than one action named");
|
||||
}
|
||||
|
||||
@ -1315,19 +1329,19 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
void testTableAutomationActionProcessName()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName("notAProcess");
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName("notAProcess");
|
||||
},
|
||||
"unrecognized processName");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName(TestUtils.PROCESS_NAME_BASEPULL);
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName(TestUtils.PROCESS_NAME_BASEPULL);
|
||||
},
|
||||
"different table");
|
||||
}
|
||||
|
||||
@ -1340,19 +1354,19 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
void testTableAutomationActionCodeReferenceAndProcessName()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName(null);
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(null);
|
||||
action.setProcessName(null);
|
||||
},
|
||||
"missing both");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(new QCodeReference(TestUtils.CheckAge.class));
|
||||
action.setProcessName(TestUtils.PROCESS_NAME_INCREASE_BIRTHDATE);
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setCodeReference(new QCodeReference(TestUtils.CheckAge.class));
|
||||
action.setProcessName(TestUtils.PROCESS_NAME_INCREASE_BIRTHDATE);
|
||||
},
|
||||
"has both");
|
||||
}
|
||||
|
||||
@ -1365,21 +1379,21 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
void testTableAutomationActionFilter()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setFilter(new QQueryFilter()
|
||||
.withCriteria(new QFilterCriteria())
|
||||
);
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setFilter(new QQueryFilter()
|
||||
.withCriteria(new QFilterCriteria())
|
||||
);
|
||||
},
|
||||
"without a field name", "without an operator");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setFilter(new QQueryFilter()
|
||||
.withCriteria(new QFilterCriteria("notAField", QCriteriaOperator.EQUALS, Collections.emptyList()))
|
||||
);
|
||||
},
|
||||
{
|
||||
TableAutomationAction action = getAction0(qInstance);
|
||||
action.setFilter(new QQueryFilter()
|
||||
.withCriteria(new QFilterCriteria("notAField", QCriteriaOperator.EQUALS, Collections.emptyList()))
|
||||
);
|
||||
},
|
||||
"unrecognized field");
|
||||
}
|
||||
|
||||
@ -1484,13 +1498,13 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
void testQueueProviderSQSAttributes()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
SQSQueueProviderMetaData queueProvider = (SQSQueueProviderMetaData) qInstance.getQueueProvider(TestUtils.DEFAULT_QUEUE_PROVIDER);
|
||||
queueProvider.setAccessKey(null);
|
||||
queueProvider.setSecretKey("");
|
||||
queueProvider.setRegion(null);
|
||||
queueProvider.setBaseURL("");
|
||||
},
|
||||
{
|
||||
SQSQueueProviderMetaData queueProvider = (SQSQueueProviderMetaData) qInstance.getQueueProvider(TestUtils.DEFAULT_QUEUE_PROVIDER);
|
||||
queueProvider.setAccessKey(null);
|
||||
queueProvider.setSecretKey("");
|
||||
queueProvider.setRegion(null);
|
||||
queueProvider.setBaseURL("");
|
||||
},
|
||||
"Missing accessKey", "Missing secretKey", "Missing region", "Missing baseURL");
|
||||
}
|
||||
|
||||
@ -1607,43 +1621,43 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
void testReportDataSourceNames()
|
||||
{
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// enricher will give us a default name if only 1 data source, so, set 1st one to null name, then add a second //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
QReportMetaData report = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON);
|
||||
report.setDataSources(new ArrayList<>(report.getDataSources()));
|
||||
report.getDataSources().get(0).setName(null);
|
||||
report.getDataSources().add(new QReportDataSource()
|
||||
.withName("2nd")
|
||||
.withSourceTable(TestUtils.TABLE_NAME_PERSON)
|
||||
);
|
||||
},
|
||||
{
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// enricher will give us a default name if only 1 data source, so, set 1st one to null name, then add a second //
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
QReportMetaData report = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON);
|
||||
report.setDataSources(new ArrayList<>(report.getDataSources()));
|
||||
report.getDataSources().get(0).setName(null);
|
||||
report.getDataSources().add(new QReportDataSource()
|
||||
.withName("2nd")
|
||||
.withSourceTable(TestUtils.TABLE_NAME_PERSON)
|
||||
);
|
||||
},
|
||||
"Missing name for a dataSource",
|
||||
"unrecognized dataSourceName");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
///////////////////////////////////
|
||||
// same as above, but "" vs null //
|
||||
///////////////////////////////////
|
||||
QReportMetaData report = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON);
|
||||
report.setDataSources(new ArrayList<>(report.getDataSources()));
|
||||
report.getDataSources().get(0).setName("");
|
||||
report.getDataSources().add(new QReportDataSource()
|
||||
.withName("2nd")
|
||||
.withSourceTable(TestUtils.TABLE_NAME_PERSON)
|
||||
);
|
||||
},
|
||||
{
|
||||
///////////////////////////////////
|
||||
// same as above, but "" vs null //
|
||||
///////////////////////////////////
|
||||
QReportMetaData report = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON);
|
||||
report.setDataSources(new ArrayList<>(report.getDataSources()));
|
||||
report.getDataSources().get(0).setName("");
|
||||
report.getDataSources().add(new QReportDataSource()
|
||||
.withName("2nd")
|
||||
.withSourceTable(TestUtils.TABLE_NAME_PERSON)
|
||||
);
|
||||
},
|
||||
"Missing name for a dataSource",
|
||||
"unrecognized dataSourceName");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
List<QReportDataSource> dataSources = new ArrayList<>(qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources());
|
||||
dataSources.add(dataSources.get(0));
|
||||
qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).setDataSources(dataSources);
|
||||
},
|
||||
{
|
||||
List<QReportDataSource> dataSources = new ArrayList<>(qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources());
|
||||
dataSources.add(dataSources.get(0));
|
||||
qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).setDataSources(dataSources);
|
||||
},
|
||||
"More than one dataSource with name");
|
||||
}
|
||||
|
||||
@ -1702,19 +1716,19 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
"has both a sourceTable and a staticDataSupplier");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(null, QCodeType.JAVA));
|
||||
},
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(null, QCodeType.JAVA));
|
||||
},
|
||||
"missing a code reference name");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(ArrayList.class));
|
||||
},
|
||||
{
|
||||
QReportDataSource dataSource = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getDataSources().get(0);
|
||||
dataSource.setSourceTable(null);
|
||||
dataSource.setStaticDataSupplier(new QCodeReference(ArrayList.class));
|
||||
},
|
||||
"is not of the expected type");
|
||||
}
|
||||
|
||||
@ -1773,11 +1787,11 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
"has a column with no name");
|
||||
|
||||
assertValidationFailureReasons((qInstance) ->
|
||||
{
|
||||
List<QReportField> columns = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getViews().get(0).getColumns();
|
||||
columns.get(0).setName("id");
|
||||
columns.get(1).setName("id");
|
||||
},
|
||||
{
|
||||
List<QReportField> columns = qInstance.getReport(TestUtils.REPORT_NAME_SHAPES_PERSON).getViews().get(0).getColumns();
|
||||
columns.get(0).setName("id");
|
||||
columns.get(1).setName("id");
|
||||
},
|
||||
"has multiple columns named: id");
|
||||
|
||||
}
|
||||
@ -1990,35 +2004,35 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
"Table A exposedJoin B is missing a label");
|
||||
|
||||
assertValidationFailureReasons(qInstance ->
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id").withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B").withJoinPath(List.of("notAJoin"))));
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id").withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B").withJoinPath(List.of("notAJoin"))));
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
"does not match a valid join connection in the instance");
|
||||
|
||||
assertValidationFailureReasons(qInstance ->
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id")
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("foo").withJoinPath(List.of("AB")))
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("C").withLabel("foo").withJoinPath(List.of("AC")))
|
||||
);
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addTable(newTable("C", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("C").withName("AC").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id")
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("foo").withJoinPath(List.of("AB")))
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("C").withLabel("foo").withJoinPath(List.of("AC")))
|
||||
);
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addTable(newTable("C", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("C").withName("AC").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
"more than one join labeled: foo");
|
||||
|
||||
assertValidationFailureReasons(qInstance ->
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id")
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B1").withJoinPath(List.of("AB")))
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B2").withJoinPath(List.of("AB")))
|
||||
);
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
{
|
||||
qInstance.addTable(newTable("A", "id")
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B1").withJoinPath(List.of("AB")))
|
||||
.withExposedJoin(new ExposedJoin().withJoinTable("B").withLabel("B2").withJoinPath(List.of("AB")))
|
||||
);
|
||||
qInstance.addTable(newTable("B", "id", "aId"));
|
||||
qInstance.addJoin(new QJoinMetaData().withLeftTable("A").withRightTable("B").withName("AB").withType(JoinType.ONE_TO_ONE).withJoinOn(new JoinOn("id", "aId")));
|
||||
},
|
||||
"than one join with the joinPath: [AB]");
|
||||
|
||||
assertValidationSuccess(qInstance ->
|
||||
@ -2275,11 +2289,14 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// test classes for validating process steps //
|
||||
///////////////////////////////////////////////
|
||||
/***************************************************************************
|
||||
** test classes for validating process steps
|
||||
***************************************************************************/
|
||||
public abstract class TestAbstractClass extends AbstractTransformStep
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
}
|
||||
@ -2287,17 +2304,23 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// //
|
||||
///////////////////////////////////////////////
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private class TestPrivateClass extends AbstractTransformStep
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Override
|
||||
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
|
||||
{
|
||||
@ -2307,11 +2330,14 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// //
|
||||
///////////////////////////////////////////////
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public class TestNoArgsConstructorClass extends AbstractTransformStep
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public TestNoArgsConstructorClass(int i)
|
||||
{
|
||||
|
||||
@ -2319,12 +2345,18 @@ public class QInstanceValidatorTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public void runOnePage(RunBackendStepInput runBackendStepInput, RunBackendStepOutput runBackendStepOutput) throws QException
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Override
|
||||
public ArrayList<ProcessSummaryLineInterface> getProcessSummary(RunBackendStepOutput runBackendStepOutput, boolean isForResultScreen)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
/*******************************************************************************
|
||||
** Unit test for com.kingsrook.qqq.backend.core.logging.LogUtils
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:FileTabCharacter")
|
||||
class LogUtilsTest extends BaseTest
|
||||
{
|
||||
private static final QLogger LOG = QLogger.getLogger(LogUtilsTest.class);
|
||||
@ -123,6 +124,7 @@ class LogUtilsTest extends BaseTest
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@SuppressWarnings("checkstyle:FileTabCharacter")
|
||||
@Test
|
||||
void testFilterStackTraceMySqlConnection()
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
*******************************************************************************/
|
||||
class CaseChangeBehaviorTest extends BaseTest
|
||||
{
|
||||
public static final String FIELD = "firstName" ;
|
||||
public static final String FIELD = "firstName";
|
||||
|
||||
|
||||
|
||||
|
@ -138,10 +138,12 @@ class BulkInsertTransformStepTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
private QTableMetaData defineTable(QTableMetaData TABLE_NAME, QInstance instance)
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private QTableMetaData defineTable(QTableMetaData table, QInstance instance)
|
||||
{
|
||||
QTableMetaData table = TABLE_NAME
|
||||
.withPrimaryKeyField("id")
|
||||
table.withPrimaryKeyField("id")
|
||||
.withField(new QFieldMetaData("id", QFieldType.INTEGER))
|
||||
.withField(new QFieldMetaData("uuid", QFieldType.STRING))
|
||||
.withField(new QFieldMetaData("sku", QFieldType.STRING))
|
||||
@ -203,6 +205,9 @@ class BulkInsertTransformStepTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private boolean recordEquals(QRecord record, String uuid, String sku, Integer storeId)
|
||||
{
|
||||
return (record.getValue("uuid").equals(uuid)
|
||||
|
@ -64,6 +64,9 @@ class BasicETLTransformFunctionTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private String doRemoveNonNumericValuesFromMappedRecords(QFieldType fieldType, String inputValue)
|
||||
{
|
||||
String field = "field";
|
||||
|
@ -48,7 +48,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
*******************************************************************************/
|
||||
class MergeDuplicatesProcessTest extends BaseTest
|
||||
{
|
||||
String PROCESS_NAME = "testMergeProcess";
|
||||
private static final String PROCESS_NAME = "testMergeProcess";
|
||||
|
||||
|
||||
|
||||
|
@ -54,8 +54,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
*******************************************************************************/
|
||||
class TableSyncProcessTest extends BaseTest
|
||||
{
|
||||
String PROCESS_NAME = "testSyncProcess";
|
||||
String TABLE_NAME_PEOPLE_SYNC = "peopleSync";
|
||||
private static final String PROCESS_NAME = "testSyncProcess";
|
||||
private static final String TABLE_NAME_PEOPLE_SYNC = "peopleSync";
|
||||
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ import org.quartz.SchedulerException;
|
||||
*******************************************************************************/
|
||||
public class QuartzTestUtils
|
||||
{
|
||||
public final static String QUARTZ_SCHEDULER_NAME = "TestQuartzScheduler";
|
||||
public static final String QUARTZ_SCHEDULER_NAME = "TestQuartzScheduler";
|
||||
|
||||
|
||||
|
||||
|
@ -32,6 +32,9 @@ import com.kingsrook.qqq.backend.core.model.data.QRecord;
|
||||
*******************************************************************************/
|
||||
public class PersonQRecord extends QRecord
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withLastName(String lastName)
|
||||
{
|
||||
setValue("lastName", lastName);
|
||||
@ -40,6 +43,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withFirstName(String firstName)
|
||||
{
|
||||
setValue("firstName", firstName);
|
||||
@ -48,6 +54,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withBirthDate(LocalDate birthDate)
|
||||
{
|
||||
setValue("birthDate", birthDate);
|
||||
@ -56,6 +65,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withNoOfShoes(Integer noOfShoes)
|
||||
{
|
||||
setValue("noOfShoes", noOfShoes);
|
||||
@ -64,6 +76,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withPrice(BigDecimal price)
|
||||
{
|
||||
setValue("price", price);
|
||||
@ -72,6 +87,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withCost(BigDecimal cost)
|
||||
{
|
||||
setValue("cost", cost);
|
||||
@ -80,6 +98,9 @@ public class PersonQRecord extends QRecord
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public PersonQRecord withHomeStateId(int homeStateId)
|
||||
{
|
||||
setValue("homeStateId", homeStateId);
|
||||
|
@ -93,6 +93,9 @@ class JsonUtilsTest extends BaseTest
|
||||
*******************************************************************************/
|
||||
private static class LooksLikeAnEntityButJustThrowsInItsGetterMethod
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public String getValue()
|
||||
{
|
||||
throw new IllegalStateException("Test");
|
||||
|
Reference in New Issue
Block a user