Skip to content

Commit

Permalink
Make updates to initiator test
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgunter committed Oct 24, 2023
1 parent da4f70f commit 87bd3df
Showing 1 changed file with 46 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public void runStartInitiatorTest() throws IOException {
"";

log.info("TEMP: " + initiatorXML);

initiatorXML = initiatorXML.replace("\n", "\\n").replace("\"", "\\\"");
log.info("TEMP: post: " + initiatorXML);

js.executeScript("ace.edit('editorDiv').setValue(\"" + initiatorXML + "\");");

waitForElementID("saveXmlBtn");
Expand All @@ -133,13 +137,6 @@ public void runStartInitiatorTest() throws IOException {

wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("saveConfirmBtn")));

try {
driver.findElement(By.id("xmlErrorMsg"));
log.info("*** FATAL ERROR: New XML failed to parse.");
} catch (org.openqa.selenium.NoSuchElementException e) {
log.info("XML was parsed successfully, no errors found.");
}

wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.id("toggle_repeat_1")));

log.info("Enabling repeat initiator.");
Expand Down Expand Up @@ -257,44 +254,48 @@ public void runCronInitiatorTest() throws IOException {
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("ace.edit('editorDiv').navigateFileEnd();");
js.executeScript("ace.edit('editorDiv').setValue('');");
String initiatorXML = String.join(System.getProperty("line.separator"),
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
"<beans ",
" xmlns=\"http://www.springframework.org/schema/beans\"",
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"",
" xsi:schemaLocation=\"",
" http://www.springframework.org/schema/beans",
" http://www.springframework.org/schema/beans/spring-beans.xsd\">",
"",
" <bean id=\"repeat_1\" class=\"jpl.cws.process.initiation.RepeatingDelayInitiator\">",
" <property name=\"procDefKey\" value=\"test_initiators_page\" />",
" <property name=\"delayBetweenProcesses\" value=\"1000\" />",
" <property name=\"maxRepeats\" value=\"10\" />",
" <property name=\"procVariables\">",
" <map>",
" <entry key=\"variable1\" value=\"foo\"></entry>",
" <entry key=\"variable2\" value=\"bar\"></entry>",
" </map>",
" </property>",
" </bean>",
"",
"",
" <bean id=\"cron_initiator\" class=\"jpl.cws.process.initiation.cron.CronInitiator\">",
" <property name=\"procDefKey\" value=\"test_initiators_page\" />",
" <property name=\"cronExpression\" value=\" 0 0/1 * 1/1 * ? *\" />",
" <property name=\"procVariables\">",
" <map>",
" <entry key=\"variable1\" value=\"foo\"></entry>",
" <entry key=\"variable2\" value=\"bar\"></entry>",
" </map>",
" </property>",
" </bean>",
"",
"</beans>",
"",
"");

aceEditor.sendKeys(initiatorXML.replace(" ", ""));
String initiatorXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<beans \n" +
" xmlns=\"http://www.springframework.org/schema/beans\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"\n" +
" http://www.springframework.org/schema/beans\n" +
" http://www.springframework.org/schema/beans/spring-beans.xsd\">\n" +
"\n" +
" <bean id=\"repeat_1\" class=\"jpl.cws.process.initiation.RepeatingDelayInitiator\">\n" +
" <property name=\"procDefKey\" value=\"test_initiators_page\" />\n" +
" <property name=\"delayBetweenProcesses\" value=\"1000\" />\n" +
" <property name=\"maxRepeats\" value=\"10\" />\n" +
" <property name=\"procVariables\">\n" +
" <map>\n" +
" <entry key=\"variable1\" value=\"foo\"></entry>\n" +
" <entry key=\"variable2\" value=\"bar\"></entry>\n" +
" </map>\n" +
" </property>\n" +
" </bean>\n" +
"\n" +
"\n" +
" <bean id=\"cron_initiator\" class=\"jpl.cws.process.initiation.cron.CronInitiator\">\n" +
" <property name=\"procDefKey\" value=\"test_initiators_page\" />\n" +
" <property name=\"cronExpression\" value=\" 0 0/1 * 1/1 * ? *\" />\n" +
" <property name=\"procVariables\">\n" +
" <map>\n" +
" <entry key=\"variable1\" value=\"foo\"></entry>\n" +
" <entry key=\"variable2\" value=\"bar\"></entry>\n" +
" </map>\n" +
" </property>\n" +
" </bean>\n" +
"\n" +
"</beans>\n" +
"\n" +
"";

log.info("TEMP: " + initiatorXML);

initiatorXML = initiatorXML.replace("\n", "\\n").replace("\"", "\\\"");
log.info("TEMP: post: " + initiatorXML);

js.executeScript("ace.edit('editorDiv').setValue(\"" + initiatorXML + "\");");

waitForElementID("saveXmlBtn");
driver.findElement(By.id("saveXmlBtn")).click();
Expand Down

0 comments on commit 87bd3df

Please sign in to comment.