java/code/src/com/redhat/rhn/domain/monitoring/Probe.hbm.xml | 8 - java/code/src/com/redhat/rhn/domain/monitoring/Probe.java | 65 +++++++--- java/code/src/com/redhat/rhn/domain/monitoring/suite/test/ProbeSuiteTest.java | 16 +- java/code/src/com/redhat/rhn/domain/monitoring/test/MonitoringFactoryTest.java | 2 java/code/src/com/redhat/rhn/frontend/action/monitoring/test/ProbeSuiteProbeEditActionTest.java | 2 java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/BaseProbeEditAction.java | 2 java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/test/ProbeEditActionTest.java | 2 java/spacewalk-java.spec | 6 rel-eng/packages/spacewalk-java | 2 9 files changed, 71 insertions(+), 34 deletions(-)
New commits: commit 190a80afea2470e27fb7c501cf5fad441947ba97 Author: Tomas Lestach tlestach@redhat.com Date: Wed Feb 1 19:31:25 2012 +0100
Automatic commit of package [spacewalk-java] release [1.7.16-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index 08e7d0a..bcbe752 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -17,7 +17,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.7.15 +Version: 1.7.16 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -555,6 +555,10 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Wed Feb 01 2012 Tomas Lestach tlestach@redhat.com 1.7.16-1 +- convert boolean value when storing it to DB varchar(1) (tlestach@redhat.com) +- do not store DB information into the rhn_config_macro (tlestach@redhat.com) + * Tue Jan 31 2012 Tomas Lestach tlestach@redhat.com 1.7.15-1 - prevent having unsued idle PG transaction/session (tlestach@redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index b63b014..99ff793 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.7.15-1 java/ +1.7.16-1 java/
commit 381cd3d95130ba820e3c056c20ad4abd94b2b292 Author: Tomas Lestach tlestach@redhat.com Date: Wed Feb 1 16:59:22 2012 +0100
convert boolean value when storing it to DB varchar(1)
addressing: ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: value too long for type character(1) ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.DataException: could not insert: [com.redhat.rhn.domain.monitoring.ServerProbe]
diff --git a/java/code/src/com/redhat/rhn/domain/monitoring/Probe.hbm.xml b/java/code/src/com/redhat/rhn/domain/monitoring/Probe.hbm.xml index 5f1b14e..2824023 100644 --- a/java/code/src/com/redhat/rhn/domain/monitoring/Probe.hbm.xml +++ b/java/code/src/com/redhat/rhn/domain/monitoring/Probe.hbm.xml @@ -13,13 +13,13 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" <discriminator column="probe_type" type="java.lang.String" insert="false"/> <property name="description" column="description" not-null="true" type="string" length="255" access="field"/> - <property name="notifyCritical" column="notify_critical" type="boolean" + <property name="notifyCritical" column="notify_critical" type="character" length="1" access="field"/> - <property name="notifyWarning" column="notify_warning" type="boolean" + <property name="notifyWarning" column="notify_warning" type="character" length="1" access="field"/> - <property name="notifyUnknown" column="notify_unknown" type="boolean" + <property name="notifyUnknown" column="notify_unknown" type="character" length="1" access="field"/> - <property name="notifyRecovery" column="notify_recovery" type="boolean" + <property name="notifyRecovery" column="notify_recovery" type="character" length="1" access="field"/> <property name="notificationIntervalMinutes" column="notification_interval_minutes" not-null="true" type="long" diff --git a/java/code/src/com/redhat/rhn/domain/monitoring/Probe.java b/java/code/src/com/redhat/rhn/domain/monitoring/Probe.java index 68f6574..c2cc526 100644 --- a/java/code/src/com/redhat/rhn/domain/monitoring/Probe.java +++ b/java/code/src/com/redhat/rhn/domain/monitoring/Probe.java @@ -23,6 +23,7 @@ import com.redhat.rhn.domain.org.Org; import com.redhat.rhn.domain.user.User;
import org.apache.commons.collections.Transformer; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.builder.ToStringBuilder;
import java.util.Date; @@ -39,10 +40,10 @@ public abstract class Probe implements Identifiable, Comparable { private Long id;
private String description; - private Boolean notifyCritical; - private Boolean notifyWarning; - private Boolean notifyUnknown; - private Boolean notifyRecovery; + private Character notifyCritical; + private Character notifyWarning; + private Character notifyUnknown; + private Character notifyRecovery; private Long notificationIntervalMinutes; private Long checkIntervalMinutes; private Long retryIntervalMinutes; @@ -103,8 +104,8 @@ public abstract class Probe implements Identifiable, Comparable { * Getter for notifyCritical * @return Boolean to get */ - public Boolean getNotifyCritical() { - return this.notifyCritical; + public Boolean isNotifyCritical() { + return this.notifyCritical != null; }
/** @@ -112,6 +113,14 @@ public abstract class Probe implements Identifiable, Comparable { * @param notifyCriticalIn to set */ public void setNotifyCritical(Boolean notifyCriticalIn) { + setNotifyCritical(BooleanUtils.toBoolean(notifyCriticalIn) ? '1' : null); + } + + /** + * Setter for notifyCritical + * @param notifyCriticalIn to set + */ + public void setNotifyCritical(Character notifyCriticalIn) { this.notifyCritical = notifyCriticalIn; }
@@ -119,8 +128,8 @@ public abstract class Probe implements Identifiable, Comparable { * Getter for notifyWarning * @return Boolean to get */ - public Boolean getNotifyWarning() { - return this.notifyWarning; + public Boolean isNotifyWarning() { + return this.notifyWarning != null; }
/** @@ -128,6 +137,14 @@ public abstract class Probe implements Identifiable, Comparable { * @param notifyWarningIn to set */ public void setNotifyWarning(Boolean notifyWarningIn) { + setNotifyWarning(BooleanUtils.toBoolean(notifyWarningIn) ? '1' : null); + } + + /** + * Setter for notifyWarning + * @param notifyWarningIn to set + */ + public void setNotifyWarning(Character notifyWarningIn) { this.notifyWarning = notifyWarningIn; }
@@ -135,8 +152,8 @@ public abstract class Probe implements Identifiable, Comparable { * Getter for notifyUnknown * @return Boolean to get */ - public Boolean getNotifyUnknown() { - return this.notifyUnknown; + public Boolean isNotifyUnknown() { + return this.notifyUnknown != null; }
/** @@ -144,6 +161,14 @@ public abstract class Probe implements Identifiable, Comparable { * @param notifyUnknownIn to set */ public void setNotifyUnknown(Boolean notifyUnknownIn) { + setNotifyUnknown(BooleanUtils.toBoolean(notifyUnknownIn) ? '1' : null); + } + + /** + * Setter for notifyUnknown + * @param notifyUnknownIn to set + */ + public void setNotifyUnknown(Character notifyUnknownIn) { this.notifyUnknown = notifyUnknownIn; }
@@ -151,8 +176,8 @@ public abstract class Probe implements Identifiable, Comparable { * Getter for notifyRecovery * @return Boolean to get */ - public Boolean getNotifyRecovery() { - return this.notifyRecovery; + public Boolean isNotifyRecovery() { + return this.notifyRecovery != null; }
/** @@ -160,6 +185,14 @@ public abstract class Probe implements Identifiable, Comparable { * @param notifyRecoveryIn to set */ public void setNotifyRecovery(Boolean notifyRecoveryIn) { + setNotifyRecovery(BooleanUtils.toBoolean(notifyRecoveryIn) ? '1' : null); + } + + /** + * Setter for notifyRecovery + * @param notifyRecoveryIn to set + */ + public void setNotifyRecovery(Character notifyRecoveryIn) { this.notifyRecovery = notifyRecoveryIn; }
@@ -442,10 +475,10 @@ public abstract class Probe implements Identifiable, Comparable { copied.setDescription(this.getDescription()); copied.setMaxAttempts(this.getMaxAttempts()); copied.setNotificationIntervalMinutes(this.getNotificationIntervalMinutes()); - copied.setNotifyCritical(this.getNotifyCritical()); - copied.setNotifyRecovery(this.getNotifyRecovery()); - copied.setNotifyUnknown(this.getNotifyUnknown()); - copied.setNotifyWarning(this.getNotifyWarning()); + copied.setNotifyCritical(this.isNotifyCritical()); + copied.setNotifyRecovery(this.isNotifyRecovery()); + copied.setNotifyUnknown(this.isNotifyUnknown()); + copied.setNotifyWarning(this.isNotifyWarning()); copied.setRetryIntervalMinutes(this.getRetryIntervalMinutes()); copied.setId(null); copied.setLastUpdateDate(this.getLastUpdateDate()); diff --git a/java/code/src/com/redhat/rhn/domain/monitoring/suite/test/ProbeSuiteTest.java b/java/code/src/com/redhat/rhn/domain/monitoring/suite/test/ProbeSuiteTest.java index 7ef0821..ccb48c4 100644 --- a/java/code/src/com/redhat/rhn/domain/monitoring/suite/test/ProbeSuiteTest.java +++ b/java/code/src/com/redhat/rhn/domain/monitoring/suite/test/ProbeSuiteTest.java @@ -151,10 +151,10 @@ public class ProbeSuiteTest extends BaseTestCaseWithUser { tprobe.setLastUpdateUser("someUserChanged"); tprobe.setMaxAttempts(new Long(7)); tprobe.setNotificationIntervalMinutes(new Long(5150)); - tprobe.setNotifyCritical(new Boolean(!tprobe.getNotifyCritical().booleanValue())); - tprobe.setNotifyRecovery(new Boolean(!tprobe.getNotifyRecovery().booleanValue())); - tprobe.setNotifyUnknown(new Boolean(!tprobe.getNotifyUnknown().booleanValue())); - tprobe.setNotifyWarning(new Boolean(!tprobe.getNotifyWarning().booleanValue())); + tprobe.setNotifyCritical(new Boolean(!tprobe.isNotifyCritical().booleanValue())); + tprobe.setNotifyRecovery(new Boolean(!tprobe.isNotifyRecovery().booleanValue())); + tprobe.setNotifyUnknown(new Boolean(!tprobe.isNotifyUnknown().booleanValue())); + tprobe.setNotifyWarning(new Boolean(!tprobe.isNotifyWarning().booleanValue())); tprobe.setRetryIntervalMinutes(new Long(42));
ProbeParameterValue pval = (ProbeParameterValue) @@ -223,10 +223,10 @@ public class ProbeSuiteTest extends BaseTestCaseWithUser { assertEquals(probeOne.getMaxAttempts(), probeTwo.getMaxAttempts()); assertEquals(probeOne.getNotificationIntervalMinutes(), probeTwo.getNotificationIntervalMinutes()); - assertEquals(probeOne.getNotifyCritical(), probeTwo.getNotifyCritical()); - assertEquals(probeOne.getNotifyRecovery(), probeTwo.getNotifyRecovery()); - assertEquals(probeOne.getNotifyUnknown(), probeTwo.getNotifyUnknown()); - assertEquals(probeOne.getNotifyWarning(), probeTwo.getNotifyWarning()); + assertEquals(probeOne.isNotifyCritical(), probeTwo.isNotifyCritical()); + assertEquals(probeOne.isNotifyRecovery(), probeTwo.isNotifyRecovery()); + assertEquals(probeOne.isNotifyUnknown(), probeTwo.isNotifyUnknown()); + assertEquals(probeOne.isNotifyWarning(), probeTwo.isNotifyWarning()); assertEquals(probeOne.getOrg(), probeTwo.getOrg());
// Create some temporary sets of just the actual diff --git a/java/code/src/com/redhat/rhn/domain/monitoring/test/MonitoringFactoryTest.java b/java/code/src/com/redhat/rhn/domain/monitoring/test/MonitoringFactoryTest.java index 015d61b..eb9c931 100644 --- a/java/code/src/com/redhat/rhn/domain/monitoring/test/MonitoringFactoryTest.java +++ b/java/code/src/com/redhat/rhn/domain/monitoring/test/MonitoringFactoryTest.java @@ -85,7 +85,7 @@ public class MonitoringFactoryTest extends RhnBaseTestCase { probe = MonitoringFactory.lookupProbeByIdAndOrg(probeId, user.getOrg()); assertNotNull(probe.getState()); assertNotNull(probe.getState().getProbe()); - assertFalse(probe.getNotifyCritical().booleanValue()); + assertFalse(probe.isNotifyCritical().booleanValue()); }
public void testProbeLastUpdate() throws Exception { diff --git a/java/code/src/com/redhat/rhn/frontend/action/monitoring/test/ProbeSuiteProbeEditActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/monitoring/test/ProbeSuiteProbeEditActionTest.java index 668b77d..0a6e8fd 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/monitoring/test/ProbeSuiteProbeEditActionTest.java +++ b/java/code/src/com/redhat/rhn/frontend/action/monitoring/test/ProbeSuiteProbeEditActionTest.java @@ -98,7 +98,7 @@ public class ProbeSuiteProbeEditActionTest extends RhnBaseTestCase { assertEquals("success", af.getName());
Probe edited = (Probe) reload(probe); - assertTrue(edited.getNotifyCritical().booleanValue()); + assertTrue(edited.isNotifyCritical().booleanValue()); MonitoringTestUtils.verifyParameters(edited, probe.getCommand()); assertEquals(intv, edited.getCheckIntervalMinutes()); } diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/BaseProbeEditAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/BaseProbeEditAction.java index e6b3c7b..9a1e1b9 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/BaseProbeEditAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/BaseProbeEditAction.java @@ -58,7 +58,7 @@ public abstract class BaseProbeEditAction extends BaseProbeAction { } else { // Initialize the form - form.set(NOTIFICATION, probe.getNotifyCritical()); + form.set(NOTIFICATION, probe.isNotifyCritical()); form.set(DESCR, probe.getDescription()); form.set(NOTIFICATION_INTERVAL_MIN, probe.getNotificationIntervalMinutes()); if (probe.getContactGroup() != null) { diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/test/ProbeEditActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/test/ProbeEditActionTest.java index 616779e..3435e4a 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/test/ProbeEditActionTest.java +++ b/java/code/src/com/redhat/rhn/frontend/action/systems/monitoring/test/ProbeEditActionTest.java @@ -103,7 +103,7 @@ public class ProbeEditActionTest extends RhnBaseTestCase { ServerProbe edited = (ServerProbe) reload(probe); assertPropertyEquals("checkIntervalMinutes", probe, edited); assertPropertyEquals("description", probe, edited); - assertEquals(Boolean.TRUE, edited.getNotifyCritical()); + assertEquals(Boolean.TRUE, edited.isNotifyCritical()); MonitoringTestUtils.verifyParameters(edited, probe.getCommand()); }
spacewalk-commits@lists.fedorahosted.org