mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 21:20:45 +00:00
CE-1955 - Boosting test-coverage during bulk-load rollout
This commit is contained in:
@ -188,7 +188,7 @@ class BulkInsertFullProcessTest extends BaseTest
|
||||
new BulkLoadProfileField().withFieldName("firstName").withColumnIndex(3),
|
||||
new BulkLoadProfileField().withFieldName("lastName").withColumnIndex(4),
|
||||
new BulkLoadProfileField().withFieldName("email").withDefaultValue(defaultEmail),
|
||||
new BulkLoadProfileField().withFieldName("homeStateId").withColumnIndex(7).withDoValueMapping(true),
|
||||
new BulkLoadProfileField().withFieldName("homeStateId").withColumnIndex(7).withDoValueMapping(true).withValueMappings(Map.of("Illinois", 1)),
|
||||
new BulkLoadProfileField().withFieldName("noOfShoes").withColumnIndex(8)
|
||||
)));
|
||||
};
|
||||
@ -204,6 +204,7 @@ class BulkInsertFullProcessTest extends BaseTest
|
||||
assertEquals("homeStateId", ((QFrontendFieldMetaData) valueMappingField).getName());
|
||||
assertEquals(List.of("Missouri", "Illinois"), runProcessOutput.getValue("fileValues"));
|
||||
assertEquals(List.of("homeStateId"), runProcessOutput.getValue("fieldNamesToDoValueMapping"));
|
||||
assertEquals(Map.of(1, "IL"), runProcessOutput.getValue("mappedValueLabels"));
|
||||
assertEquals(0, runProcessOutput.getValue("valueMappingFieldIndex"));
|
||||
assertThat(runProcessOutput.getProcessState().getNextStepName()).isPresent().get().isEqualTo("valueMapping");
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.processes.implementations.etl.streamedwithfrontend;
|
||||
|
||||
|
||||
import com.kingsrook.qqq.backend.core.BaseTest;
|
||||
import com.kingsrook.qqq.backend.core.exceptions.QException;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
|
||||
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Unit test for NoopLoadStep
|
||||
*******************************************************************************/
|
||||
class NoopLoadStepTest extends BaseTest
|
||||
{
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void test() throws QException
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// sorry, just here for coverage... //
|
||||
//////////////////////////////////////
|
||||
new NoopLoadStep().runOnePage(new RunBackendStepInput(), new RunBackendStepOutput());
|
||||
}
|
||||
|
||||
}
|
@ -91,6 +91,57 @@ class AggregatesTest extends BaseTest
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@Test
|
||||
void testLong()
|
||||
{
|
||||
LongAggregates aggregates = new LongAggregates();
|
||||
|
||||
assertEquals(0, aggregates.getCount());
|
||||
assertNull(aggregates.getMin());
|
||||
assertNull(aggregates.getMax());
|
||||
assertNull(aggregates.getSum());
|
||||
assertNull(aggregates.getAverage());
|
||||
|
||||
aggregates.add(5L);
|
||||
assertEquals(1, aggregates.getCount());
|
||||
assertEquals(5, aggregates.getMin());
|
||||
assertEquals(5, aggregates.getMax());
|
||||
assertEquals(5, aggregates.getSum());
|
||||
assertThat(aggregates.getAverage()).isCloseTo(new BigDecimal("5"), Offset.offset(BigDecimal.ZERO));
|
||||
|
||||
aggregates.add(10L);
|
||||
assertEquals(2, aggregates.getCount());
|
||||
assertEquals(5, aggregates.getMin());
|
||||
assertEquals(10, aggregates.getMax());
|
||||
assertEquals(15, aggregates.getSum());
|
||||
assertThat(aggregates.getAverage()).isCloseTo(new BigDecimal("7.5"), Offset.offset(BigDecimal.ZERO));
|
||||
|
||||
aggregates.add(15L);
|
||||
assertEquals(3, aggregates.getCount());
|
||||
assertEquals(5, aggregates.getMin());
|
||||
assertEquals(15, aggregates.getMax());
|
||||
assertEquals(30, aggregates.getSum());
|
||||
assertThat(aggregates.getAverage()).isCloseTo(new BigDecimal("10"), Offset.offset(BigDecimal.ZERO));
|
||||
|
||||
aggregates.add(null);
|
||||
assertEquals(3, aggregates.getCount());
|
||||
assertEquals(5, aggregates.getMin());
|
||||
assertEquals(15, aggregates.getMax());
|
||||
assertEquals(30, aggregates.getSum());
|
||||
assertThat(aggregates.getAverage()).isCloseTo(new BigDecimal("10"), Offset.offset(BigDecimal.ZERO));
|
||||
|
||||
assertEquals(new BigDecimal("750"), aggregates.getProduct());
|
||||
assertEquals(new BigDecimal("25.0000"), aggregates.getVariance());
|
||||
assertEquals(new BigDecimal("5.0000"), aggregates.getStandardDeviation());
|
||||
assertThat(aggregates.getVarP()).isCloseTo(new BigDecimal("16.6667"), Offset.offset(new BigDecimal(".0001")));
|
||||
assertThat(aggregates.getStdDevP()).isCloseTo(new BigDecimal("4.0824"), Offset.offset(new BigDecimal(".0001")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
Reference in New Issue
Block a user