From fcb551e95d63e913ee65d6b105eccd2c974b4d47 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Thu, 27 Feb 2025 14:53:03 -0800 Subject: [PATCH 1/5] Remove Advanced Import Options tests --- .../test/tests/AdvancedImportOptionsTest.java | 421 ------------------ 1 file changed, 421 deletions(-) delete mode 100644 src/org/labkey/test/tests/AdvancedImportOptionsTest.java diff --git a/src/org/labkey/test/tests/AdvancedImportOptionsTest.java b/src/org/labkey/test/tests/AdvancedImportOptionsTest.java deleted file mode 100644 index c1adb66ee4..0000000000 --- a/src/org/labkey/test/tests/AdvancedImportOptionsTest.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright (c) 2016-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.tests; - -import org.junit.Assume; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.TestFileUtils; -import org.labkey.test.TestTimeoutException; -import org.labkey.test.WebTestHelper; -import org.labkey.test.categories.Daily; -import org.labkey.test.components.studydesigner.AssayScheduleWebpart; -import org.labkey.test.components.studydesigner.ImmunizationScheduleWebpart; -import org.labkey.test.components.studydesigner.VaccineDesignWebpart; -import org.labkey.test.pages.StartImportPage; -import org.labkey.test.pages.study.ManageDatasetQCStatesPage; -import org.labkey.test.pages.study.QCStateTableRow; -import org.labkey.test.util.ApiPermissionsHelper; -import org.labkey.test.util.PermissionsHelper; -import org.labkey.test.util.PostgresOnlyTest; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.WebDriverWait; - -import java.io.File; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -@Category(Daily.class) -@BaseWebDriverTest.ClassTimeout(minutes = 9) -public class AdvancedImportOptionsTest extends BaseWebDriverTest implements PostgresOnlyTest -{ - private static final String LIMITED_USER = "limited@advancedimport.test"; - - protected static final File IMPORT_STUDY_FILE = TestFileUtils.getSampleData("AdvancedImportOptions/AdvancedImportStudyProject01.folder.zip"); - private static final String IMPORT_PROJECT_FILE01 = "Advanced Import By File"; - private static final String IMPORT_PROJECT_FILE02 = "Advanced Import By File With Filters"; - private static final String IMPORT_PROJECT_FILE03 = "Advanced Import By Pipeline With Filters"; - - protected static final String IMPORT_PROJECT_MULTI = "Advanced Import to Multiple Folders"; - private static final String IMPORT_FOLDER_MULTI01 = "Advance Import Folder 01"; - private static final String IMPORT_FOLDER_MULTI02 = "Advance Import Folder 02"; - private static final String IMPORT_FOLDER_MULTI03 = "Advance Import Folder 03"; - private static final String IMPORTED_SUB_FOLDER_NAME = "Advanced Import Subfolder"; - - private static final int IMPORT_WAIT_TIME = 60 * 1000; // This should be a limit of 1 minute. - private static final boolean EXPECTED_IMPORT_ERRORS = false; - private static final int EXPECTED_COMPLETED_IMPORT_JOBS = 1; - private static final int EXPECTED_COMPLETED_MULTI_FOLDER_JOBS = 2; - - @Override - public List getAssociatedModules() - { - return Arrays.asList("study"); - } - - @Override - protected String getProjectName() - { - return null; - } - - @Override - protected BrowserType bestBrowser() - { - return BrowserType.CHROME; - } - - @Override - public void doCleanup(boolean afterTest) throws TestTimeoutException - { - // Don't care about afterTest, always send false because I don't care (want to fail) if the project is not there. - _containerHelper.deleteProject(IMPORT_PROJECT_FILE01, false); - _containerHelper.deleteProject(IMPORT_PROJECT_FILE02, false); - _containerHelper.deleteProject(IMPORT_PROJECT_FILE03, false); - _containerHelper.deleteProject(IMPORT_PROJECT_MULTI, false); - - _userHelper.deleteUser(LIMITED_USER); - } - - // This test class has no @Before or @BeforeClass. Each of the test cases, creates its own project to be used for importing. - - @Test - public void testBasicImportFromFile() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE01, "Study"); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, true); - importPage.setSelectSpecificImportOptions(true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE01); - validateFileImportResults(); - } - - private void validateFileImportResults() - { - log("Validate that the expected data has been imported."); - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertEquals(1, assayScheduleWebpart.getAssayRowCount()); - assertEquals("Name is Assay01", assayScheduleWebpart.getAssayCellDisplayValue("AssayName", 0)); - assertEquals("Assay01 Configuration", assayScheduleWebpart.getAssayCellDisplayValue("Description", 0)); - assertEquals("This is text in the assay plan (schedule).", assayScheduleWebpart.getAssayPlan()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertEquals(1, immunizationScheduleWebpart.getCohortRowCount()); - assertEquals("Cohort01", immunizationScheduleWebpart.getCohortCellDisplayValue("Label", 0)); - assertEquals("5", immunizationScheduleWebpart.getCohortCellDisplayValue("SubjectCount", 0)); - assertEquals("Treatment01 ?", immunizationScheduleWebpart.getCohortCellDisplayValue("TimePoint01", 0)); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertEquals(3, vaccineDesignWebpart.getImmunogenRowCount()); - assertEquals("Imm001", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 0)); - assertEquals("immType02", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 0)); - assertEquals("Imm003", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 1)); - assertEquals("immType01", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 1)); - assertEquals("Imm002", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 2)); - assertEquals("immType02", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 2)); - assertEquals(1, vaccineDesignWebpart.getAdjuvantRowCount()); - assertEquals("AdjLabel01", vaccineDesignWebpart.getAdjuvantCellDisplayValue("Label", 0)); - } - - @Test - public void testFilteredImportFromFile() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE02); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, true); - importPage.setSelectSpecificImportOptions(true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - boolean chkSet = false; - Map myList = new HashMap<>(); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.AssaySchedule, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.CohortSettings, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.TreatmentData, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.WikisAndTheirAttachments, chkSet); - - log("Uncheck a few of the options."); - importPage.setAdvancedOptionCheckBoxes(myList); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE02); - - log("Validate that the expected data has been imported."); - - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertTrue(assayScheduleWebpart.isEmpty()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertTrue(immunizationScheduleWebpart.isEmpty()); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertTrue(vaccineDesignWebpart.isEmpty()); - - log("Validate that Locations have been imported unchanged."); - clickTab("Manage"); - clickAndWait(Locator.linkWithText("Manage Locations")); - assertTextPresent("Jimmy Neutron Lab", "Dexter's Lab"); - - log("Validate QC State."); - ManageDatasetQCStatesPage manageDatasetQCStatesPage = goToManageStudy().manageDatasetQCStates(); - List expectedStates = Arrays.asList("[none]", "QC State Name 01"); - List states = manageDatasetQCStatesPage.getStateRows().stream().map(QCStateTableRow::getState).collect(Collectors.toList()); - assertEquals("Wrong QC states imported", expectedStates, states); - - log("Validate wiki content are not imported"); - goToProjectHome(IMPORT_PROJECT_FILE02); - assertTextPresent("WikiPage01", "This folder does not currently contain any wiki pages to display."); - assertElementNotPresent(Locator.xpath("//div[@class='labkey-wiki']//p[text() = 'This is a very basic wiki page.']")); - - } - - @Test - public void testFilteredImportFromPipeline() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE03); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromPipeline(this, zipFile, true, true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - boolean chkSet = false; - Map myList = new HashMap<>(); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.AssaySchedule, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.CohortSettings, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.TreatmentData, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.WikisAndTheirAttachments, chkSet); - - log("Uncheck a few of the options."); - importPage.setAdvancedOptionCheckBoxes(myList); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE03); - - log("Validate that the expected data has been imported."); - - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertTrue(assayScheduleWebpart.isEmpty()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertTrue(immunizationScheduleWebpart.isEmpty()); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertTrue(vaccineDesignWebpart.isEmpty()); - - log("Validate that Locations have been imported unchanged."); - clickTab("Manage"); - clickAndWait(Locator.linkWithText("Manage Locations"), WAIT_FOR_PAGE); - assertTextPresent("Jimmy Neutron Lab", "Dexter's Lab"); - - log("Validate QC State."); - ManageDatasetQCStatesPage manageDatasetQCStatesPage = goToManageStudy().manageDatasetQCStates(); - List expectedStates = Arrays.asList("[none]", "QC State Name 01"); - List states = manageDatasetQCStatesPage.getStateRows().stream().map(QCStateTableRow::getState).collect(Collectors.toList()); - assertEquals("Wrong QC states imported", expectedStates, states); - - log("Validate wiki content are not imported"); - goToProjectHome(IMPORT_PROJECT_FILE03); - assertTextPresent("WikiPage01", "This folder does not currently contain any wiki pages to display."); - assertElementNotPresent(Locator.xpath("//div[@class='labkey-wiki']//p[text() = 'This is a very basic wiki page.']")); - - } - - @Test - public void testImportToMultipleFolders() - { - Assume.assumeTrue("Issue 37413: Server becomes unresponsive after importing folder archive to multiple folders", - WebTestHelper.getDatabaseType() != WebTestHelper.DatabaseType.MicrosoftSQLServer); - - File zipFile = IMPORT_STUDY_FILE; - _userHelper.createUser(LIMITED_USER); - - log("Create a new project to import the existing data into multiple folders."); - _containerHelper.createProject(IMPORT_PROJECT_MULTI); - _containerHelper.enableModule(IMPORT_PROJECT_MULTI, "Specimen"); - - log("Create subfolders and setup permissions."); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI01); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI02); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI03); - - ApiPermissionsHelper permissionsHelper = new ApiPermissionsHelper(this); - - log("Setting up permissions for a limited user"); - clickFolder(IMPORT_FOLDER_MULTI01); - permissionsHelper.addMemberToRole(LIMITED_USER, "Folder Administrator", PermissionsHelper.MemberType.user); - clickFolder(IMPORT_FOLDER_MULTI02); - permissionsHelper.addMemberToRole(LIMITED_USER, "Reader", PermissionsHelper.MemberType.user); - clickFolder(IMPORT_FOLDER_MULTI03); - permissionsHelper.addMemberToRole(LIMITED_USER, "Folder Administrator", PermissionsHelper.MemberType.user); - - pushLocation(); - impersonate(LIMITED_USER); - clickFolder(IMPORT_FOLDER_MULTI01); - log("Get to the import page and validate that it looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, false); - importPage.setSelectSpecificImportOptions(true); - importPage.setApplyToMultipleFoldersCheckBox(true); - - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - log("Verify user can import only into folders they have admin access to"); - waitForElement(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI01).notHidden(), 5000); - assertElementNotPresent(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_PROJECT_MULTI)); - assertElementNotPresent(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI02)); - - Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI01).waitForElement(new WebDriverWait(getDriver(), Duration.ofSeconds(5))).click(); - Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI03).waitForElement(new WebDriverWait(getDriver(), Duration.ofSeconds(5))).click(); - - stopImpersonating(); - popLocation(); - - clickFolder(IMPORT_FOLDER_MULTI01); - log("Import into multiple folders from the same template"); - importPage = StartImportPage.startImportFromPipeline(this, zipFile, true, true); - importPage.setSelectSpecificImportOptions(true); - importPage.setAdvancedOptionCheckBoxes(Map.of( - StartImportPage.AdvancedOptionsCheckBoxes.DatasetData, false, - StartImportPage.AdvancedOptionsCheckBoxes.DatasetDefinitions, false, - StartImportPage.AdvancedOptionsCheckBoxes.Specimens, false, - StartImportPage.AdvancedOptionsCheckBoxes.SpecimenSettings, false)); - importPage.setApplyToMultipleFoldersCheckBox(true); - - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - Locator.tagWithClass("span", "x4-tree-node-text").notHidden().withText(IMPORT_FOLDER_MULTI01).waitForElement(shortWait()); - - log("Select sub folders to import into"); - importPage.checkTargetFolders(IMPORT_FOLDER_MULTI01, IMPORT_FOLDER_MULTI03); - - log("Start the import and verify the confirmation dialog"); - importPage.clickStartImport("The import archive will be applied to 2 selected target folders. A separate pipeline import job will be created for each. This action cannot be undone.\n\nWould you like to proceed?"); - - waitForText("Data Pipeline"); - log("Verify the container filter has been set to see multiple import jobs"); - - // if the container filter has been set correctly we should see all 2 pipeline jobs - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_MULTI_FOLDER_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME * EXPECTED_COMPLETED_IMPORT_JOBS); - - log("Validate that the expected data has been imported."); - clickFolder(IMPORT_FOLDER_MULTI01); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI01, false, false, false); - - clickFolder(IMPORT_FOLDER_MULTI03); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI03, false, false, false); - - clickFolder(IMPORT_FOLDER_MULTI02); - log("Import into a single folder"); - importPage = StartImportPage.startImportFromPipeline(this, zipFile, false, true); - importPage.setSelectSpecificImportOptions(true); - importPage.clickStartImport(); - waitForText("Data Pipeline"); - - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - log("Validate that the expected data has been imported and the subfolder has been imported."); - clickFolder(IMPORT_FOLDER_MULTI02); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI02, true, true, true); - } - - public void validateMultiFolderImportResults(String folderName, boolean hasDatasets, boolean hasSpecimens, boolean hasSubfolder) - { - validateFileImportResults(); - - clickTab("Overview"); - if (hasDatasets) - { - log("Validate that datasets have been imported"); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "NAbTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "FlowTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "LuminexTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "ELISATest")); - } - else - { - log("Validate that no datasets have been imported"); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5001")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5002")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5003")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5004")); - } - - log("Verify specimen import status"); - clickTab("Manage"); - waitForText(hasSpecimens ? "This study uses the advanced specimen repository" : "This study uses the standard specimen repository"); - - log("Verify whether a subfolder should be present"); - WebElement folderTree = projectMenu().expandFolderFully(getCurrentProject(), folderName); - if (hasSubfolder) - assertTrue("project menu should have link for subfolder:" + IMPORTED_SUB_FOLDER_NAME, Locator.linkWithText(IMPORTED_SUB_FOLDER_NAME).existsIn(folderTree)); - else - assertFalse("project menu should not have link for subfolder:" + IMPORTED_SUB_FOLDER_NAME, Locator.linkWithText(IMPORTED_SUB_FOLDER_NAME).existsIn(folderTree)); - } -} From 4c4c25d7f92771cacb042f0c30b622ba2037a59b Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Thu, 23 Oct 2025 13:09:01 -0700 Subject: [PATCH 2/5] Remove Advanced Import Options --- .../dumbster/model/DumbsterManager.java | 94 ++-- .../test/tests/AdvancedImportOptionsTest.java | 436 ------------------ 2 files changed, 47 insertions(+), 483 deletions(-) delete mode 100644 src/org/labkey/test/tests/AdvancedImportOptionsTest.java diff --git a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java index a09ef48136..fe8ba2ed7f 100644 --- a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java +++ b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java @@ -60,53 +60,53 @@ public static void setInstance(DumbsterManager instance) public boolean start() { - if (_server != null && !_server.isStopped()) - { - // We're already running, no need to spin up another, but reset the list of messages - _server.clearEmails(); - return true; - } - - int port; - ServerSocket socket = null; - try - { - socket = new ServerSocket(0); - port = socket.getLocalPort(); - } - catch (IOException e) - { - _log.error("Failed to open a server socket", e); - return false; - } - finally - { - try - { - if (socket != null) - socket.close(); - } - catch (IOException ignored) {} - } - - Properties props = new Properties(); - props.setProperty("mail.smtp.host", "localhost"); - props.setProperty("mail.smtp.user", "Anonymous"); - props.setProperty("mail.smtp.port", Integer.toString(port)); - Session session = Session.getInstance(props); - - _log.info("Switching MailHelper to use port " + port); - MailHelper.setSession(session); - - _log.info("Connecting mail recorder to port " + port); - _server = SimpleSmtpServer.start(port); - if (_server.isStopped()) - { - _log.error("Failed to connect mail recorder. Port " + port + " may be in use."); - _server = null; - return false; - } - ContextListener.addShutdownListener(this); +// if (_server != null && !_server.isStopped()) +// { +// // We're already running, no need to spin up another, but reset the list of messages +// _server.clearEmails(); +// return true; +// } +// +// int port; +// ServerSocket socket = null; +// try +// { +// socket = new ServerSocket(0); +// port = socket.getLocalPort(); +// } +// catch (IOException e) +// { +// _log.error("Failed to open a server socket", e); +// return false; +// } +// finally +// { +// try +// { +// if (socket != null) +// socket.close(); +// } +// catch (IOException ignored) {} +// } +// +// Properties props = new Properties(); +// props.setProperty("mail.smtp.host", "localhost"); +// props.setProperty("mail.smtp.user", "Anonymous"); +// props.setProperty("mail.smtp.port", Integer.toString(port)); +// Session session = Session.getInstance(props); +// +// _log.info("Switching MailHelper to use port " + port); +// MailHelper.setSession(session); +// +// _log.info("Connecting mail recorder to port " + port); +// _server = SimpleSmtpServer.start(port); +// if (_server.isStopped()) +// { +// _log.error("Failed to connect mail recorder. Port " + port + " may be in use."); +// _server = null; +// return false; +// } +// ContextListener.addShutdownListener(this); return true; } diff --git a/src/org/labkey/test/tests/AdvancedImportOptionsTest.java b/src/org/labkey/test/tests/AdvancedImportOptionsTest.java deleted file mode 100644 index d2b914aa4d..0000000000 --- a/src/org/labkey/test/tests/AdvancedImportOptionsTest.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 2016-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.tests; - -import org.junit.Assume; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.TestFileUtils; -import org.labkey.test.TestTimeoutException; -import org.labkey.test.WebTestHelper; -import org.labkey.test.categories.Daily; -import org.labkey.test.components.studydesigner.AssayScheduleWebpart; -import org.labkey.test.components.studydesigner.ImmunizationScheduleWebpart; -import org.labkey.test.components.studydesigner.VaccineDesignWebpart; -import org.labkey.test.pages.StartImportPage; -import org.labkey.test.pages.study.ManageDatasetQCStatesPage; -import org.labkey.test.pages.study.QCStateTableRow; -import org.labkey.test.util.ApiPermissionsHelper; -import org.labkey.test.util.OptionalFeatureHelper; -import org.labkey.test.util.PermissionsHelper; -import org.labkey.test.util.PostgresOnlyTest; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.ui.WebDriverWait; - -import java.io.File; -import java.time.Duration; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.labkey.test.util.PermissionsHelper.FOLDER_ADMIN_ROLE; -import static org.labkey.test.util.PermissionsHelper.READER_ROLE; - -@Category(Daily.class) -@BaseWebDriverTest.ClassTimeout(minutes = 9) -public class AdvancedImportOptionsTest extends BaseWebDriverTest implements PostgresOnlyTest -{ - private static final String LIMITED_USER = "limited@advancedimport.test"; - - protected static final File IMPORT_STUDY_FILE = TestFileUtils.getSampleData("AdvancedImportOptions/AdvancedImportStudyProject01.folder.zip"); - private static final String IMPORT_PROJECT_FILE01 = "Advanced Import By File"; - private static final String IMPORT_PROJECT_FILE02 = "Advanced Import By File With Filters"; - private static final String IMPORT_PROJECT_FILE03 = "Advanced Import By Pipeline With Filters"; - - protected static final String IMPORT_PROJECT_MULTI = "Advanced Import to Multiple Folders"; - private static final String IMPORT_FOLDER_MULTI01 = "Advance Import Folder 01"; - private static final String IMPORT_FOLDER_MULTI02 = "Advance Import Folder 02"; - private static final String IMPORT_FOLDER_MULTI03 = "Advance Import Folder 03"; - private static final String IMPORTED_SUB_FOLDER_NAME = "Advanced Import Subfolder"; - - private static final int IMPORT_WAIT_TIME = 60 * 1000; // This should be a limit of 1 minute. - private static final boolean EXPECTED_IMPORT_ERRORS = false; - private static final int EXPECTED_COMPLETED_IMPORT_JOBS = 1; - private static final int EXPECTED_COMPLETED_MULTI_FOLDER_JOBS = 2; - private Boolean _advancedImportOptionsEnabled; - - @Override - public List getAssociatedModules() - { - return Arrays.asList("study"); - } - - @Override - protected String getProjectName() - { - return null; - } - - @Override - protected BrowserType bestBrowser() - { - return BrowserType.CHROME; - } - - @BeforeClass - public static void doSetup() - { - AdvancedImportOptionsTest test = getCurrentTest(); - test._advancedImportOptionsEnabled = OptionalFeatureHelper.enableOptionalFeature(test.createDefaultConnection(), "advancedImportFlag"); - } - - @Override - public void doCleanup(boolean afterTest) throws TestTimeoutException - { - // Don't care about afterTest, always send false because I don't care (want to fail) if the project is not there. - _containerHelper.deleteProject(IMPORT_PROJECT_FILE01, false); - _containerHelper.deleteProject(IMPORT_PROJECT_FILE02, false); - _containerHelper.deleteProject(IMPORT_PROJECT_FILE03, false); - _containerHelper.deleteProject(IMPORT_PROJECT_MULTI, false); - - if (_advancedImportOptionsEnabled != null) - OptionalFeatureHelper.setOptionalFeature(createDefaultConnection(), "advancedImportFlag", _advancedImportOptionsEnabled); - - _userHelper.deleteUser(LIMITED_USER); - } - - // This test class has no @Before or @BeforeClass. Each of the test cases, creates its own project to be used for importing. - - @Test - public void testBasicImportFromFile() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE01, "Study"); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, true); - importPage.setSelectSpecificImportOptions(true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE01); - validateFileImportResults(); - } - - private void validateFileImportResults() - { - log("Validate that the expected data has been imported."); - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertEquals(1, assayScheduleWebpart.getAssayRowCount()); - assertEquals("Name is Assay01", assayScheduleWebpart.getAssayCellDisplayValue("AssayName", 0)); - assertEquals("Assay01 Configuration", assayScheduleWebpart.getAssayCellDisplayValue("Description", 0)); - assertEquals("This is text in the assay plan (schedule).", assayScheduleWebpart.getAssayPlan()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertEquals(1, immunizationScheduleWebpart.getCohortRowCount()); - assertEquals("Cohort01", immunizationScheduleWebpart.getCohortCellDisplayValue("Label", 0)); - assertEquals("5", immunizationScheduleWebpart.getCohortCellDisplayValue("SubjectCount", 0)); - assertEquals("Treatment01 ?", immunizationScheduleWebpart.getCohortCellDisplayValue("TimePoint01", 0)); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertEquals(3, vaccineDesignWebpart.getImmunogenRowCount()); - assertEquals("Imm001", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 0)); - assertEquals("immType02", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 0)); - assertEquals("Imm003", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 1)); - assertEquals("immType01", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 1)); - assertEquals("Imm002", vaccineDesignWebpart.getImmunogenCellDisplayValue("Label", 2)); - assertEquals("immType02", vaccineDesignWebpart.getImmunogenCellDisplayValue("Type", 2)); - assertEquals(1, vaccineDesignWebpart.getAdjuvantRowCount()); - assertEquals("AdjLabel01", vaccineDesignWebpart.getAdjuvantCellDisplayValue("Label", 0)); - } - - @Test - public void testFilteredImportFromFile() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE02); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, true); - importPage.setSelectSpecificImportOptions(true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - boolean chkSet = false; - Map myList = new HashMap<>(); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.AssaySchedule, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.CohortSettings, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.TreatmentData, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.WikisAndTheirAttachments, chkSet); - - log("Uncheck a few of the options."); - importPage.setAdvancedOptionCheckBoxes(myList); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE02); - - log("Validate that the expected data has been imported."); - - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertTrue(assayScheduleWebpart.isEmpty()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertTrue(immunizationScheduleWebpart.isEmpty()); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertTrue(vaccineDesignWebpart.isEmpty()); - - log("Validate that Locations have been imported unchanged."); - clickTab("Manage"); - clickAndWait(Locator.linkWithText("Manage Locations")); - assertTextPresent("Jimmy Neutron Lab", "Dexter's Lab"); - - log("Validate QC State."); - ManageDatasetQCStatesPage manageDatasetQCStatesPage = goToManageStudy().manageDatasetQCStates(); - List expectedStates = Arrays.asList("[none]", "QC State Name 01"); - List states = manageDatasetQCStatesPage.getStateRows().stream().map(QCStateTableRow::getState).collect(Collectors.toList()); - assertEquals("Wrong QC states imported", expectedStates, states); - - log("Validate wiki content are not imported"); - goToProjectHome(IMPORT_PROJECT_FILE02); - assertTextPresent("WikiPage01", "This folder does not currently contain any wiki pages to display."); - assertElementNotPresent(Locator.xpath("//div[@class='labkey-wiki']//p[text() = 'This is a very basic wiki page.']")); - - } - - @Test - public void testFilteredImportFromPipeline() - { - File zipFile = IMPORT_STUDY_FILE; - - log("Create a new project to import the existing data."); - _containerHelper.createProject(IMPORT_PROJECT_FILE03); - - log("Get to the import page and validate that is looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromPipeline(this, zipFile, true, true); - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - boolean chkSet = false; - Map myList = new HashMap<>(); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.AssaySchedule, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.CohortSettings, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.TreatmentData, chkSet); - myList.put(StartImportPage.AdvancedOptionsCheckBoxes.WikisAndTheirAttachments, chkSet); - - log("Uncheck a few of the options."); - importPage.setAdvancedOptionCheckBoxes(myList); - - log("Start the import"); - importPage.clickStartImport(); - - waitForText("Data Pipeline"); - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - goToProjectHome(IMPORT_PROJECT_FILE03); - - log("Validate that the expected data has been imported."); - - log("Validate assay schedule."); - clickTab("Assays"); - AssayScheduleWebpart assayScheduleWebpart = new AssayScheduleWebpart(getDriver()); - assertTrue(assayScheduleWebpart.isEmpty()); - - log("Validate Immunizations."); - clickTab("Immunizations"); - ImmunizationScheduleWebpart immunizationScheduleWebpart = new ImmunizationScheduleWebpart(getDriver()); - assertTrue(immunizationScheduleWebpart.isEmpty()); - - log("Validate Vaccine Design."); - clickTab("Vaccine Design"); - VaccineDesignWebpart vaccineDesignWebpart = new VaccineDesignWebpart(getDriver()); - assertTrue(vaccineDesignWebpart.isEmpty()); - - log("Validate that Locations have been imported unchanged."); - clickTab("Manage"); - clickAndWait(Locator.linkWithText("Manage Locations"), WAIT_FOR_PAGE); - assertTextPresent("Jimmy Neutron Lab", "Dexter's Lab"); - - log("Validate QC State."); - ManageDatasetQCStatesPage manageDatasetQCStatesPage = goToManageStudy().manageDatasetQCStates(); - List expectedStates = Arrays.asList("[none]", "QC State Name 01"); - List states = manageDatasetQCStatesPage.getStateRows().stream().map(QCStateTableRow::getState).collect(Collectors.toList()); - assertEquals("Wrong QC states imported", expectedStates, states); - - log("Validate wiki content are not imported"); - goToProjectHome(IMPORT_PROJECT_FILE03); - assertTextPresent("WikiPage01", "This folder does not currently contain any wiki pages to display."); - assertElementNotPresent(Locator.xpath("//div[@class='labkey-wiki']//p[text() = 'This is a very basic wiki page.']")); - - } - - @Test - public void testImportToMultipleFolders() - { - Assume.assumeTrue("Issue 37413: Server becomes unresponsive after importing folder archive to multiple folders", - WebTestHelper.getDatabaseType() != WebTestHelper.DatabaseType.MicrosoftSQLServer); - - File zipFile = IMPORT_STUDY_FILE; - _userHelper.createUser(LIMITED_USER); - - log("Create a new project to import the existing data into multiple folders."); - _containerHelper.createProject(IMPORT_PROJECT_MULTI); - _containerHelper.enableModule(IMPORT_PROJECT_MULTI, "Specimen"); - - log("Create subfolders and setup permissions."); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI01); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI02); - _containerHelper.createSubfolder(IMPORT_PROJECT_MULTI, IMPORT_FOLDER_MULTI03); - - ApiPermissionsHelper permissionsHelper = new ApiPermissionsHelper(this); - - log("Setting up permissions for a limited user"); - clickFolder(IMPORT_FOLDER_MULTI01); - permissionsHelper.addMemberToRole(LIMITED_USER, FOLDER_ADMIN_ROLE, PermissionsHelper.MemberType.user); - clickFolder(IMPORT_FOLDER_MULTI02); - permissionsHelper.addMemberToRole(LIMITED_USER, READER_ROLE, PermissionsHelper.MemberType.user); - clickFolder(IMPORT_FOLDER_MULTI03); - permissionsHelper.addMemberToRole(LIMITED_USER, FOLDER_ADMIN_ROLE, PermissionsHelper.MemberType.user); - - pushLocation(); - impersonate(LIMITED_USER); - clickFolder(IMPORT_FOLDER_MULTI01); - log("Get to the import page and validate that it looks as expected."); - StartImportPage importPage = StartImportPage.startImportFromFile(this, zipFile, false); - importPage.setSelectSpecificImportOptions(true); - importPage.setApplyToMultipleFoldersCheckBox(true); - - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - - log("Verify user can import only into folders they have admin access to"); - waitForElement(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI01).notHidden(), 5000); - assertElementNotPresent(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_PROJECT_MULTI)); - assertElementNotPresent(Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI02)); - - Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI01).waitForElement(new WebDriverWait(getDriver(), Duration.ofSeconds(5))).click(); - Locator.tagWithClass("span", "x4-tree-node-text").withText(IMPORT_FOLDER_MULTI03).waitForElement(new WebDriverWait(getDriver(), Duration.ofSeconds(5))).click(); - - stopImpersonating(); - popLocation(); - - clickFolder(IMPORT_FOLDER_MULTI01); - log("Import into multiple folders from the same template"); - importPage = StartImportPage.startImportFromPipeline(this, zipFile, true, true); - importPage.setSelectSpecificImportOptions(true); - importPage.setAdvancedOptionCheckBoxes(Map.of( - StartImportPage.AdvancedOptionsCheckBoxes.DatasetData, false, - StartImportPage.AdvancedOptionsCheckBoxes.DatasetDefinitions, false, - StartImportPage.AdvancedOptionsCheckBoxes.Specimens, false, - StartImportPage.AdvancedOptionsCheckBoxes.SpecimenSettings, false)); - importPage.setApplyToMultipleFoldersCheckBox(true); - - assertTrue("The 'Select specific objects to import' is not visible, and it should be in this case.", importPage.isSelectSpecificImportOptionsVisible()); - Locator.tagWithClass("span", "x4-tree-node-text").notHidden().withText(IMPORT_FOLDER_MULTI01).waitForElement(shortWait()); - - log("Select sub folders to import into"); - importPage.checkTargetFolders(IMPORT_FOLDER_MULTI01, IMPORT_FOLDER_MULTI03); - - log("Start the import and verify the confirmation dialog"); - importPage.clickStartImport("The import archive will be applied to 2 selected target folders. A separate pipeline import job will be created for each. This action cannot be undone.\n\nWould you like to proceed?"); - - waitForText("Data Pipeline"); - log("Verify the container filter has been set to see multiple import jobs"); - - // if the container filter has been set correctly we should see all 2 pipeline jobs - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_MULTI_FOLDER_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME * EXPECTED_COMPLETED_IMPORT_JOBS); - - log("Validate that the expected data has been imported."); - clickFolder(IMPORT_FOLDER_MULTI01); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI01, false, false, false); - - clickFolder(IMPORT_FOLDER_MULTI03); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI03, false, false, false); - - clickFolder(IMPORT_FOLDER_MULTI02); - log("Import into a single folder"); - importPage = StartImportPage.startImportFromPipeline(this, zipFile, false, true); - importPage.setSelectSpecificImportOptions(true); - importPage.clickStartImport(); - waitForText("Data Pipeline"); - - waitForPipelineJobsToComplete(EXPECTED_COMPLETED_IMPORT_JOBS, "Folder import", EXPECTED_IMPORT_ERRORS, IMPORT_WAIT_TIME); - - log("Validate that the expected data has been imported and the subfolder has been imported."); - clickFolder(IMPORT_FOLDER_MULTI02); - validateMultiFolderImportResults(IMPORT_FOLDER_MULTI02, true, true, true); - } - - public void validateMultiFolderImportResults(String folderName, boolean hasDatasets, boolean hasSpecimens, boolean hasSubfolder) - { - validateFileImportResults(); - - clickTab("Overview"); - if (hasDatasets) - { - log("Validate that datasets have been imported"); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "NAbTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "FlowTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "LuminexTest")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "ELISATest")); - } - else - { - log("Validate that no datasets have been imported"); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5001")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5002")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5003")); - waitForElement(Locator.tagWithAttribute("div", "data-qtip", "5004")); - } - - log("Verify specimen import status"); - clickTab("Manage"); - waitForText(hasSpecimens ? "This study uses the advanced specimen repository" : "This study uses the standard specimen repository"); - - log("Verify whether a subfolder should be present"); - WebElement folderTree = projectMenu().expandFolderFully(getCurrentProject(), folderName); - if (hasSubfolder) - assertTrue("project menu should have link for subfolder:" + IMPORTED_SUB_FOLDER_NAME, Locator.linkWithText(IMPORTED_SUB_FOLDER_NAME).existsIn(folderTree)); - else - assertFalse("project menu should not have link for subfolder:" + IMPORTED_SUB_FOLDER_NAME, Locator.linkWithText(IMPORTED_SUB_FOLDER_NAME).existsIn(folderTree)); - } -} From d3fdc8349ad0c06f64aa78dfb5e6806fddf76b65 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Wed, 29 Oct 2025 21:39:35 -0700 Subject: [PATCH 3/5] Remove more references to advancedImportOptions. --- .../labkey/test/pages/StartImportPage.java | 139 ------------------ .../test/pages/admin/ImportFolderPage.java | 1 - 2 files changed, 140 deletions(-) diff --git a/src/org/labkey/test/pages/StartImportPage.java b/src/org/labkey/test/pages/StartImportPage.java index 22928f6a0c..44bf92e2f5 100644 --- a/src/org/labkey/test/pages/StartImportPage.java +++ b/src/org/labkey/test/pages/StartImportPage.java @@ -17,20 +17,13 @@ import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; -import org.labkey.test.components.ext4.Checkbox.CheckboxFinder; -import org.labkey.test.components.ext4.Checkbox.CheckboxType; import org.labkey.test.components.ext4.Window; import org.labkey.test.components.html.Checkbox; import org.labkey.test.util.FileBrowserHelper; -import org.labkey.test.util.LabKeyExpectedConditions; -import org.labkey.test.util.LogMethod; import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import java.io.File; -import java.util.HashMap; -import java.util.Map; import static org.junit.Assert.assertEquals; @@ -50,7 +43,6 @@ public static StartImportPage startImportFromFile(BaseWebDriverTest test, File z StartImportPage sip = new StartImportPage(test.getDriver()); sip.setValidateQueriesCheckBox(validateQueries); - sip.setAdvancedImportOptionsCheckBox(true); test.clickButtonContainingText("Import Folder"); test.waitForText("Select specific objects to import"); @@ -74,7 +66,6 @@ public static StartImportPage startImportFromPipeline(BaseWebDriverTest test, Fi StartImportPage sip = new StartImportPage(test.getDriver()); sip.setValidateQueriesCheckBox(validateQueries); - sip.setSelectSpecificImportOptions(selectSpecificImportOptions); return sip; } @@ -89,43 +80,6 @@ public void setFailForUndefinedVisitsCheckBox(boolean check) elementCache().failForUndefinedVisitsCheckbox.set(check); } - public void setAdvancedImportOptionsCheckBox(boolean check) - { - elementCache().advancedImportOptionsCheckbox.set(check); - } - - public void setSelectSpecificImportOptions(boolean check) - { - elementCache().specificImportOptionsCheckbox.set(check); - shortWait().until(LabKeyExpectedConditions.visibilityOf(elementCache().advancedOptionsPanel, check)); - } - - public void setApplyToMultipleFoldersCheckBox(boolean check) - { - elementCache().applyToMultipleFoldersCheckbox.set(check); - shortWait().until(LabKeyExpectedConditions.visibilityOf(elementCache().applyMultiplePanel, check)); - } - - public void checkTargetFolders(String... folders) - { - for (String folder : folders) - { - WebElement rowEl = Locator.tagWithClass("tr", "x4-grid-row") - .withDescendant(Locator.tagWithClass("span", "x4-tree-node-text").withText(folder)) - .findElement(elementCache().applyMultiplePanel); - shortWait().until(LabKeyExpectedConditions.animationIsDone(rowEl)); - Locator.tag("span").findElement(rowEl).click(); // get row into view - Checkbox checkbox = new CheckboxFinder(CheckboxType.TREE).refindWhenNeeded(rowEl); // Checkbox goes stale sometimes - checkbox.check(); - shortWait().until(ignored -> checkbox.isChecked()); - } - } - - public boolean isMultipleFolderImportAvailable() - { - return elementCache().applyToMultipleFoldersCheckbox.isDisplayed(); - } - public void clickStartImport() { clickButton("Start Import"); @@ -140,35 +94,6 @@ public void clickStartImport(String confirmationText) confirmation.clickButton("Yes"); } - public boolean isSelectSpecificImportOptionsVisible() - { - return isElementVisible(Locator.css("div.advanced-options-panel")); - } - - public void setAdvancedOptionCheckBoxes(AdvancedOptionsCheckBoxes checkBox, boolean check) - { - Map list = new HashMap<>(); - list.put(checkBox, check); - setAdvancedOptionCheckBoxes(list); - } - - @LogMethod() - public void setAdvancedOptionCheckBoxes(Map options) - { - for(Map.Entry entry : options.entrySet()) - { - log("Setting value for checkbox: " + entry.toString()); - elementCache().dataTypesCheckbox(entry.getKey()).set(entry.getValue()); - } - } - - public void setAllAdvancedOptionCheckBoxes(boolean checked) - { - Checkbox.Checkbox(Locator.checkbox()) - .findAll(elementCache().advancedOptionsPanel) - .forEach(cb -> cb.set(checked)); - } - @Override protected ElementCache newElementCache() { @@ -178,13 +103,8 @@ protected ElementCache newElementCache() protected class ElementCache extends LabKeyPage.ElementCache { protected final Checkbox validateQueriesCheckbox = initialCheckbox("validateQueries"); - protected final Checkbox advancedImportOptionsCheckbox = initialCheckbox("advancedImportOptions"); - protected final Checkbox specificImportOptionsCheckbox = initialCheckbox("specificImportOptions"); - protected final Checkbox applyToMultipleFoldersCheckbox = initialCheckbox("applyToMultipleFolders"); protected final Checkbox failForUndefinedVisitsCheckbox = initialCheckbox("failForUndefinedVisits"); - protected final WebElement advancedOptionsPanel = Locator.byClass("advanced-options-panel").findWhenNeeded(this); - protected final WebElement applyMultiplePanel = Locator.byClass("apply-multiple-panel").findWhenNeeded(this); public ElementCache() { @@ -195,64 +115,5 @@ public Checkbox initialCheckbox(String name) { return Checkbox.Checkbox(Locator.input(name)).findWhenNeeded(this); } - - public Checkbox dataTypesCheckbox(AdvancedOptionsCheckBoxes value) - { - return Checkbox.Checkbox(Locator.tagWithAttribute("input", "value", value.getValue())) - .findWhenNeeded(advancedOptionsPanel); - } - } - - public enum AdvancedOptionsCheckBoxes - { - AssaySchedule("Assay Schedule"), - Categories("Categories"), - CohortSettings("Cohort Settings"), - ContainerSpecificModuleProperties("Container specific module properties"), - CustomParticipantView("Custom Participant View"), - CustomViews("Custom Views"), - DatasetData("Dataset Data"), - DatasetDefinitions("Dataset Definitions"), - ExperimentsAndRuns("Experiments, Protocols, and Runs"), - ExternalSchemaDefinitions("External schema definitions"), - FolderTypeAndActiveModules("Folder type and active modules"), - FullTextSearchSettings("Full-text search settings"), - Lists("Lists"), - MissingValueIndicators("Missing value indicators"), - NotificationSettings("Notification settings"), - ParticipantCommentSettings("Participant Comment Settings"), - ParticipantGroups("Participant Groups"), - ProjectLevelGroupsAndMembers("Project-level groups and members"), - ProtocolDocuments("Protocol Documents"), - QCStateSettings("QC State Settings"), - Queries("Queries"), - Reports("Reports"), - RoleAssignmentsForUsersAndGroups("Role assignments for users and groups"), -// Study("Study"), // Study is there but currently not visible. - SpecimenSettings("Specimens"), - Specimens("Specimen Settings"), - TopLevelStudyProperties("Top-level Study Properties"), - TreatmentData("Treatment Data"), - VisitMap("Visit Map"), - WebpartPropertiesAndLayout("Webpart properties and layout"), - WikisAndTheirAttachments("Wikis and their attachments"); - - private final String value; - - AdvancedOptionsCheckBoxes(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - - @Override - public String toString() - { - return value; - } } } diff --git a/src/org/labkey/test/pages/admin/ImportFolderPage.java b/src/org/labkey/test/pages/admin/ImportFolderPage.java index b1b30f69a3..8f8da22c1d 100644 --- a/src/org/labkey/test/pages/admin/ImportFolderPage.java +++ b/src/org/labkey/test/pages/admin/ImportFolderPage.java @@ -126,7 +126,6 @@ protected class ElementCache extends LabKeyPage.ElementCache RadioButton localZipRadio = new RadioButton.RadioButtonFinder().withLabel("Local zip archive").findWhenNeeded(this); RadioButton existingFolderRadio = new RadioButton.RadioButtonFinder().withLabel("Existing folder").findWhenNeeded(this); Checkbox validateQueriesCheckbox = Checkbox.Checkbox(Locator.input("validateQueries")).findWhenNeeded(this); - Checkbox advancedOptionsCheckbox = Checkbox.Checkbox(Locator.input("advancedImportOptions")).findWhenNeeded(this); Checkbox createSharedDatasetsCheckbox = Checkbox.Checkbox(Locator.input("createSharedDatasets")).findWhenNeeded(this); ComboBox sourceFolderCombo = new ComboBox.ComboBoxFinder(getDriver()).withInputNamed("sourceTemplateFolder").findWhenNeeded(this); From 9f54c77ad8e7269d8194e48ff934da4a30a82df2 Mon Sep 17 00:00:00 2001 From: Binal Patel Date: Wed, 29 Oct 2025 21:58:16 -0700 Subject: [PATCH 4/5] Remove 'AdvancedImportOptionsTest' --- data/suites/windowsPg.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/data/suites/windowsPg.txt b/data/suites/windowsPg.txt index 492df28691..68cd543a3c 100644 --- a/data/suites/windowsPg.txt +++ b/data/suites/windowsPg.txt @@ -1,4 +1,3 @@ -AdvancedImportOptionsTest AssayExportImportTest AssayTransformWarningTest AssayTransformImportUpdateTest From f67b970955f48098a7c7c2e83a32c12388276c3a Mon Sep 17 00:00:00 2001 From: labkey-danield Date: Thu, 30 Oct 2025 13:09:36 -0700 Subject: [PATCH 5/5] Reverting code that was commented out from DumbsterManager. --- .../dumbster/model/DumbsterManager.java | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java index fe8ba2ed7f..0e41a0e7a9 100644 --- a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java +++ b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java @@ -60,53 +60,53 @@ public static void setInstance(DumbsterManager instance) public boolean start() { -// if (_server != null && !_server.isStopped()) -// { -// // We're already running, no need to spin up another, but reset the list of messages -// _server.clearEmails(); -// return true; -// } -// -// int port; -// ServerSocket socket = null; -// try -// { -// socket = new ServerSocket(0); -// port = socket.getLocalPort(); -// } -// catch (IOException e) -// { -// _log.error("Failed to open a server socket", e); -// return false; -// } -// finally -// { -// try -// { -// if (socket != null) -// socket.close(); -// } -// catch (IOException ignored) {} -// } -// -// Properties props = new Properties(); -// props.setProperty("mail.smtp.host", "localhost"); -// props.setProperty("mail.smtp.user", "Anonymous"); -// props.setProperty("mail.smtp.port", Integer.toString(port)); -// Session session = Session.getInstance(props); -// -// _log.info("Switching MailHelper to use port " + port); -// MailHelper.setSession(session); -// -// _log.info("Connecting mail recorder to port " + port); -// _server = SimpleSmtpServer.start(port); -// if (_server.isStopped()) -// { -// _log.error("Failed to connect mail recorder. Port " + port + " may be in use."); -// _server = null; -// return false; -// } -// ContextListener.addShutdownListener(this); + if (_server != null && !_server.isStopped()) + { + // We're already running, no need to spin up another, but reset the list of messages + _server.clearEmails(); + return true; + } + + int port; + ServerSocket socket = null; + try + { + socket = new ServerSocket(0); + port = socket.getLocalPort(); + } + catch (IOException e) + { + _log.error("Failed to open a server socket", e); + return false; + } + finally + { + try + { + if (socket != null) + socket.close(); + } + catch (IOException ignored) {} + } + + Properties props = new Properties(); + props.setProperty("mail.smtp.host", "localhost"); + props.setProperty("mail.smtp.user", "Anonymous"); + props.setProperty("mail.smtp.port", Integer.toString(port)); + Session session = Session.getInstance(props); + + _log.info("Switching MailHelper to use port " + port); + MailHelper.setSession(session); + + _log.info("Connecting mail recorder to port " + port); + _server = SimpleSmtpServer.start(port); + if (_server.isStopped()) + { + _log.error("Failed to connect mail recorder. Port " + port + " may be in use."); + _server = null; + return false; + } + ContextListener.addShutdownListener(this); return true; }