Eliminated all warnings.

This commit is contained in:
2024-07-19 12:38:02 -05:00
parent f9af2ba983
commit 912e40fe0b
87 changed files with 257 additions and 166 deletions

View File

@ -50,8 +50,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<coverage.haltOnFailure>true</coverage.haltOnFailure>

View File

@ -279,7 +279,9 @@ public class ChildRecordListRenderer extends AbstractWidgetRenderer
Map<String, Serializable> widgetValues = input.getWidgetMetaData().getDefaultValues();
if(widgetValues.containsKey("disabledFieldsForNewChildRecords"))
{
widgetData.setDisabledFieldsForNewChildRecords((Set<String>) widgetValues.get("disabledFieldsForNewChildRecords"));
@SuppressWarnings("unchecked")
Set<String> disabledFieldsForNewChildRecords = (Set<String>) widgetValues.get("disabledFieldsForNewChildRecords");
widgetData.setDisabledFieldsForNewChildRecords(disabledFieldsForNewChildRecords);
}
else
{

View File

@ -161,7 +161,7 @@ public class StreamedSheetWriter
}
}
Map<String, Integer> m = new HashMap();
Map<String, Integer> m = new HashMap<>();
m.computeIfAbsent("s", (s) -> 3);
value = rs.toString();

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.core.actions.scripts;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import com.kingsrook.qqq.backend.core.actions.scripts.logging.BuildScriptLogAndScriptLogLineExecutionLogger;
@ -97,7 +98,7 @@ public class RecordScriptTestInterface implements TestScriptActionInterface
}
QueryOutput queryOutput = new QueryAction().execute(new QueryInput(tableName)
.withFilter(new QQueryFilter(new QFilterCriteria(table.getPrimaryKeyField(), QCriteriaOperator.IN, recordPrimaryKeyList.split(","))))
.withFilter(new QQueryFilter(new QFilterCriteria(table.getPrimaryKeyField(), QCriteriaOperator.IN, Arrays.stream(recordPrimaryKeyList.split(",")).toList())))
.withIncludeAssociations(true));
if(CollectionUtils.nullSafeIsEmpty(queryOutput.getRecords()))
{

View File

@ -154,8 +154,9 @@ public class RunAdHocRecordScriptAction
Method qRecordListToApiRecordList = apiScriptUtilsClass.getMethod("qRecordListToApiRecordList", List.class, String.class, String.class, String.class);
Object apiRecordList = qRecordListToApiRecordList.invoke(null, input.getRecordList(), input.getTableName(), scriptRevision.getApiName(), scriptRevision.getApiVersion());
// noinspection unchecked
return (ArrayList<? extends Serializable>) apiRecordList;
@SuppressWarnings("unchecked")
ArrayList<? extends Serializable> rs = (ArrayList<? extends Serializable>) apiRecordList;
return rs;
}
catch(ClassNotFoundException e)
{

View File

@ -563,6 +563,7 @@ public class QValueFormatter
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// heavy fields that weren't fetched - they should have a backend-detail specifying their length (or null if null) //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("unchecked")
Map<String, Serializable> heavyFieldLengths = (Map<String, Serializable>) record.getBackendDetail(QRecord.BACKEND_DETAILS_TYPE_HEAVY_FIELD_LENGTHS);
if(heavyFieldLengths != null)
{

View File

@ -300,6 +300,7 @@ public class SearchPossibleValueSourceAction
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings({ "rawtypes", "unchecked" })
private SearchPossibleValueSourceOutput searchPossibleValueCustom(SearchPossibleValueSourceInput input, QPossibleValueSource possibleValueSource)
{
try

View File

@ -922,7 +922,7 @@ public class QInstanceValidator
/*******************************************************************************
**
*******************************************************************************/
private <T extends FieldBehavior<T>> void validateTableField(QInstance qInstance, String tableName, String fieldName, QTableMetaData table, QFieldMetaData field)
private void validateTableField(QInstance qInstance, String tableName, String fieldName, QTableMetaData table, QFieldMetaData field)
{
assertCondition(Objects.equals(fieldName, field.getName()),
"Inconsistent naming in table " + tableName + " for field " + fieldName + "/" + field.getName() + ".");
@ -944,12 +944,13 @@ public class QInstanceValidator
assertCondition(field.getMaxLength() != null, prefix + "specifies a ValueTooLongBehavior, but not a maxLength.");
}
Set<Class<FieldBehavior<T>>> usedFieldBehaviorTypes = new HashSet<>();
Set<Class<FieldBehavior<?>>> usedFieldBehaviorTypes = new HashSet<>();
if(field.getBehaviors() != null)
{
for(FieldBehavior<?> fieldBehavior : field.getBehaviors())
{
Class<FieldBehavior<T>> behaviorClass = (Class<FieldBehavior<T>>) fieldBehavior.getClass();
@SuppressWarnings("unchecked")
Class<FieldBehavior<?>> behaviorClass = (Class<FieldBehavior<?>>) fieldBehavior.getClass();
errors.addAll(fieldBehavior.validateBehaviorConfiguration(table, field));

View File

@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.instances;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.Optional;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
@ -113,7 +114,7 @@ public class SecretsManagerUtils
dotEnv.renameTo(new File(".env.backup-" + System.currentTimeMillis()));
}
FileUtils.writeStringToFile(dotEnv, fullEnv.toString());
FileUtils.writeStringToFile(dotEnv, fullEnv.toString(), StandardCharsets.UTF_8);
}
else
{

View File

@ -40,11 +40,14 @@ public abstract class AbstractFilterExpression<T extends Serializable> implement
/*******************************************************************************
** Evaluate the expression, given a map of input values.
**
** By default, this will defer to the evaluate(void) method - but, a subclass
** (e.g., FilterVariableExpression) may react differently.
*******************************************************************************/
public T evaluateInputValues(Map<String, Serializable> inputValues) throws QException
{
return (T) this;
return evaluate();
}

View File

@ -79,10 +79,11 @@ public class QFilterCriteriaDeserializer extends StdDeserializer<QFilterCriteria
/////////////////////////////////
// get values out of json node //
/////////////////////////////////
List<Serializable> values = objectMapper.treeToValue(node.get("values"), List.class);
String fieldName = objectMapper.treeToValue(node.get("fieldName"), String.class);
QCriteriaOperator operator = objectMapper.treeToValue(node.get("operator"), QCriteriaOperator.class);
String otherFieldName = objectMapper.treeToValue(node.get("otherFieldName"), String.class);
@SuppressWarnings("unchecked")
List<Serializable> values = objectMapper.treeToValue(node.get("values"), List.class);
String fieldName = objectMapper.treeToValue(node.get("fieldName"), String.class);
QCriteriaOperator operator = objectMapper.treeToValue(node.get("operator"), QCriteriaOperator.class);
String otherFieldName = objectMapper.treeToValue(node.get("otherFieldName"), String.class);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// look at all the values - if any of them are actually meant to be an Expression (instance of subclass of AbstractFilterExpression) //

View File

@ -74,6 +74,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withTooltip(S key, String value)
{
addTooltip(key, value);
@ -99,6 +100,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withTooltip(S key, BlockTooltip value)
{
addTooltip(key, value);
@ -144,6 +146,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
** Fluent setter for tooltipMap
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withTooltipMap(Map<S, BlockTooltip> tooltipMap)
{
this.tooltipMap = tooltipMap;
@ -178,6 +181,7 @@ public abstract class AbstractBlockWidgetData<
** Fluent setter for tooltip
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withTooltip(String tooltip)
{
this.tooltip = new BlockTooltip(tooltip);
@ -190,6 +194,7 @@ public abstract class AbstractBlockWidgetData<
** Fluent setter for tooltip
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withTooltip(BlockTooltip tooltip)
{
this.tooltip = tooltip;
@ -201,6 +206,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withLink(S key, String value)
{
addLink(key, value);
@ -226,6 +232,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withLink(S key, BlockLink value)
{
addLink(key, value);
@ -271,6 +278,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
** Fluent setter for linkMap
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withLinkMap(Map<S, BlockLink> linkMap)
{
this.linkMap = linkMap;
@ -305,6 +313,7 @@ public abstract class AbstractBlockWidgetData<
** Fluent setter for link
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withLink(String link)
{
this.link = new BlockLink(link);
@ -317,6 +326,7 @@ public abstract class AbstractBlockWidgetData<
** Fluent setter for link
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withLink(BlockLink link)
{
this.link = link;
@ -348,6 +358,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
** Fluent setter for values
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withValues(V values)
{
this.values = values;
@ -379,6 +390,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
** Fluent setter for styles
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withStyles(SX styles)
{
this.styles = styles;
@ -409,6 +421,7 @@ public abstract class AbstractBlockWidgetData<
/*******************************************************************************
** Fluent setter for blockId
*******************************************************************************/
@SuppressWarnings("unchecked")
public T withBlockId(String blockId)
{
this.blockId = blockId;

View File

@ -192,6 +192,7 @@ public abstract class QRecordEntity
for(QRecordEntityAssociation qRecordEntityAssociation : getAssociationList(this.getClass()))
{
@SuppressWarnings("unchecked")
List<? extends QRecordEntity> associatedEntities = (List<? extends QRecordEntity>) qRecordEntityAssociation.getGetter().invoke(this);
String associationName = qRecordEntityAssociation.getAssociationAnnotation().name();
@ -245,6 +246,7 @@ public abstract class QRecordEntity
for(QRecordEntityAssociation qRecordEntityAssociation : getAssociationList(this.getClass()))
{
@SuppressWarnings("unchecked")
List<? extends QRecordEntity> associatedEntities = (List<? extends QRecordEntity>) qRecordEntityAssociation.getGetter().invoke(this);
String associationName = qRecordEntityAssociation.getAssociationAnnotation().name();
@ -346,6 +348,7 @@ public abstract class QRecordEntity
if(associationAnnotation.isPresent())
{
@SuppressWarnings("unchecked")
Class<? extends QRecordEntity> listTypeParam = (Class<? extends QRecordEntity>) getListTypeParam(possibleGetter.getReturnType(), possibleGetter.getAnnotatedReturnType());
associationList.add(new QRecordEntityAssociation(fieldName, possibleGetter, setter.get(), listTypeParam, associationAnnotation.orElse(null)));
}

View File

@ -188,7 +188,8 @@ public class FieldAdornment
** Fluent setter for values
**
*******************************************************************************/
public FieldAdornment withValues(Pair<String, Serializable>... values)
@SafeVarargs
public final FieldAdornment withValues(Pair<String, Serializable>... values)
{
for(Pair<String, Serializable> value : values)
{

View File

@ -804,7 +804,7 @@ public class QTableMetaData implements QAppChildMetaData, Serializable, MetaData
{
if(this.associatedScripts == null)
{
this.associatedScripts = new ArrayList();
this.associatedScripts = new ArrayList<>();
}
this.associatedScripts.add(associatedScript);
return (this);

View File

@ -662,7 +662,11 @@ public class MemoryRecordStore
{
return (-1);
}
return ((Comparable) a).compareTo(b);
@SuppressWarnings("unchecked")
Comparable<Serializable> comparableSerializableA = (Comparable<Serializable>) a;
return comparableSerializableA.compareTo(b);
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -769,6 +773,7 @@ public class MemoryRecordStore
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static Serializable computeAggregate(List<QRecord> records, Aggregate aggregate, QTableMetaData table)
{
String fieldName = aggregate.getFieldName();

View File

@ -65,9 +65,14 @@ public class MergeDuplicatesLoadStep extends LoadViaInsertOrUpdateStep
{
super.runOnePage(runBackendStepInput, runBackendStepOutput);
ListingHash<String, Serializable> otherTableIdsToDelete = (ListingHash<String, Serializable>) runBackendStepInput.getValue("otherTableIdsToDelete");
@SuppressWarnings("unchecked")
ListingHash<String, Serializable> otherTableIdsToDelete = (ListingHash<String, Serializable>) runBackendStepInput.getValue("otherTableIdsToDelete");
@SuppressWarnings("unchecked")
ListingHash<String, QQueryFilter> otherTableFiltersToDelete = (ListingHash<String, QQueryFilter>) runBackendStepInput.getValue("otherTableFiltersToDelete");
ListingHash<String, QRecord> otherTableRecordsToStore = (ListingHash<String, QRecord>) runBackendStepInput.getValue("otherTableRecordsToStore");
@SuppressWarnings("unchecked")
ListingHash<String, QRecord> otherTableRecordsToStore = (ListingHash<String, QRecord>) runBackendStepInput.getValue("otherTableRecordsToStore");
if(otherTableIdsToDelete != null)
{

View File

@ -114,8 +114,9 @@ public class PrepareReportForRecordStep extends PrepareReportStep
/////////////////////////////////////////////////////////////////////////////////////
// if there are no more input fields, then remove the INPUT step from the process. //
/////////////////////////////////////////////////////////////////////////////////////
inputFieldList = (ArrayList<QFieldMetaData>) runBackendStepOutput.getValue("inputFieldList");
if(!CollectionUtils.nullSafeHasContents(inputFieldList))
@SuppressWarnings("unchecked")
ArrayList<QFieldMetaData> updatedInputFieldList = (ArrayList<QFieldMetaData>) runBackendStepOutput.getValue("inputFieldList");
if(!CollectionUtils.nullSafeHasContents(updatedInputFieldList))
{
removeInputStepFromProcess(runBackendStepOutput);
}

View File

@ -139,7 +139,7 @@ public class TestScriptProcessStep implements BackendStep
//////////////////////////////////
// send script outputs back out //
//////////////////////////////////
output.addValue("scriptLogLines", CollectionUtils.useOrWrap(testScriptOutput.getScriptLogLines(), TypeToken.get(ArrayList.class)));
output.addValue("scriptLogLines", CollectionUtils.useOrWrap(testScriptOutput.getScriptLogLines(), new TypeToken<ArrayList<QRecord>>() {}));
output.addValue("outputObject", testScriptOutput.getOutputObject());
if(testScriptOutput.getException() != null)

View File

@ -70,7 +70,9 @@ public class QuartzJobRunner implements Job
QContext.init(qInstance, quartzScheduler.getSessionSupplier().get());
schedulableType = qInstance.getSchedulableType(context.getJobDetail().getJobDataMap().getString("type"));
params = (Map<String, Object>) context.getJobDetail().getJobDataMap().get("params");
@SuppressWarnings("unchecked")
Map<String, Object> paramsFromJobDataMap = (Map<String, Object>) context.getJobDetail().getJobDataMap().get("params");
params = paramsFromJobDataMap;
SchedulableRunner schedulableRunner = QCodeLoader.getAdHoc(SchedulableRunner.class, schedulableType.getRunner());

View File

@ -74,7 +74,9 @@ public class SchedulableProcessRunner implements SchedulableRunner
Map<String, Serializable> backendVariantData = null;
if(params.containsKey("backendVariantData"))
{
backendVariantData = (Map<String, Serializable>) params.get("backendVariantData");
@SuppressWarnings("unchecked")
Map<String, Serializable> dataFromMap = (Map<String, Serializable>) params.get("backendVariantData");
backendVariantData = dataFromMap;
}
Map<String, Serializable> processInputValues = buildProcessInputValuesMap(params, process);

View File

@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.nio.file.NoSuchFileException;
import java.time.Instant;
import java.util.Optional;
@ -78,7 +79,7 @@ public class TempFileStateProvider implements StateProviderInterface
try
{
String json = JsonUtils.toJson(data);
FileUtils.writeStringToFile(getFile(key), json);
FileUtils.writeStringToFile(getFile(key), json, StandardCharsets.UTF_8);
}
catch(IOException e)
{
@ -97,7 +98,7 @@ public class TempFileStateProvider implements StateProviderInterface
{
try
{
String json = FileUtils.readFileToString(getFile(key));
String json = FileUtils.readFileToString(getFile(key), StandardCharsets.UTF_8);
return (Optional.of(JsonUtils.toObject(json, type)));
}
catch(FileNotFoundException | NoSuchFileException fnfe)

View File

@ -50,7 +50,7 @@ public class CollectionUtils
** true if c is null or it's empty
**
*******************************************************************************/
public static boolean nullSafeIsEmpty(Collection c)
public static boolean nullSafeIsEmpty(Collection<?> c)
{
if(c == null || c.isEmpty())
{
@ -66,7 +66,7 @@ public class CollectionUtils
** true if c is null or it's empty
**
*******************************************************************************/
public static boolean nullSafeIsEmpty(Map c)
public static boolean nullSafeIsEmpty(Map<?, ?> c)
{
if(c == null || c.isEmpty())
{
@ -82,7 +82,7 @@ public class CollectionUtils
** true if c is NOT null and it's not empty
**
*******************************************************************************/
public static boolean nullSafeHasContents(Collection c)
public static boolean nullSafeHasContents(Collection<?> c)
{
return (!nullSafeIsEmpty(c));
}
@ -93,7 +93,7 @@ public class CollectionUtils
** true if c is NOT null and it's not empty
**
*******************************************************************************/
public static boolean nullSafeHasContents(Map c)
public static boolean nullSafeHasContents(Map<?, ?> c)
{
return (!nullSafeIsEmpty(c));
}
@ -104,7 +104,7 @@ public class CollectionUtils
** 0 if c is empty, otherwise, its size.
**
*******************************************************************************/
public static int nullSafeSize(Collection c)
public static int nullSafeSize(Collection<?> c)
{
if(c == null)
{
@ -120,7 +120,7 @@ public class CollectionUtils
** 0 if c is empty, otherwise, its size.
**
*******************************************************************************/
public static int nullSafeSize(Map c)
public static int nullSafeSize(Map<?, ?> c)
{
if(c == null)
{
@ -302,14 +302,14 @@ public class CollectionUtils
return (rs);
}
List<T> currentPage = new LinkedList<T>();
List<T> currentPage = new LinkedList<>();
rs.add(currentPage);
for(T value : values)
{
if(currentPage.size() >= pageSize)
{
currentPage = new LinkedList<T>();
currentPage = new LinkedList<>();
rs.add(currentPage);
}
@ -423,6 +423,7 @@ public class CollectionUtils
**
** Meant to help avoid null checks on foreach loops.
*******************************************************************************/
@SuppressWarnings("unchecked")
public static <T> T[] nonNullArray(T[] array)
{
if(array == null)
@ -539,7 +540,7 @@ public class CollectionUtils
/*******************************************************************************
**
*******************************************************************************/
public static Map objectToMap(Object o)
public static Map<?, ?> objectToMap(Object o)
{
ObjectMapper mapper = new ObjectMapper()
.registerModule(new JavaTimeModule())
@ -555,6 +556,7 @@ public class CollectionUtils
/*******************************************************************************
**
*******************************************************************************/
@SafeVarargs
public static <T> List<T> mergeLists(List<T>... lists)
{
List<T> rs = new ArrayList<>();
@ -593,6 +595,7 @@ public class CollectionUtils
return (null);
}
@SuppressWarnings("unchecked")
Class<T> targetClass = (Class<T>) typeToken.getRawType();
if(targetClass.isInstance(collection))
{
@ -630,6 +633,7 @@ public class CollectionUtils
return (null);
}
@SuppressWarnings("unchecked")
Class<T> targetClass = (Class<T>) typeToken.getRawType();
if(targetClass.isInstance(collection))
{

View File

@ -37,6 +37,7 @@ public class ObjectUtils
/*******************************************************************************
** A varargs version of Objects.requireNonNullElse
*******************************************************************************/
@SafeVarargs
public static <T> T requireNonNullElse(T... objects)
{
if(objects == null)

View File

@ -888,6 +888,7 @@ public class ValueUtils
** Return the first argument that isn't null.
** If all were null, return null.
*******************************************************************************/
@SafeVarargs
public static <T> T getFirstNonNull(T... ts)
{
if(ts == null || ts.length == 0)

View File

@ -48,7 +48,11 @@ public class YamlUtils
{
ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
objectMapper.findAndRegisterModules();
return (objectMapper.readValue(yaml, Map.class));
@SuppressWarnings("unchecked")
Map<String, Object> map = objectMapper.readValue(yaml, Map.class);
return map;
}

View File

@ -86,7 +86,7 @@ public class AlphaNumericComparator implements Comparator<String>
////////////////////////////////////////////////////////////////
if(INT_PATTERN.matcher(a).matches() && INT_PATTERN.matcher(b).matches())
{
int intsCompared = new Integer(a).compareTo(new Integer(b));
int intsCompared = Integer.valueOf(a).compareTo(Integer.valueOf(b));
if(intsCompared == TIE)
{
///////////////////////////////////////////////////////////////////////////////
@ -119,7 +119,7 @@ public class AlphaNumericComparator implements Comparator<String>
/////////////////////////////////////////////////////////////
// if the ints compare as non-zero, return that comparison //
/////////////////////////////////////////////////////////////
int intPartCompared = new Integer(aIntPart).compareTo(new Integer(bIntPart));
int intPartCompared = Integer.valueOf(aIntPart).compareTo(Integer.valueOf(bIntPart));
if(intPartCompared != TIE)
{
return (intPartCompared);

View File

@ -87,7 +87,9 @@ public class MultiLevelMapHelper
{
try
{
return (map.getClass().getConstructor().newInstance());
@SuppressWarnings("unchecked")
Map<K2, V> map1 = map.getClass().getConstructor().newInstance();
return map1;
}
catch(Exception e)
{

View File

@ -99,7 +99,7 @@ class ChildRecordListRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1)
));
@ -130,12 +130,12 @@ class ChildRecordListRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
new QRecord().withValue("orderId", 1).withValue("sku", "ABC").withValue("lineNumber", 2),
new QRecord().withValue("orderId", 1).withValue("sku", "BCD").withValue("lineNumber", 1),
new QRecord().withValue("orderId", 2).withValue("sku", "XYZ") // should not be found.

View File

@ -128,7 +128,7 @@ class ParentWidgetRendererTest extends BaseTest
QContext.getQSession().withSecurityKeyValue(TestUtils.SECURITY_KEY_TYPE_STORE_ALL_ACCESS, true);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1)
));
@ -161,12 +161,12 @@ class ParentWidgetRendererTest extends BaseTest
QContext.getQSession().withSecurityKeyValue(TestUtils.SECURITY_KEY_TYPE_STORE_ALL_ACCESS, true);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
new QRecord().withValue("orderId", 1).withValue("sku", "ABC").withValue("lineNumber", 2),
new QRecord().withValue("orderId", 1).withValue("sku", "BCD").withValue("lineNumber", 1),
new QRecord().withValue("orderId", 2).withValue("sku", "XYZ") // should not be found.

View File

@ -109,7 +109,7 @@ class ProcessWidgetRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1)
));
@ -140,12 +140,12 @@ class ProcessWidgetRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
new QRecord().withValue("orderId", 1).withValue("sku", "ABC").withValue("lineNumber", 2),
new QRecord().withValue("orderId", 1).withValue("sku", "BCD").withValue("lineNumber", 1),
new QRecord().withValue("orderId", 2).withValue("sku", "XYZ") // should not be found.

View File

@ -116,7 +116,7 @@ class USMapRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1)
));
@ -147,12 +147,12 @@ class USMapRendererTest extends BaseTest
.getWidgetMetaData();
qInstance.addWidget(widget);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
new QRecord().withValue("orderId", 1).withValue("sku", "ABC").withValue("lineNumber", 2),
new QRecord().withValue("orderId", 1).withValue("sku", "BCD").withValue("lineNumber", 1),
new QRecord().withValue("orderId", 2).withValue("sku", "XYZ") // should not be found.

View File

@ -155,12 +155,12 @@ class ExportActionTest extends BaseTest
QInstance qInstance = QContext.getQInstance();
QContext.getQSession().withSecurityKeyValue(TestUtils.SECURITY_KEY_TYPE_STORE_ALL_ACCESS, true);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_ORDER), List.of(
new QRecord().withValue("id", 1).withValue("orderNo", "ORD1").withValue("storeId", 1),
new QRecord().withValue("id", 2).withValue("orderNo", "ORD2").withValue("storeId", 1)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_LINE_ITEM), List.of(
new QRecord().withValue("id", 1).withValue("orderId", 1).withValue("sku", "A").withValue("quantity", 10),
new QRecord().withValue("id", 2).withValue("orderId", 1).withValue("sku", "B").withValue("quantity", 15),
new QRecord().withValue("id", 3).withValue("orderId", 2).withValue("sku", "A").withValue("quantity", 20)

View File

@ -562,7 +562,7 @@ public class GenerateReportActionTest extends BaseTest
*******************************************************************************/
public static void insertPersonRecords(QInstance qInstance) throws QException
{
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new PersonQRecord().withFirstName("Darin").withLastName("Jonson").withBirthDate(LocalDate.of(1980, Month.JANUARY, 31)).withNoOfShoes(null).withHomeStateId(1).withPrice(null).withCost(new BigDecimal("0.50")), // wrong last initial
new PersonQRecord().withFirstName("Darin").withLastName("Jones").withBirthDate(LocalDate.of(1980, Month.JANUARY, 31)).withNoOfShoes(3).withHomeStateId(1).withPrice(new BigDecimal("1.00")).withCost(new BigDecimal("0.50")), // wrong last initial
new PersonQRecord().withFirstName("Darin").withLastName("Kelly").withBirthDate(LocalDate.of(1979, Month.DECEMBER, 30)).withNoOfShoes(4).withHomeStateId(1).withPrice(new BigDecimal("1.20")).withCost(new BigDecimal("0.50")), // bad birthdate

View File

@ -120,12 +120,12 @@ class RunAdHocRecordScriptActionTest extends BaseTest
new ScriptsMetaDataProvider().defineAll(instance, TestUtils.MEMORY_BACKEND_NAME, null);
TestUtils.insertRecords(instance, personMemory, List.of(
TestUtils.insertRecords(personMemory, List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(instance, instance.getTable("scriptType"), List.of(
TestUtils.insertRecords(instance.getTable("scriptType"), List.of(
new QRecord().withValue("id", 1).withValue("name", "Test Script Type")
));
}

View File

@ -184,12 +184,12 @@ class RunAssociatedScriptActionTest extends BaseTest
new ScriptsMetaDataProvider().defineAll(instance, TestUtils.MEMORY_BACKEND_NAME, null);
TestUtils.insertRecords(instance, table, List.of(
TestUtils.insertRecords(table, List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2)
));
TestUtils.insertRecords(instance, instance.getTable("scriptType"), List.of(
TestUtils.insertRecords(instance.getTable("scriptType"), List.of(
new QRecord().withValue("id", 1).withValue("name", "Test Script Type")
));
}

View File

@ -88,13 +88,13 @@ class StoreAssociatedScriptActionTest extends BaseTest
new ScriptsMetaDataProvider().defineAll(instance, TestUtils.MEMORY_BACKEND_NAME, null);
TestUtils.insertRecords(instance, table, List.of(
TestUtils.insertRecords(table, List.of(
new QRecord().withValue("id", 1),
new QRecord().withValue("id", 2),
new QRecord().withValue("id", 3)
));
TestUtils.insertRecords(instance, instance.getTable("scriptType"), List.of(
TestUtils.insertRecords(instance.getTable("scriptType"), List.of(
new QRecord().withValue("id", 1).withValue("name", "Test Script"),
new QRecord().withValue("id", 2).withValue("name", "Other Script")
));

View File

@ -69,7 +69,7 @@ class GetActionCacheHelperTest extends BaseTest
/////////////////////////////////////
// insert rows in the source table //
/////////////////////////////////////
TestUtils.insertRecords(qInstance, qInstance.getTable(sourceTableName), List.of(
TestUtils.insertRecords(qInstance.getTable(sourceTableName), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "George").withValue("lastName", "Washington").withValue("noOfShoes", 5),
new QRecord().withValue("id", 2).withValue("firstName", "John").withValue("lastName", "Adams"),
new QRecord().withValue("id", 3).withValue("firstName", "Thomas").withValue("lastName", "Jefferson"),

View File

@ -68,7 +68,7 @@ class QueryActionCacheHelperTest extends BaseTest
/////////////////////////////////////
// insert rows in the source table //
/////////////////////////////////////
TestUtils.insertRecords(qInstance, qInstance.getTable(sourceTableName), List.of(
TestUtils.insertRecords(qInstance.getTable(sourceTableName), List.of(
new QRecord().withValue("id", 1).withValue("name", "Triangle").withValue("noOfSides", 3),
new QRecord().withValue("id", 2).withValue("name", "Square").withValue("noOfSides", 4),
new QRecord().withValue("id", 3).withValue("name", "Pentagon").withValue("noOfSides", 5),

View File

@ -415,8 +415,8 @@ public class QPossibleValueTranslatorTest extends BaseTest
List<QRecord> regions = List.of(new QRecord().withValue("id", 11).withValue("name", "Missouri").withValue("countryId", 111));
List<QRecord> countries = List.of(new QRecord().withValue("id", 111).withValue("name", "U.S.A"));
TestUtils.insertRecords(qInstance, qInstance.getTable("region"), regions);
TestUtils.insertRecords(qInstance, qInstance.getTable("country"), countries);
TestUtils.insertRecords(qInstance.getTable("region"), regions);
TestUtils.insertRecords(qInstance.getTable("country"), countries);
MemoryRecordStore.resetStatistics();
MemoryRecordStore.setCollectStatistics(true);

View File

@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.core.adapters;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import com.kingsrook.qqq.backend.core.BaseTest;
import com.kingsrook.qqq.backend.core.context.QContext;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
@ -73,7 +74,7 @@ class QInstanceAdapterTest extends BaseTest
@Disabled("Pending custom deserializer on QStepMetaData")
void jsonToQInstance() throws IOException
{
String json = FileUtils.readFileToString(new File("src/test/resources/personQInstance.json"));
String json = FileUtils.readFileToString(new File("src/test/resources/personQInstance.json"), StandardCharsets.UTF_8);
QInstance qInstance = new QInstanceAdapter().jsonToQInstance(json);
System.out.println(qInstance);
}
@ -87,7 +88,7 @@ class QInstanceAdapterTest extends BaseTest
@Disabled("Pending custom deserializer on QStepMetaData")
void jsonToQInstanceIncludingBackend() throws IOException
{
String json = FileUtils.readFileToString(new File("src/test/resources/personQInstanceIncludingBackend.json"));
String json = FileUtils.readFileToString(new File("src/test/resources/personQInstanceIncludingBackend.json"), StandardCharsets.UTF_8);
QInstance qInstance = new QInstanceAdapter().jsonToQInstanceIncludingBackends(json);
System.out.println(qInstance);
assertNotNull(qInstance.getBackends());

View File

@ -337,7 +337,7 @@ public class TableBasedAuthenticationModuleTest extends BaseTest
{
QAuthenticationMetaData tableBasedAuthentication = qInstance.getAuthentication();
qInstance.setAuthentication(new Auth0AuthenticationMetaData().withName("mock").withType(QAuthenticationType.MOCK));
TestUtils.insertRecords(qInstance, qInstance.getTable("user"), List.of(new QRecord()
TestUtils.insertRecords(qInstance.getTable("user"), List.of(new QRecord()
.withValue("username", username)
.withValue("fullName", fullName)
.withValue("passwordHash", TableBasedAuthenticationModule.PasswordHasher.createHashedPassword(password))));
@ -361,7 +361,7 @@ public class TableBasedAuthenticationModuleTest extends BaseTest
getUserInput.setUniqueKey(Map.of("username", username));
GetOutput getUserOutput = new GetAction().execute(getUserInput);
TestUtils.insertRecords(qInstance, qInstance.getTable("session"), List.of(new QRecord()
TestUtils.insertRecords(qInstance.getTable("session"), List.of(new QRecord()
.withValue("id", uuid)
.withValue("userId", getUserOutput.getRecord() == null ? -1 : getUserOutput.getRecord().getValueInteger("id"))
.withValue("accessTimestamp", accessTimestamp)

View File

@ -74,7 +74,7 @@ class BulkDeleteTest extends BaseTest
// insert some test records //
//////////////////////////////
QInstance qInstance = QContext.getQInstance();
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin").withValue("lastName", "Kelkhoff").withValue("email", "darin.kelkhoff@kingsrook.com"),
new QRecord().withValue("id", 2).withValue("firstName", "Tim").withValue("lastName", "Chamberlain").withValue("email", "tim.chamberlain@kingsrook.com"),
new QRecord().withValue("id", 3).withValue("firstName", "James").withValue("lastName", "Maes").withValue("email", "james.maes@kingsrook.com")

View File

@ -85,7 +85,7 @@ class BulkEditTest extends BaseTest
// insert some test records //
//////////////////////////////
QInstance qInstance = QContext.getQInstance();
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin").withValue("lastName", "Kelkhoff").withValue("email", "darin.kelkhoff@kingsrook.com"),
new QRecord().withValue("id", 2).withValue("firstName", "Tim").withValue("lastName", "Chamberlain").withValue("email", "tim.chamberlain@kingsrook.com"),
new QRecord().withValue("id", 3).withValue("firstName", "James").withValue("lastName", "Maes").withValue("email", "james.maes@kingsrook.com")

View File

@ -86,7 +86,7 @@ class BulkInsertTransformStepTest extends BaseTest
////////////////////////////////////////////////////////////
// insert some records that will cause some UK violations //
////////////////////////////////////////////////////////////
TestUtils.insertRecords(instance, table, List.of(
TestUtils.insertRecords(table, List.of(
newQRecord("uuid-A", "SKU-1", 1),
newQRecord("uuid-B", "SKU-2", 1),
newQRecord("uuid-C", "SKU-2", 2)
@ -168,7 +168,7 @@ class BulkInsertTransformStepTest extends BaseTest
////////////////////////////////////////////////////////////
// insert some records that will cause some UK violations //
////////////////////////////////////////////////////////////
TestUtils.insertRecords(instance, table, List.of(
TestUtils.insertRecords(table, List.of(
newQRecord("uuid-A", "SKU-1", 1),
newQRecord("uuid-B", "SKU-2", 1),
newQRecord("uuid-C", "SKU-2", 2)

View File

@ -66,7 +66,7 @@ class LoadViaInsertOrUpdateStepTest extends BaseTest
List<QRecord> existingRecordList = List.of(
new QRecord().withValue("id", 47).withValue("firstName", "Tom")
);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), existingRecordList);
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), existingRecordList);
List<QRecord> inputRecordList = List.of(
new QRecord().withValue("id", 47).withValue("firstName", "Tim"),

View File

@ -307,6 +307,7 @@ public class StreamedETLWithFrontendProcessTest extends BaseTest
assertTrue(runProcessOutput.getException().isEmpty());
assertThat(runProcessOutput.getProcessState().getNextStepName()).hasValue("review");
@SuppressWarnings("unchecked")
List<ProcessSummaryLine> validationSummaryLines = (List<ProcessSummaryLine>) runProcessOutput.getValues().get(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY);
assertThat(validationSummaryLines)
.usingRecursiveFieldByFieldElementComparatorOnFields("status", "count")

View File

@ -61,7 +61,7 @@ class MergeDuplicatesProcessTest extends BaseTest
QInstance qInstance = QContext.getQInstance();
addProcessToInstance();
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin").withValue("noOfShoes", 1).withValue("favoriteShapeId", 11),
new QRecord().withValue("id", 2).withValue("firstName", "Tim").withValue("noOfShoes", 2).withValue("favoriteShapeId", 12),
new QRecord().withValue("id", 3).withValue("firstName", "Tyler").withValue("noOfShoes", 1).withValue("favoriteShapeId", 13),
@ -71,7 +71,7 @@ class MergeDuplicatesProcessTest extends BaseTest
new QRecord().withValue("id", 7).withValue("firstName", "James").withValue("noOfShoes", 1).withValue("favoriteShapeId", 17)
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_SHAPE), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_SHAPE), List.of(
new QRecord().withValue("id", 11).withValue("favoredByNoOfPeople", 1),
new QRecord().withValue("id", 12).withValue("favoredByNoOfPeople", 1),
new QRecord().withValue("id", 13).withValue("favoredByNoOfPeople", 1),

View File

@ -53,6 +53,7 @@ class SavedViewProcessTests extends BaseTest
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
@Test
void test() throws QException
{

View File

@ -73,6 +73,7 @@ class LoadScriptTestDetailsProcessStepTest extends BaseTest
Serializable inputFields = output.getValue("testInputFields");
assertThat(inputFields).isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<QFieldMetaData> inputFieldsList = (List<QFieldMetaData>) inputFields;
assertEquals(1, inputFieldsList.size());
assertEquals("recordPrimaryKeyList", inputFieldsList.get(0).getName());

View File

@ -56,8 +56,8 @@ class RunRecordScriptTest extends BaseTest
QInstance qInstance = QContext.getQInstance();
new ScriptsMetaDataProvider().defineAll(qInstance, TestUtils.MEMORY_BACKEND_NAME, null);
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(new QRecord().withValue("id", 1)));
TestUtils.insertRecords(qInstance, qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", 1).withTableName(TestUtils.TABLE_NAME_PERSON_MEMORY)));
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(new QRecord().withValue("id", 1)));
TestUtils.insertRecords(qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", 1).withTableName(TestUtils.TABLE_NAME_PERSON_MEMORY)));
RunProcessInput runProcessInput = new RunProcessInput();
runProcessInput.setProcessName(ScriptsMetaDataProvider.RUN_RECORD_SCRIPT_PROCESS_NAME);
@ -73,8 +73,10 @@ class RunRecordScriptTest extends BaseTest
// still good to run the code and at least get this far w/ an expected exception. //
///////////////////////////////////////////////////////////////////////////////////////////////////
RunProcessOutput runProcessOutput = new RunProcessAction().execute(runProcessInput);
System.out.println(runProcessOutput);
assertTrue(((List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults")).stream().anyMatch(psli -> psli instanceof ProcessSummaryLine psl && psl.getMessage().contains("error that was not logged")));
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processResults = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults");
assertTrue(processResults.stream().anyMatch(psli -> psli instanceof ProcessSummaryLine psl && psl.getMessage().contains("error that was not logged")));
}
}

View File

@ -61,7 +61,7 @@ class StoreScriptRevisionProcessStepTest extends BaseTest
Integer scriptId = 1701;
String scriptContents = "logger.log('Hi');";
TestUtils.insertRecords(qInstance, qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", scriptId)));
TestUtils.insertRecords(qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", scriptId)));
List<QRecord> scripts = TestUtils.queryTable(Script.TABLE_NAME);
assertNull(scripts.get(0).getValueInteger("currentScriptRevisionId"));
@ -121,7 +121,7 @@ class StoreScriptRevisionProcessStepTest extends BaseTest
String scriptContents = "logger.log('Hi');";
String templateContents = "<h1>Hey</h1>";
TestUtils.insertRecords(qInstance, qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", scriptId)));
TestUtils.insertRecords(qInstance.getTable(Script.TABLE_NAME), List.of(new QRecord().withValue("id", scriptId)));
List<QRecord> scripts = TestUtils.queryTable(Script.TABLE_NAME);
assertNull(scripts.get(0).getValueInteger("currentScriptRevisionId"));

View File

@ -84,6 +84,7 @@ class GetSharedRecordsProcessTest extends BaseTest
input.addValue("recordId", 1);
processStep.run(input, output);
@SuppressWarnings("unchecked")
List<QRecord> resultList = (List<QRecord>) output.getValue("resultList");
assertEquals(1, resultList.size());

View File

@ -116,7 +116,7 @@ class TableSyncProcessTest extends BaseTest
.withFields(personTable.getFields())
.withField(new QFieldMetaData("sourcePersonId", QFieldType.INTEGER)));
TestUtils.insertRecords(qInstance, qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(qInstance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin"),
new QRecord().withValue("id", 2).withValue("firstName", "Tim"),
new QRecord().withValue("id", 3).withValue("firstName", "Tyler"),
@ -124,7 +124,7 @@ class TableSyncProcessTest extends BaseTest
new QRecord().withValue("id", 5).withValue("firstName", "Homer")
));
TestUtils.insertRecords(qInstance, qInstance.getTable(TABLE_NAME_PEOPLE_SYNC), List.of(
TestUtils.insertRecords(qInstance.getTable(TABLE_NAME_PEOPLE_SYNC), List.of(
new QRecord().withValue("sourcePersonId", 3).withValue("firstName", "Garret"),
new QRecord().withValue("sourcePersonId", 5).withValue("firstName", "Homer")
));

View File

@ -80,7 +80,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("favoriteShapeId", 3),
new QRecord().withValue("favoriteShapeId", 1)
));
@ -107,7 +107,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("favoriteShapeId", 3),
new QRecord().withValue("favoriteShapeId", 1)
));
@ -134,7 +134,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 2).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 3).withValue("favoriteShapeId", 1)
@ -166,7 +166,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("favoriteShapeId", 3),
new QRecord().withValue("favoriteShapeId", 1)
));
@ -194,7 +194,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 2).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 3).withValue("favoriteShapeId", 1)
@ -239,7 +239,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 2).withValue("favoriteShapeId", 3),
new QRecord().withValue("id", 3).withValue("favoriteShapeId", 1)
@ -263,7 +263,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin"),
new QRecord().withValue("id", 2).withValue("firstName", "James"),
new QRecord().withValue("id", 3).withValue("firstName", "Tim")
@ -288,7 +288,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin"),
new QRecord().withValue("id", 2).withValue("firstName", "James"),
new QRecord().withValue("id", 3).withValue("firstName", "Tim")
@ -309,7 +309,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin"),
new QRecord().withValue("id", 2).withValue("firstName", "James"),
new QRecord().withValue("id", 3).withValue("firstName", "Tim")
@ -342,7 +342,7 @@ class GeneralProcessUtilsTest extends BaseTest
{
QInstance instance = QContext.getQInstance();
TestUtils.insertRecords(instance, instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
TestUtils.insertRecords(instance.getTable(TestUtils.TABLE_NAME_PERSON_MEMORY), List.of(
new QRecord().withValue("id", 1).withValue("firstName", "Darin").withValue("lastName", "Kelkhoff"),
new QRecord().withValue("id", 2).withValue("firstName", "James").withValue("lastName", "Maes"),
new QRecord().withValue("id", 3).withValue("firstName", "James").withValue("lastName", "Brown")

View File

@ -557,6 +557,7 @@ class CollectionUtilsTest extends BaseTest
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
@Test
void testUseOrWrap()
{

View File

@ -39,11 +39,11 @@ class ObjectUtilsTest
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings({ "DataFlowIssue", "ConfusingArgumentToVarargsMethod" })
@Test
void testRequireNonNullElse()
{
assertThatThrownBy(() -> ObjectUtils.requireNonNullElse(null)).isInstanceOf(NullPointerException.class);
Object nullObject = null;
assertThatThrownBy(() -> ObjectUtils.requireNonNullElse(nullObject)).isInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> ObjectUtils.requireNonNullElse(null, null)).isInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> ObjectUtils.requireNonNullElse(null, null, null)).isInstanceOf(NullPointerException.class);
assertEquals("a", ObjectUtils.requireNonNullElse("a", "b"));

View File

@ -357,17 +357,6 @@ public class TestUtils
/*******************************************************************************
**
*******************************************************************************/
@Deprecated(since = "better to call the one without qInstance param")
public static void insertRecords(QInstance qInstance, QTableMetaData table, List<QRecord> records) throws QException
{
insertRecords(table, records);
}
/*******************************************************************************
**
*******************************************************************************/

View File

@ -303,9 +303,16 @@ class ValueUtilsTest extends BaseTest
assertEquals(3, ValueUtils.getFirstNonNull(null, null, 3));
assertNull(ValueUtils.getFirstNonNull());
assertNull(ValueUtils.getFirstNonNull(new Object[] { }));
assertNull(ValueUtils.getFirstNonNull(null));
assertNull(ValueUtils.getFirstNonNull(null, null));
Object[] emptyArray = { };
assertNull(ValueUtils.getFirstNonNull(emptyArray));
Object nullObject = null;
assertNull(ValueUtils.getFirstNonNull(nullObject));
assertNull(ValueUtils.getFirstNonNull(null, nullObject));
assertNull(ValueUtils.getFirstNonNull(nullObject, null));
assertNull(ValueUtils.getFirstNonNull(nullObject, nullObject));
assertNull(ValueUtils.getFirstNonNull(nullObject, nullObject, nullObject));
}

View File

@ -1212,7 +1212,7 @@ public class BaseAPIActionUtil
{
try
{
requestBody = StringUtils.join("\n", IOUtils.readLines(entityRequest.getEntity().getContent()));
requestBody = StringUtils.join("\n", IOUtils.readLines(entityRequest.getEntity().getContent(), StandardCharsets.UTF_8));
}
catch(Exception e)
{

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.api.mocks;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.Deque;
import com.kingsrook.qqq.backend.core.exceptions.QException;
@ -221,6 +222,6 @@ public class MockApiUtilsHelper
@SuppressWarnings("unchecked")
public static String readRequestBody(HttpRequestBase request) throws IOException
{
return (StringUtils.join("\n", IOUtils.readLines(((HttpEntityEnclosingRequestBase) request).getEntity().getContent())));
return (StringUtils.join("\n", IOUtils.readLines(((HttpEntityEnclosingRequestBase) request).getEntity().getContent(), StandardCharsets.UTF_8)));
}
}

View File

@ -287,6 +287,7 @@ public class MockHttpResponse implements CloseableHttpResponse
@Override
@SuppressWarnings("deprecation")
public HttpParams getParams()
{
return null;
@ -295,6 +296,7 @@ public class MockHttpResponse implements CloseableHttpResponse
@Override
@SuppressWarnings("deprecation")
public void setParams(HttpParams httpParams)
{

View File

@ -25,6 +25,7 @@ package com.kingsrook.qqq.backend.module.filesystem.base.actions;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@ -222,7 +223,7 @@ public abstract class AbstractBaseFilesystemAction<FILE>
{
case CSV:
{
String fileContents = IOUtils.toString(inputStream);
String fileContents = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
fileContents = customizeFileContentsAfterReading(table, fileContents);
if(queryInput.getRecordPipe() != null)
@ -245,7 +246,7 @@ public abstract class AbstractBaseFilesystemAction<FILE>
}
case JSON:
{
String fileContents = IOUtils.toString(inputStream);
String fileContents = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
fileContents = customizeFileContentsAfterReading(table, fileContents);
// todo - pipe support!!

View File

@ -129,7 +129,7 @@ public class BasicETLCleanupSourceFilesStep implements BackendStep
.withName(this.getClass().getName())
.withCodeType(QCodeType.JAVA))
.withInputData(new QFunctionInputMetaData()
.addField(new QFieldMetaData("moveOrDelete", QFieldType.STRING))
.addField(new QFieldMetaData("destinationForMoves", QFieldType.STRING))));
.withField(new QFieldMetaData("moveOrDelete", QFieldType.STRING))
.withField(new QFieldMetaData("destinationForMoves", QFieldType.STRING))));
}
}

View File

@ -69,10 +69,10 @@ public class FilesystemSyncProcess
.withName(FilesystemSyncStep.class.getName())
.withCodeType(QCodeType.JAVA))
.withInputData(new QFunctionInputMetaData()
.addField(new QFieldMetaData(FIELD_SOURCE_TABLE, QFieldType.STRING))
.addField(new QFieldMetaData(FIELD_ARCHIVE_TABLE, QFieldType.STRING))
.addField(new QFieldMetaData(FIELD_MAX_FILES_TO_ARCHIVE, QFieldType.INTEGER).withDefaultValue(Integer.MAX_VALUE))
.addField(new QFieldMetaData(FIELD_PROCESSING_TABLE, QFieldType.STRING)));
.withField(new QFieldMetaData(FIELD_SOURCE_TABLE, QFieldType.STRING))
.withField(new QFieldMetaData(FIELD_ARCHIVE_TABLE, QFieldType.STRING))
.withField(new QFieldMetaData(FIELD_MAX_FILES_TO_ARCHIVE, QFieldType.INTEGER).withDefaultValue(Integer.MAX_VALUE))
.withField(new QFieldMetaData(FIELD_PROCESSING_TABLE, QFieldType.STRING)));
return new QProcessMetaData()
.withName(PROCESS_NAME)

View File

@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.module.filesystem.local.actions;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import com.kingsrook.qqq.backend.core.context.QContext;
import com.kingsrook.qqq.backend.core.model.session.QSession;
import com.kingsrook.qqq.backend.core.utils.StringUtils;
@ -115,14 +116,14 @@ public class FilesystemActionTest extends BaseTest
{"id":2,"createDate":"2022-06-17 14:52:59","modifyDate":"2022-06-17 14:52:59","firstName":"Jane","lastName":"Smith","birthDate":"1982-02-02","email":"jane@kingsrook.com"}
]
""";
FileUtils.writeStringToFile(new File(fullPath + "DATA-1.json"), jsonData1);
FileUtils.writeStringToFile(new File(fullPath + "DATA-1.json"), jsonData1, StandardCharsets.UTF_8);
String jsonData2 = """
[
{"id":3,"createDate":"2021-11-27 15:40:38","modifyDate":"2021-11-27 15:40:38","firstName":"Homer","lastName":"S","birthDate":"1983-03-03","email":"homer.s@kingsrook.com"}
]
""";
FileUtils.writeStringToFile(new File(fullPath + "DATA-2.json"), jsonData2);
FileUtils.writeStringToFile(new File(fullPath + "DATA-2.json"), jsonData2, StandardCharsets.UTF_8);
}
@ -147,14 +148,14 @@ public class FilesystemActionTest extends BaseTest
"1","2021-10-26 14:39:37","2021-10-26 14:39:37","John","Doe","1981-01-01","john@kingsrook.com"
"2","2022-06-17 14:52:59","2022-06-17 14:52:59","Jane","Smith","1982-02-02","jane@kingsrook.com"
""";
FileUtils.writeStringToFile(new File(fullPath + "FILE-1.csv"), csvData1);
FileUtils.writeStringToFile(new File(fullPath + "FILE-1.csv"), csvData1, StandardCharsets.UTF_8);
String csvData2 = """
"id","createDate","modifyDate","firstName","lastName","birthDate","email"
"3","2021-11-27 15:40:38","2021-11-27 15:40:38","Homer","S","1983-03-03","homer.s@kingsrook.com"
"4","2022-07-18 15:53:00","2022-07-18 15:53:00","Marge","S","1984-04-04","marge.s@kingsrook.com"
"5","2022-11-11 12:00:00","2022-11-12 13:00:00","Bart","S","1985-05-05","bart.s@kingsrook.com\""""; // intentionally no \n at EOL here
FileUtils.writeStringToFile(new File(fullPath + "FILE-2.csv"), csvData2);
FileUtils.writeStringToFile(new File(fullPath + "FILE-2.csv"), csvData2, StandardCharsets.UTF_8);
}
@ -177,15 +178,15 @@ public class FilesystemActionTest extends BaseTest
String data1 = """
Hello, Blob
""";
FileUtils.writeStringToFile(new File(fullPath + "BLOB-1.txt"), data1);
FileUtils.writeStringToFile(new File(fullPath + "BLOB-1.txt"), data1, StandardCharsets.UTF_8);
String data2 = """
Hi Bob""";
FileUtils.writeStringToFile(new File(fullPath + "BLOB-2.txt"), data2);
FileUtils.writeStringToFile(new File(fullPath + "BLOB-2.txt"), data2, StandardCharsets.UTF_8);
String data3 = """
# Hi MD...""";
FileUtils.writeStringToFile(new File(fullPath + "BLOB-3.md"), data3);
FileUtils.writeStringToFile(new File(fullPath + "BLOB-3.md"), data3, StandardCharsets.UTF_8);
}

View File

@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.module.filesystem.local.actions;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import com.kingsrook.qqq.backend.core.actions.tables.InsertAction;
import com.kingsrook.qqq.backend.core.exceptions.QException;
@ -64,7 +65,7 @@ public class FilesystemInsertActionTest extends FilesystemActionTest
.allMatch(record -> record.getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH).contains(TestUtils.BASE_PATH))
.allMatch(record -> record.getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH).contains("blobs"));
assertEquals("Hello, World", FileUtils.readFileToString(new File(insertOutput.getRecords().get(0).getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH))));
assertEquals("Hello, World", FileUtils.readFileToString(new File(insertOutput.getRecords().get(0).getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH)), StandardCharsets.UTF_8));
}

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.filesystem.processes.implementations.et
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@ -189,7 +190,7 @@ public class BasicETLCleanupSourceFilesStepTest extends BaseTest
for(String filePath : filePathsSet)
{
File file = new File(filePath);
FileUtils.writeStringToFile(file, "content");
FileUtils.writeStringToFile(file, "content", StandardCharsets.UTF_8);
}
// List<QRecord> records = filePaths.stream()

View File

@ -24,6 +24,7 @@ package com.kingsrook.qqq.backend.module.filesystem.processes.implementations.fi
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import com.kingsrook.qqq.backend.core.actions.processes.RunBackendStepAction;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
@ -105,7 +106,7 @@ class FilesystemSyncProcessTest extends BaseTest
{
String path = ((FilesystemTableBackendDetails) table.getBackendDetails()).getBasePath();
File file = new File(basePath + "/" + path + "/" + name);
FileUtils.writeStringToFile(file, content);
FileUtils.writeStringToFile(file, content, StandardCharsets.UTF_8);
}

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.filesystem.s3.actions;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import com.amazonaws.services.s3.model.S3Object;
import com.kingsrook.qqq.backend.core.exceptions.QException;
@ -68,9 +69,9 @@ public class S3InsertActionTest extends BaseS3Test
assertThat(insertOutput.getRecords())
.allMatch(record -> record.getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH).contains("blobs"));
String fullPath = insertOutput.getRecords().get(0).getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH);
S3Object object = getAmazonS3().getObject(BUCKET_NAME, fullPath);
List lines = IOUtils.readLines(object.getObjectContent());
String fullPath = insertOutput.getRecords().get(0).getBackendDetailString(FilesystemRecordBackendDetailFields.FULL_PATH);
S3Object object = getAmazonS3().getObject(BUCKET_NAME, fullPath);
List<String> lines = IOUtils.readLines(object.getObjectContent(), StandardCharsets.UTF_8);
assertEquals("Hi, Bob.", lines.get(0));
}

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.filesystem.s3.utils;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.kingsrook.qqq.backend.core.exceptions.QException;
@ -76,7 +77,7 @@ public class S3UtilsTest extends BaseS3Test
List<S3ObjectSummary> s3ObjectSummaries = s3Utils.listObjectsInBucketMatchingGlob(BUCKET_NAME, "test-files", "");
S3ObjectSummary s3ObjectSummary = s3ObjectSummaries.stream().filter(o -> o.getKey().contains("1.csv")).findAny().get();
InputStream inputStream = s3Utils.getObjectAsInputStream(s3ObjectSummary);
String csvFromS3 = IOUtils.toString(inputStream);
String csvFromS3 = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
assertEquals(getCSVData1(), csvFromS3, "File from S3 should match expected content");
}

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.module.rdbms;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.util.List;
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
@ -91,7 +92,7 @@ public class TestUtils
{
InputStream primeTestDatabaseSqlStream = RDBMSActionTest.class.getResourceAsStream("/" + sqlFileName);
assertNotNull(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) IOUtils.readLines(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) 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(";"))

View File

@ -982,6 +982,7 @@ public class RDBMSQueryActionTest extends RDBMSActionTest
**
*******************************************************************************/
@Test
@SuppressWarnings("unchecked")
void testHeavyFields() throws QException
{
//////////////////////////////////////////////////////////

View File

@ -293,6 +293,7 @@ class QueryManagerTest extends BaseTest
** confirms (more?) correct behavior
*******************************************************************************/
@Test
@SuppressWarnings("deprecation")
void testLocalDate() throws SQLException
{
try(Connection connection = getConnection())
@ -304,17 +305,20 @@ class QueryManagerTest extends BaseTest
ResultSet rs = preparedStatement.getResultSet();
rs.next();
Date date = QueryManager.getDate(rs, 1);
Date date = QueryManager.getDate(rs, 1);
assertNotNull(date);
assertEquals(1, date.getDate(), "Date value");
assertEquals(Month.OCTOBER.getValue(), date.getMonth() + 1, "Month value");
assertEquals(2013, date.getYear() + 1900, "Year value");
LocalDate localDate = QueryManager.getLocalDate(rs, 1);
assertNotNull(localDate);
assertEquals(1, localDate.getDayOfMonth(), "Date value");
assertEquals(Month.OCTOBER, localDate.getMonth(), "Month value");
assertEquals(2013, localDate.getYear(), "Year value");
LocalDateTime localDateTime = QueryManager.getLocalDateTime(rs, 1);
assertNotNull(localDateTime);
assertEquals(1, localDateTime.getDayOfMonth(), "Date value");
assertEquals(Month.OCTOBER, localDateTime.getMonth(), "Month value");
assertEquals(2013, localDateTime.getYear(), "Year value");
@ -322,6 +326,7 @@ class QueryManagerTest extends BaseTest
assertEquals(0, localDateTime.getMinute(), "Minute value");
OffsetDateTime offsetDateTime = QueryManager.getOffsetDateTime(rs, 1);
assertNotNull(offsetDateTime);
assertEquals(1, offsetDateTime.getDayOfMonth(), "Date value");
assertEquals(Month.OCTOBER, offsetDateTime.getMonth(), "Month value");
assertEquals(2013, offsetDateTime.getYear(), "Year value");

View File

@ -1388,7 +1388,7 @@ public class ApiImplementation
List<Serializable> criteriaValues;
if(selectedOperator.noOfValues == null)
{
criteriaValues = Arrays.asList(value.split(","));
criteriaValues = Arrays.stream(value.split(",")).map(Serializable.class::cast).toList();
}
else if(selectedOperator.noOfValues == 1)
{
@ -1404,7 +1404,7 @@ public class ApiImplementation
}
else if(selectedOperator.noOfValues == 2)
{
criteriaValues = Arrays.asList(value.split(","));
criteriaValues = Arrays.stream(value.split(",")).map(Serializable.class::cast).toList();
if(criteriaValues.size() != 2)
{
throw (new QBadRequestException("Operator " + selectedOperator.prefix + " for field " + name + " requires 2 values (received " + criteriaValues.size() + ")"));

View File

@ -92,7 +92,9 @@ public class RenderSavedReportProcessApiMetaDataEnricher
ApiFieldMetaDataContainer apiFieldMetaDataContainer = new ApiFieldMetaDataContainer().withDefaultApiFieldMetaData(defaultApiFieldMetaData);
if(example instanceof List)
{
defaultApiFieldMetaData.withExample(new ExampleWithListValue().withValue((List<String>) example));
@SuppressWarnings("unchecked")
List<String> stringList = (List<String>) example;
defaultApiFieldMetaData.withExample(new ExampleWithListValue().withValue(stringList));
}
else
{

View File

@ -62,6 +62,7 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
@Override
public HttpStatus.Code getSuccessStatusCode(RunProcessInput runProcessInput, RunProcessOutput runProcessOutput)
{
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLineInterfaces = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults");
if(processSummaryLineInterfaces.isEmpty())
{
@ -134,7 +135,9 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
{
try
{
ArrayList<Serializable> apiOutput = new ArrayList<>();
ArrayList<Serializable> apiOutput = new ArrayList<>();
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLineInterfaces = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults");
for(ProcessSummaryLineInterface processSummaryLineInterface : processSummaryLineInterfaces)
{

View File

@ -230,7 +230,9 @@ class ApiImplementationTest extends BaseTest
// query for persons - make sure custom method ran //
/////////////////////////////////////////////////////
Map<String, Serializable> queryResult = ApiImplementation.query(apiInstanceMetaData, TestUtils.CURRENT_API_VERSION, "person", Collections.emptyMap());
assertEquals("value from prepareToProduceApiValues", ((List<Map<String, Object>>) queryResult.get("records")).get(0).get("lastName"));
@SuppressWarnings("unchecked")
List<Map<String, Object>> records = (List<Map<String, Object>>) queryResult.get("records");
assertEquals("value from prepareToProduceApiValues", records.get(0).get("lastName"));
assertEquals(queryResult.get("count"), PersonLastNameBulkApiValueCustomizer.prepareWasCalledWithThisNoOfRecords);
}

View File

@ -311,6 +311,7 @@ class ApiScriptUtilsTest extends BaseTest
Serializable result = apiScriptUtils.runProcess(TestUtils.PROCESS_NAME_TRANSFORM_PEOPLE, JsonUtils.toJson(Map.of("id", "1,2,3")));
assertThat(result).isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result;
assertEquals(3, resultList.size());
@ -332,6 +333,7 @@ class ApiScriptUtilsTest extends BaseTest
Serializable asyncResult = apiScriptUtils.runProcess(TestUtils.PROCESS_NAME_TRANSFORM_PEOPLE, JsonUtils.toJson(Map.of("id", "1,2,3", "async", true)));
assertThat(asyncResult).isInstanceOf(Map.class);
@SuppressWarnings("unchecked")
String jobId = ValueUtils.getValueAsString(((Map<String, ?>) asyncResult).get("jobId"));
assertNotNull(jobId);
@ -350,6 +352,7 @@ class ApiScriptUtilsTest extends BaseTest
}
assertThat(result).isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result;
assertEquals(3, resultList.size());

View File

@ -383,11 +383,13 @@ public class QJavalinAccessLogger
{
if(runProcessOutput.getValues().containsKey(StreamedETLWithFrontendProcess.FIELD_PROCESS_SUMMARY))
{
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLines = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get(StreamedETLWithFrontendProcess.FIELD_PROCESS_SUMMARY);
processSummaryListToLogPairs(logPairs, processSummaryLines);
}
else if(runProcessOutput.getValues().containsKey(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY))
{
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLines = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get(StreamedETLWithFrontendProcess.FIELD_VALIDATION_SUMMARY);
processSummaryListToLogPairs(logPairs, processSummaryLines);
}

View File

@ -28,6 +28,7 @@ import java.io.InputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
@ -41,6 +42,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kingsrook.qqq.backend.core.actions.async.AsyncJobManager;
import com.kingsrook.qqq.backend.core.actions.dashboard.RenderWidgetAction;
import com.kingsrook.qqq.backend.core.actions.metadata.MetaDataAction;
@ -223,7 +225,7 @@ public class QJavalinImplementation
public QJavalinImplementation(String qInstanceFilePath) throws IOException
{
LOG.info("Loading qInstance from file (assuming json): " + qInstanceFilePath);
String qInstanceJson = FileUtils.readFileToString(new File(qInstanceFilePath));
String qInstanceJson = FileUtils.readFileToString(new File(qInstanceFilePath), StandardCharsets.UTF_8);
QJavalinImplementation.qInstance = new QInstanceAdapter().jsonToQInstanceIncludingBackends(qInstanceJson);
QJavalinImplementation.javalinMetaData = new QJavalinMetaData();
}
@ -1800,7 +1802,7 @@ public class QJavalinImplementation
if(CollectionUtils.nullSafeHasContents(valuesParamList))
{
String valuesParam = valuesParamList.get(0);
values = JsonUtils.toObject(valuesParam, Map.class);
values = JsonUtils.toObject(valuesParam, new TypeReference<>(){});
}
}

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.backend.javalin;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.util.List;
import java.util.Objects;
@ -119,7 +120,7 @@ public class TestUtils
{
InputStream primeTestDatabaseSqlStream = TestUtils.class.getResourceAsStream("/prime-test-database.sql");
assertNotNull(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) IOUtils.readLines(primeTestDatabaseSqlStream);
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(";"))
@ -365,7 +366,7 @@ public class TestUtils
.withOutputMetaData(new QFunctionOutputMetaData()
.withRecordListMetaData(new QRecordListMetaData()
.withTableName(TABLE_NAME_PERSON)
.addField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
.withField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
)
.withFieldList(List.of(new QFieldMetaData("outputMessage", QFieldType.STRING))))
);
@ -402,7 +403,7 @@ public class TestUtils
.withOutputMetaData(new QFunctionOutputMetaData()
.withRecordListMetaData(new QRecordListMetaData()
.withTableName(TABLE_NAME_PERSON)
.addField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
.withField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
)
.withFieldList(List.of(new QFieldMetaData("outputMessage", QFieldType.STRING))))
)
@ -514,7 +515,7 @@ public class TestUtils
.withName(SleeperStep.class.getName())
.withCodeType(QCodeType.JAVA))
.withInputData(new QFunctionInputMetaData()
.addField(new QFieldMetaData(SleeperStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
.withField(new QFieldMetaData(SleeperStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
}
}
@ -571,7 +572,7 @@ public class TestUtils
.withName(ThrowerStep.class.getName())
.withCodeType(QCodeType.JAVA))
.withInputData(new QFunctionInputMetaData()
.addField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
.withField(new QFieldMetaData(ThrowerStep.FIELD_SLEEP_MILLIS, QFieldType.INTEGER))));
}
}

View File

@ -29,6 +29,7 @@ import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -129,7 +130,7 @@ public class QPicoCliImplementation
if(args.length > 0 && args[0].startsWith("--qInstanceJsonFile="))
{
String filePath = args[0].replaceFirst("--.*=", "");
String qInstanceJson = FileUtils.readFileToString(new File(filePath));
String qInstanceJson = FileUtils.readFileToString(new File(filePath), StandardCharsets.UTF_8);
qInstance = new QInstanceAdapter().jsonToQInstanceIncludingBackends(qInstanceJson);
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
@ -716,7 +717,7 @@ public class QPicoCliImplementation
try
{
String path = subParseResult.matchedOptionValue("--jsonFile", "");
String json = FileUtils.readFileToString(new File(path));
String json = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);
recordList = new JsonToQRecordAdapter().buildRecordsFromJson(json, table, mapping);
}
catch(IOException e)
@ -729,7 +730,7 @@ public class QPicoCliImplementation
try
{
String path = subParseResult.matchedOptionValue("--csvFile", "");
String csv = FileUtils.readFileToString(new File(path));
String csv = FileUtils.readFileToString(new File(path), StandardCharsets.UTF_8);
recordList = new CsvToQRecordAdapter().buildRecordsFromCsv(csv, table, mapping);
}
catch(IOException e)

View File

@ -395,7 +395,7 @@ class QPicoCliImplementationTest
File file = new File("/tmp/" + UUID.randomUUID() + ".json");
file.deleteOnExit();
FileUtils.writeStringToFile(file, jsonContents);
FileUtils.writeStringToFile(file, jsonContents, StandardCharsets.UTF_8);
TestOutput testOutput = testCli("person", "insert", mapping, "--jsonFile=" + file.getAbsolutePath());
JSONObject insertResult = JsonUtils.toJSONObject(testOutput.getOutput());
@ -433,7 +433,7 @@ class QPicoCliImplementationTest
File file = new File("/tmp/" + UUID.randomUUID() + ".csv");
file.deleteOnExit();
FileUtils.writeStringToFile(file, csvContents);
FileUtils.writeStringToFile(file, csvContents, StandardCharsets.UTF_8);
TestOutput testOutput = testCli("person", "insert", mapping, "--csvFile=" + file.getAbsolutePath());
JSONObject insertResult = JsonUtils.toJSONObject(testOutput.getOutput());
@ -683,8 +683,7 @@ class QPicoCliImplementationTest
assertTestOutputContains(testOutput, "Wrote 3 records to file " + filename);
File file = new File(filename);
@SuppressWarnings("unchecked")
List<String> list = FileUtils.readLines(file);
List<String> list = FileUtils.readLines(file, StandardCharsets.UTF_8);
assertEquals(4, list.size());
assertThat(list.get(0)).contains("""
"Id","Create Date","Modify Date\"""");
@ -710,8 +709,7 @@ class QPicoCliImplementationTest
assertTestOutputContains(testOutput, "Wrote 4 records to file " + filename);
File file = new File(filename);
@SuppressWarnings("unchecked")
List<String> list = FileUtils.readLines(file);
List<String> list = FileUtils.readLines(file, StandardCharsets.UTF_8);
assertEquals(5, list.size());
assertThat(list.get(0)).contains("""
"Id","Create Date","Modify Date\"""");
@ -842,8 +840,7 @@ class QPicoCliImplementationTest
TestOutput testOutput = testCli("person", "export", "--filename=" + filename, "--fieldNames=id,lastName,birthDate");
File file = new File(filename);
@SuppressWarnings("unchecked")
List<String> list = FileUtils.readLines(file);
List<String> list = FileUtils.readLines(file, StandardCharsets.UTF_8);
assertEquals(6, list.size());
assertThat(list.get(0)).isEqualTo("""
"Id","Last Name","Birth Date\"""");

View File

@ -23,6 +23,7 @@ package com.kingsrook.qqq.frontend.picocli;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.util.List;
import com.kingsrook.qqq.backend.core.model.metadata.QAuthenticationType;
@ -65,7 +66,7 @@ public class TestUtils
{
InputStream primeTestDatabaseSqlStream = TestUtils.class.getResourceAsStream("/prime-test-database.sql");
assertNotNull(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) IOUtils.readLines(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) 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(";"))
@ -182,7 +183,7 @@ public class TestUtils
.withOutputMetaData(new QFunctionOutputMetaData()
.withRecordListMetaData(new QRecordListMetaData()
.withTableName("person")
.addField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
.withField(new QFieldMetaData("fullGreeting", QFieldType.STRING))
)
.withFieldList(List.of(new QFieldMetaData("outputMessage", QFieldType.STRING))))
);

View File

@ -115,7 +115,7 @@ public class QSlackImplementation
public QSlackImplementation(String qInstanceFilePath) throws IOException
{
LOG.info("Loading qInstance from file (assuming json): " + qInstanceFilePath);
String qInstanceJson = FileUtils.readFileToString(new File(qInstanceFilePath));
String qInstanceJson = FileUtils.readFileToString(new File(qInstanceFilePath), StandardCharsets.UTF_8);
QSlackImplementation.qInstance = new QInstanceAdapter().jsonToQInstanceIncludingBackends(qInstanceJson);
}

View File

@ -25,6 +25,7 @@ package com.kingsrook.sampleapp;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.util.List;
import java.util.UUID;
@ -117,7 +118,6 @@ public class SampleMetaDataProviderTest
/*******************************************************************************
**
*******************************************************************************/
@SuppressWarnings("unchecked")
public static void primeTestDatabase(String sqlFileName) throws Exception
{
ConnectionManager connectionManager = new ConnectionManager();
@ -125,7 +125,7 @@ public class SampleMetaDataProviderTest
{
InputStream primeTestDatabaseSqlStream = SampleMetaDataProviderTest.class.getResourceAsStream("/" + sqlFileName);
assertNotNull(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) IOUtils.readLines(primeTestDatabaseSqlStream);
List<String> lines = (List<String>) 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(";"))
@ -177,7 +177,7 @@ public class SampleMetaDataProviderTest
id,name,state
1,Chester,IL
2,Red Bud,IL
3,Sparta,IL""");
3,Sparta,IL""", StandardCharsets.UTF_8);
return destinationFile;
}