Skip to content

Commit

Permalink
Rename vars and rewrite message.
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-lau committed Aug 7, 2023
1 parent 6b004a0 commit 7b5d8b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ public ApplicationMonitorConfigXmlDocument(String tool) {
this.tool = tool;
}

public void writeAppMonitorConfigXmlDocument(File serverDirectory, String applicationMonitorValue) throws IOException, TransformerException, ParserConfigurationException, PluginExecutionException {
public void writeAppMonitorConfigXmlDocument(File serverDirectory, String appMonitorTrigger) throws IOException, TransformerException, ParserConfigurationException, PluginExecutionException {
File appMonXml = getAppMonitorConfigXmlFile(serverDirectory);
// if applicationMonitor not set, return
if (applicationMonitorValue == null) {
if (appMonitorTrigger == null) {
if (appMonXml.exists()) {
appMonXml.delete();
}
return;
}
// continue with creating configDropins/override file
if (!APP_MON_VALUE_LIST.contains(applicationMonitorValue)) {
throw new PluginExecutionException("applicationMonitor value \"" + applicationMonitorValue + "\" is not supported. Must be one of: " + APP_MON_VALUE_LIST);
if (!APP_MON_VALUE_LIST.contains(appMonitorTrigger)) {
throw new PluginExecutionException("The appMonitorTrigger value \"" + appMonitorTrigger + "\" is not supported. Please use one of: " + APP_MON_VALUE_LIST);
}
attributes.put("updateTrigger", applicationMonitorValue);
attributes.put("updateTrigger", appMonitorTrigger);

if (!appMonXml.getParentFile().exists()) {
appMonXml.getParentFile().mkdirs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public void createAppMonitorConfigWithInvalidValueTest() throws Exception {
try {
appMonXml.writeAppMonitorConfigXmlDocument(serverDirectory, "asdf");
} catch (Exception e) {
assertTrue(e.getMessage().contains("applicationMonitor value"));
assertTrue(e.getMessage().contains("is not supported"));
assertTrue(e.getMessage().contains("The appMonitorTrigger value \"asdf\" is not supported."));
}
}

Expand Down

0 comments on commit 7b5d8b2

Please sign in to comment.