From 0237773b62a19c6fee5955255812692ee05ce666 Mon Sep 17 00:00:00 2001 From: pnguyen Date: Thu, 8 Jul 2010 14:50:14 -0700 Subject: [PATCH] [[HHQ-3144] Updated data validation logic for some server config properties --- hqu/hqapi1/app/ServerconfigController.groovy | 9 ++++++--- src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hqu/hqapi1/app/ServerconfigController.groovy b/hqu/hqapi1/app/ServerconfigController.groovy index 7600e440..96562364 100644 --- a/hqu/hqapi1/app/ServerconfigController.groovy +++ b/hqu/hqapi1/app/ServerconfigController.groovy @@ -114,12 +114,15 @@ class ServerconfigController extends ApiController { minVal = 24*oneHourInMillis maxVal = 7*24*oneHourInMillis multiple = 24*oneHourInMillis - } else if (key.equals(HQConstants.DataMaintenance) - || key.equals(HQConstants.AlertPurge) - || key.equals(HQConstants.EventLogPurge)) { + } else if (key.equals(HQConstants.DataMaintenance)) { minVal = oneHourInMillis maxVal = 9999*oneHourInMillis multiple = oneHourInMillis + } else if (key.equals(HQConstants.AlertPurge) + || key.equals(HQConstants.EventLogPurge)) { + minVal = 24*oneHourInMillis + maxVal = 9999*24*oneHourInMillis + multiple = 24*oneHourInMillis } if (minVal && maxVal && multiple) { diff --git a/src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java b/src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java index 3fcf5d6d..5bbe7dfd 100644 --- a/src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java +++ b/src/org/hyperic/hq/hqapi1/test/ServerConfigSet_test.java @@ -132,7 +132,7 @@ public void testSetConfigAtMax() throws Exception { String configName = "ALERT_PURGE"; String serverValue = getConfigValue(configName); - long maxValue = 9999 * 60 * 60 * 1000L; + long maxValue = 9999 * 24 * 60 * 60 * 1000L; ServerConfig c = new ServerConfig(); c.setKey(configName); c.setValue(Long.toString(maxValue)); @@ -171,7 +171,7 @@ public void testSetConfigValidMultiple() throws Exception { String configName = "EVENT_LOG_PURGE"; String serverValue = getConfigValue(configName); - long multipleValue = 50 * 60 * 60 * 1000L; + long multipleValue = 50 * 24 * 60 * 60 * 1000L; ServerConfig c = new ServerConfig(); c.setKey(configName); c.setValue(Long.toString(multipleValue));