From 1548d7f35b5ffc0e08116b27990c022d713c21b2 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Fri, 7 Oct 2022 10:14:35 -0500 Subject: [PATCH] Initial checkin --- .../NoopTransformStepTest.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 qqq-backend-core/src/test/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/NoopTransformStepTest.java diff --git a/qqq-backend-core/src/test/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/NoopTransformStepTest.java b/qqq-backend-core/src/test/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/NoopTransformStepTest.java new file mode 100644 index 00000000..8d1b1e60 --- /dev/null +++ b/qqq-backend-core/src/test/java/com/kingsrook/qqq/backend/core/processes/implementations/etl/streamedwithfrontend/NoopTransformStepTest.java @@ -0,0 +1,77 @@ +/* + * QQQ - Low-code Application Framework for Engineers. + * Copyright (C) 2021-2022. 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 . + */ + +package com.kingsrook.qqq.backend.core.processes.implementations.etl.streamedwithfrontend; + + +import java.util.ArrayList; +import java.util.List; +import com.kingsrook.qqq.backend.core.exceptions.QException; +import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLine; +import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessSummaryLineInterface; +import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput; +import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput; +import com.kingsrook.qqq.backend.core.model.actions.processes.Status; +import com.kingsrook.qqq.backend.core.model.data.QRecord; +import com.kingsrook.qqq.backend.core.model.session.QSession; +import com.kingsrook.qqq.backend.core.utils.TestUtils; +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + + +/******************************************************************************* + ** Unit test for NoopTransformStep + *******************************************************************************/ +class NoopTransformStepTest +{ + + /******************************************************************************* + ** + *******************************************************************************/ + @Test + void test() throws QException + { + RunBackendStepInput input = new RunBackendStepInput(TestUtils.defineInstance()); + input.setSession(new QSession()); + input.setTableName(TestUtils.TABLE_NAME_PERSON); + input.setRecords(List.of(new QRecord().withValue("id", 47))); + + RunBackendStepOutput output = new RunBackendStepOutput(); + + NoopTransformStep noopTransformStep = new NoopTransformStep(); + noopTransformStep.run(input, output); + + assertEquals(1, output.getRecords().size()); + assertEquals(47, output.getRecords().get(0).getValueInteger("id")); + + ArrayList processSummary = noopTransformStep.getProcessSummary(output, false); + assertEquals(1, processSummary.size()); + ProcessSummaryLineInterface processSummaryLineInterface = processSummary.get(0); + assertEquals(Status.OK, processSummaryLineInterface.getStatus()); + if(processSummaryLineInterface instanceof ProcessSummaryLine processSummaryLine) + { + assertEquals(1, processSummaryLine.getCount()); + assertEquals(1, processSummaryLine.getPrimaryKeys().size()); + assertEquals(47, processSummaryLine.getPrimaryKeys().get(0)); + } + } + +} \ No newline at end of file