diff --git a/Viral_Load_Assay/test/src/org/labkey/test/tests/external/labModules/ViralLoadAssayTest.java b/Viral_Load_Assay/test/src/org/labkey/test/tests/external/labModules/ViralLoadAssayTest.java index b77a299ca..1967392c9 100644 --- a/Viral_Load_Assay/test/src/org/labkey/test/tests/external/labModules/ViralLoadAssayTest.java +++ b/Viral_Load_Assay/test/src/org/labkey/test/tests/external/labModules/ViralLoadAssayTest.java @@ -814,6 +814,7 @@ private void importWNPRCResults(String instrument) throws Exception Locator btn = Locator.linkContainingText("Download Example Data"); waitForElement(btn); + Ext4FieldRef.waitForField(this, "Instrument"); assertEquals("Incorrect value for field", instrument, Ext4FieldRef.getForLabel(this, "Instrument").getValue()); assertEquals("Incorrect value for field", Long.valueOf(50), Ext4FieldRef.getForLabel(this, "Eluate Volume").getValue()); assertEquals("Incorrect value for field", Long.valueOf(5), Ext4FieldRef.getForLabel(this, "Sample Vol Per Rxn").getValue()); diff --git a/ehr/src/org/labkey/ehr/EHRServiceImpl.java b/ehr/src/org/labkey/ehr/EHRServiceImpl.java index e5016892e..4b1fe9142 100644 --- a/ehr/src/org/labkey/ehr/EHRServiceImpl.java +++ b/ehr/src/org/labkey/ehr/EHRServiceImpl.java @@ -58,6 +58,8 @@ import org.labkey.api.query.FieldKey; import org.labkey.api.query.QueryService; import org.labkey.api.query.UserSchema; +import org.labkey.api.resource.DirectoryResource; +import org.labkey.api.resource.FileResource; import org.labkey.api.resource.Resource; import org.labkey.api.security.SecurableResource; import org.labkey.api.security.SecurityPolicy; @@ -866,16 +868,29 @@ public void importStudyDefinition(Container container, User user, Module m, Path Resource root = m.getModuleResource(sourceStudyDirPath); PipeRoot pipeRoot = PipelineService.get().findPipelineRoot(container); java.nio.file.Path pipeRootPath = pipeRoot.getRootNioPath(); - java.nio.file.Path studyPath = pipeRootPath.resolve("upgradeStudyImport"); - if (Files.exists(studyPath)) + + java.nio.file.Path studyXmlPath; + + if (root instanceof DirectoryResource && ((DirectoryResource)root).getDir().equals(pipeRootPath.toFile())) + { + // The pipeline root is already pointed at the study definition's folder, like it might be on a dev machine. + // No need to copy, especially since copying can cause infinite recursion when the paths are nested + studyXmlPath = pipeRootPath.resolve("study.xml"); + } + else { - FileUtil.deleteDir(studyPath); + java.nio.file.Path studyPath = pipeRootPath.resolve("moduleStudyImport"); + studyXmlPath = studyPath.resolve("study.xml"); + if (Files.exists(studyPath)) + { + FileUtil.deleteDir(studyPath); + } + copyResourceToPath(root, studyPath); } - copyResourceToPath(root, studyPath); - java.nio.file.Path studyXmlPath = studyPath.resolve("study.xml"); + if (!Files.exists(studyXmlPath)) { - throw new FileNotFoundException("Couldn't find an extracted " + studyPath); + throw new FileNotFoundException("Couldn't find an extracted " + studyXmlPath); } ImportOptions options = new ImportOptions(container.getId(), user.getUserId()); options.setSkipQueryValidation(true); diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 9854ca932..a4d0a7499 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -610,7 +610,7 @@ public void testArrivalForm() throws Exception waitForElement(finalizeOKButton, WAIT_FOR_JAVASCRIPT); click(finalizeOKButton); - waitAndClick(WAIT_FOR_JAVASCRIPT * 2, Ext4Helper.Locators.window("Success").append(Ext4Helper.Locators.ext4Button("No")), WAIT_FOR_PAGE); + waitAndClick(WAIT_FOR_JAVASCRIPT * 5, Ext4Helper.Locators.window("Success").append(Ext4Helper.Locators.ext4Button("No")), WAIT_FOR_PAGE); waitForElement(Locator.tagWithText("a", "Enter New Data")); @@ -1009,7 +1009,7 @@ public void testTreatmentToDrugETL() throws IOException, CommandException log("Creating the Treatment order request"); goToProjectHome(); clickAndWait(Locator.linkWithText("Enter Data / Task Review")); - clickAndWait(Locator.linkWithText("Medications/Diet")); + waitAndClickAndWait(Locator.linkWithText("Medications/Diet")); addTreatmentOrder(animalId, beginDate, endDate, "640991", "ACETAMINOPHEN (80mg) (E-77510)", "BID - AM/Night", "PO", "tablet(s)", 10, "mg");