mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
Merged feature/checkstyle-updates into dev
This commit is contained in:
@ -213,18 +213,6 @@
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<!-- <module name="JavadocTagContinuationIndentation"/> -->
|
||||
<!--
|
||||
<module name="SummaryJavadoc">
|
||||
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
|
||||
</module>
|
||||
-->
|
||||
<!-- <module name="JavadocParagraph"/> -->
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
@ -233,23 +221,14 @@
|
||||
<module name="MissingJavadocMethod">
|
||||
<property name="scope" value="private"/>
|
||||
</module>
|
||||
<module name="MissingJavadocType">
|
||||
<property name="scope" value="private"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="SingleLineJavadoc">
|
||||
<property name="ignoreInlineTags" value="false"/>
|
||||
</module>
|
||||
|
||||
<module name="MagicNumber">
|
||||
<property name="severity" value="info"/>
|
||||
<property name="tokens" value="NUM_DOUBLE, NUM_FLOAT, NUM_INT"/>
|
||||
<property name="ignoreNumbers" value="0, 1, 2, 3, 4, 5, 6, 7, 8"/>
|
||||
<property name="ignoreFieldDeclaration" value="true"/>
|
||||
<property name="ignoreAnnotation" value="true"/>
|
||||
</module>
|
||||
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="expected"/>
|
||||
</module>
|
||||
|
1
pom.xml
1
pom.xml
@ -167,6 +167,7 @@
|
||||
<violationSeverity>warning</violationSeverity>
|
||||
<excludes>**/target/generated-sources/*.*</excludes>
|
||||
<!-- <linkXRef>false</linkXRef> -->
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
|
@ -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");
|
||||
|
@ -117,6 +117,9 @@ public class BaseAPIActionUtil
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum UpdateHttpMethod
|
||||
{PUT, POST}
|
||||
|
||||
|
@ -95,8 +95,7 @@ public class TestUtils
|
||||
.withAuthorizationType(AuthorizationType.API_KEY_HEADER)
|
||||
.withBaseUrl("http://localhost:9999/mock")
|
||||
.withContentType("application/json")
|
||||
.withActionUtil(new QCodeReference(MockApiActionUtils.class))
|
||||
);
|
||||
.withActionUtil(new QCodeReference(MockApiActionUtils.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -115,8 +114,7 @@ public class TestUtils
|
||||
.withBackendDetails(new APITableBackendDetails()
|
||||
.withTablePath("mock")
|
||||
.withTableWrapperObjectName("mocks")
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -147,8 +145,7 @@ public class TestUtils
|
||||
.withAuthorizationType(AuthorizationType.BASIC_AUTH_API_KEY)
|
||||
.withBaseUrl("https://api.easypost.com/v2/")
|
||||
.withContentType("application/json")
|
||||
.withActionUtil(new QCodeReference(EasyPostUtils.class))
|
||||
);
|
||||
.withActionUtil(new QCodeReference(EasyPostUtils.class)));
|
||||
}
|
||||
|
||||
|
||||
@ -170,8 +167,7 @@ public class TestUtils
|
||||
.withBackendDetails(new APITableBackendDetails()
|
||||
.withTablePath("variant")
|
||||
.withTableWrapperObjectName("variant")
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -191,7 +187,6 @@ public class TestUtils
|
||||
.withBackendDetails(new APITableBackendDetails()
|
||||
.withTablePath("trackers")
|
||||
.withTableWrapperObjectName("tracker")
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
*******************************************************************************/
|
||||
public class FilesystemBackendModuleTest
|
||||
{
|
||||
private final String PATH_THAT_WONT_EXIST = "some/path/that/wont/exist";
|
||||
private static final String PATH_THAT_WONT_EXIST = "some/path/that/wont/exist";
|
||||
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
*******************************************************************************/
|
||||
public class S3BackendModuleTest extends BaseS3Test
|
||||
{
|
||||
private final String PATH_THAT_WONT_EXIST = "some/path/that/wont/exist";
|
||||
private static final String PATH_THAT_WONT_EXIST = "some/path/that/wont/exist";
|
||||
|
||||
|
||||
|
||||
|
@ -37,6 +37,9 @@ import org.junit.jupiter.api.Test;
|
||||
public class PathMatcherGlobTest
|
||||
{
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Test
|
||||
public void testPathMatcher() throws Exception
|
||||
{
|
||||
|
@ -158,8 +158,7 @@ public class TestUtils
|
||||
.withName(TABLE_NAME_PERSON)
|
||||
.withType(QPossibleValueSourceType.TABLE)
|
||||
.withTableName(TABLE_NAME_PERSON)
|
||||
.withValueFormatAndFields(PVSValueFormatAndFields.LABEL_ONLY)
|
||||
);
|
||||
.withValueFormatAndFields(PVSValueFormatAndFields.LABEL_ONLY));
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,8 +201,7 @@ public class TestUtils
|
||||
.withName(TABLE_NAME_PERSON)
|
||||
.withType(QPossibleValueSourceType.TABLE)
|
||||
.withTableName(TABLE_NAME_PERSON)
|
||||
.withValueFormatAndFields(PVSValueFormatAndFields.LABEL_ONLY)
|
||||
);
|
||||
.withValueFormatAndFields(PVSValueFormatAndFields.LABEL_ONLY));
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +103,8 @@ public class RDBMSDeleteActionTest extends RDBMSActionTest
|
||||
DeleteOutput deleteResult = new RDBMSDeleteAction().execute(deleteInput);
|
||||
assertEquals(3, deleteResult.getDeletedRecordCount(), "Should delete one row");
|
||||
assertEquals(0, deleteResult.getRecordsWithErrors().size(), "should have no errors");
|
||||
runTestSql("SELECT id FROM person", (rs -> {
|
||||
runTestSql("SELECT id FROM person", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -177,7 +178,8 @@ public class RDBMSDeleteActionTest extends RDBMSActionTest
|
||||
assertTrue(deleteResult.getRecordsWithErrors().stream().noneMatch(r -> r.getErrors().isEmpty()), "All we got back should have errors");
|
||||
assertEquals(3, deleteResult.getDeletedRecordCount(), "Should get back that 3 were deleted");
|
||||
|
||||
runTestSql("SELECT id FROM child_table", (rs -> {
|
||||
runTestSql("SELECT id FROM child_table", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -223,7 +225,8 @@ public class RDBMSDeleteActionTest extends RDBMSActionTest
|
||||
assertEquals(1, queryStats.get(QueryManager.STAT_QUERIES_RAN), "Number of queries ran");
|
||||
assertEquals(3, deleteResult.getDeletedRecordCount(), "Should get back that 3 were deleted");
|
||||
|
||||
runTestSql("SELECT id FROM child_table", (rs -> {
|
||||
runTestSql("SELECT id FROM child_table", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -275,7 +278,8 @@ public class RDBMSDeleteActionTest extends RDBMSActionTest
|
||||
assertTrue(deleteResult.getRecordsWithErrors().stream().noneMatch(r -> r.getErrors().isEmpty()), "All we got back should have errors");
|
||||
assertEquals(3, deleteResult.getDeletedRecordCount(), "Should get back that 3 were deleted");
|
||||
|
||||
runTestSql("SELECT id FROM child_table", (rs -> {
|
||||
runTestSql("SELECT id FROM child_table", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
|
@ -188,9 +188,13 @@ public class RDBMSInsertActionTest extends RDBMSActionTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private void assertAnInsertedPersonRecord(String firstName, String lastName, Integer id) throws Exception
|
||||
{
|
||||
runTestSql("SELECT * FROM person WHERE last_name = '" + lastName + "'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = '" + lastName + "'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
|
@ -118,7 +118,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
assertEquals(1, updateResult.getRecords().size(), "Should return 1 row");
|
||||
assertEquals(2, updateResult.getRecords().get(0).getValue("id"), "Should have id=2 in the row");
|
||||
// todo - add errors to QRecord? assertTrue(updateResult.getRecords().stream().noneMatch(qrs -> CollectionUtils.nullSafeHasContents(qrs.getErrors())), "There should be no errors");
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Kirk'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Kirk'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -129,7 +130,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
}
|
||||
assertEquals(1, rowsFound);
|
||||
}));
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Maes'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Maes'", (rs ->
|
||||
{
|
||||
if(rs.next())
|
||||
{
|
||||
fail("Should not have found Maes any more.");
|
||||
@ -176,7 +178,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
assertEquals(3, updateResult.getRecords().get(1).getValue("id"), "Should have expected ids in the row");
|
||||
assertEquals(5, updateResult.getRecords().get(2).getValue("id"), "Should have expected ids in the row");
|
||||
// todo - add errors to QRecord? assertTrue(updateResult.getRecords().stream().noneMatch(qrs -> CollectionUtils.nullSafeHasContents(qrs.getErrors())), "There should be no errors");
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'From Bewitched'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'From Bewitched'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -188,7 +191,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
}
|
||||
assertEquals(1, rowsFound);
|
||||
}));
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Chamberlain'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Chamberlain'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -199,7 +203,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
}
|
||||
assertEquals(1, rowsFound);
|
||||
}));
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Richardson'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Richardson'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -243,7 +248,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
assertEquals(1, updateResult.getRecords().get(0).getValue("id"), "Should have expected ids in the row");
|
||||
assertEquals(3, updateResult.getRecords().get(1).getValue("id"), "Should have expected ids in the row");
|
||||
// todo - add errors to QRecord? assertTrue(updateResult.getRecords().stream().noneMatch(qrs -> CollectionUtils.nullSafeHasContents(qrs.getErrors())), "There should be no errors");
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'From Bewitched'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'From Bewitched'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -255,7 +261,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
}
|
||||
assertEquals(1, rowsFound);
|
||||
}));
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Tim''s Uncle'", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE last_name = 'Tim''s Uncle'", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -294,7 +301,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
|
||||
assertEquals(5, updateResult.getRecords().size(), "Should return 5 rows");
|
||||
// todo - add errors to QRecord? assertTrue(updateResult.getRecords().stream().noneMatch(qrs -> CollectionUtils.nullSafeHasContents(qrs.getErrors())), "There should be no errors");
|
||||
runTestSql("SELECT * FROM person WHERE id <= 5", (rs -> {
|
||||
runTestSql("SELECT * FROM person WHERE id <= 5", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
@ -414,7 +422,8 @@ public class RDBMSUpdateActionTest extends RDBMSActionTest
|
||||
private String selectModifyDate(Integer id) throws Exception
|
||||
{
|
||||
StringBuilder modifyDate = new StringBuilder();
|
||||
runTestSql("SELECT modify_date FROM person WHERE id = " + id, (rs -> {
|
||||
runTestSql("SELECT modify_date FROM person WHERE id = " + id, (rs ->
|
||||
{
|
||||
if(rs.next())
|
||||
{
|
||||
modifyDate.append(rs.getString("modify_date"));
|
||||
|
@ -39,6 +39,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
@Disabled("This was okay for POC, but shouldn't run in CI")
|
||||
class ConnectionManagerTest extends BaseTest
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@Test
|
||||
public void test() throws SQLException
|
||||
{
|
||||
@ -101,6 +104,9 @@ class ConnectionManagerTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private RDBMSBackendMetaData getAuroraBacked()
|
||||
{
|
||||
QMetaDataVariableInterpreter interpreter = new QMetaDataVariableInterpreter();
|
||||
|
@ -69,6 +69,9 @@ public class ApiProcessMetaData
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public enum AsyncMode
|
||||
{
|
||||
NEVER,
|
||||
|
@ -49,7 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
*******************************************************************************/
|
||||
class GetTableApiFieldsActionTest extends BaseTest
|
||||
{
|
||||
private final String TABLE_NAME = "testTable";
|
||||
private static final String TABLE_NAME = "testTable";
|
||||
|
||||
Function<List<? extends QFieldMetaData>, Set<String>> fieldListToNameSet = l -> l.stream().map(f -> f.getName()).collect(Collectors.toSet());
|
||||
|
||||
|
@ -80,8 +80,8 @@ class ApiInstanceMetaDataTest
|
||||
{
|
||||
assertValidationErrors(makeBaselineValidApiInstanceMetaData()
|
||||
.withCurrentVersion(new APIVersion("2023.Q1"))
|
||||
.withSupportedVersions(List.of(new APIVersion("2022.Q3"), new APIVersion("2022.Q4")))
|
||||
, List.of("supportedVersions [[2022.Q3, 2022.Q4]] does not contain currentVersion [2023.Q1]"));
|
||||
.withSupportedVersions(List.of(new APIVersion("2022.Q3"), new APIVersion("2022.Q4"))),
|
||||
List.of("supportedVersions [[2022.Q3, 2022.Q4]] does not contain currentVersion [2023.Q1]"));
|
||||
|
||||
assertValidationErrors(makeBaselineValidApiInstanceMetaData()
|
||||
.withCurrentVersion(new APIVersion("2023.Q1"))
|
||||
|
@ -136,13 +136,12 @@ class QJavalinAccessLoggerTest
|
||||
QInstance qInstance = TestUtils.defineInstance();
|
||||
new QJavalinImplementation(qInstance, new QJavalinMetaData()
|
||||
.withLoggerDisabled(false)
|
||||
.withLogFilter(logEntry ->
|
||||
switch(logEntry.logType())
|
||||
{
|
||||
case START, PROCESS_SUMMARY -> false;
|
||||
case END_SUCCESS, END_SUCCESS_SLOW -> true;
|
||||
case END_FAIL -> logEntry.actionName().startsWith("yes");
|
||||
}));
|
||||
.withLogFilter(logEntry -> switch(logEntry.logType())
|
||||
{
|
||||
case START, PROCESS_SUMMARY -> false;
|
||||
case END_SUCCESS, END_SUCCESS_SLOW -> true;
|
||||
case END_FAIL -> logEntry.actionName().startsWith("yes");
|
||||
}));
|
||||
|
||||
System.out.println("shouldn't log");
|
||||
QJavalinAccessLogger.logStart("test"); // shouldn't log
|
||||
|
@ -53,6 +53,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
*******************************************************************************/
|
||||
class QJavalinScriptsHandlerTest extends QJavalinTestBase
|
||||
{
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ public class QJavalinTestBase
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
static protected void restartServerWithInstance(QInstance qInstance) throws QInstanceValidationException
|
||||
protected static void restartServerWithInstance(QInstance qInstance) throws QInstanceValidationException
|
||||
{
|
||||
if(qJavalinImplementation != null)
|
||||
{
|
||||
|
@ -368,6 +368,9 @@ class QBaseCustomLambdaHandlerTest
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
private String getNoBodyInputString()
|
||||
{
|
||||
return ("""
|
||||
|
@ -552,7 +552,8 @@ class QPicoCliImplementationTest
|
||||
*******************************************************************************/
|
||||
private void assertRowValueById(String tableName, String columnName, String value, Integer id) throws Exception
|
||||
{
|
||||
TestUtils.runTestSql("SELECT " + columnName + " FROM " + tableName + " WHERE id=" + id, (rs -> {
|
||||
TestUtils.runTestSql("SELECT " + columnName + " FROM " + tableName + " WHERE id=" + id, (rs ->
|
||||
{
|
||||
if(rs.next())
|
||||
{
|
||||
assertEquals(value, rs.getString(1));
|
||||
@ -590,7 +591,8 @@ class QPicoCliImplementationTest
|
||||
JSONObject deleteResult = JsonUtils.toJSONObject(testOutput.getOutput());
|
||||
assertNotNull(deleteResult);
|
||||
assertEquals(2, deleteResult.getInt("deletedRecordCount"));
|
||||
TestUtils.runTestSql("SELECT id FROM person", (rs -> {
|
||||
TestUtils.runTestSql("SELECT id FROM person", (rs ->
|
||||
{
|
||||
int rowsFound = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ public class SampleMetaDataProviderTest
|
||||
{
|
||||
InputStream primeTestDatabaseSqlStream = SampleMetaDataProviderTest.class.getResourceAsStream("/" + sqlFileName);
|
||||
assertNotNull(primeTestDatabaseSqlStream);
|
||||
List<String> lines = (List<String>) IOUtils.readLines(primeTestDatabaseSqlStream, StandardCharsets.UTF_8);
|
||||
List<String> lines = IOUtils.readLines(primeTestDatabaseSqlStream, StandardCharsets.UTF_8);
|
||||
lines = lines.stream().filter(line -> !line.startsWith("-- ")).toList();
|
||||
String joinedSQL = String.join("\n", lines);
|
||||
for(String sql : joinedSQL.split(";"))
|
||||
@ -168,8 +168,8 @@ public class SampleMetaDataProviderTest
|
||||
*******************************************************************************/
|
||||
private File copyTestFileToRandomNameUnderTable(QTableMetaData fedExTable) throws IOException
|
||||
{
|
||||
File destinationDir = new File(SampleMetaDataProvider.defineFilesystemBackend().getBasePath() + File.separator +
|
||||
((FilesystemTableBackendDetails) fedExTable.getBackendDetails()).getBasePath());
|
||||
File destinationDir = new File(SampleMetaDataProvider.defineFilesystemBackend().getBasePath() + File.separator
|
||||
+ ((FilesystemTableBackendDetails) fedExTable.getBackendDetails()).getBasePath());
|
||||
destinationDir.mkdirs();
|
||||
File destinationFile = new File(destinationDir.getAbsolutePath() + File.separator + UUID.randomUUID());
|
||||
|
||||
@ -227,4 +227,4 @@ public class SampleMetaDataProviderTest
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user