Steps to Reproduce: rhqadmin.209.93:7780$ var c1 = new AlertDefinitionCriteria() rhqadmin.209.93:7780$ c1.addFilterAlertTemplateParentId(<someId>) rhqadmin.209.93:7780$ AlertDefinitionManager.findAlertDefinitionsByCriteria(c1) Expected results: Filters the results by those alert definitions that were automatically created from an alert template with id = <someId> Actual results: [Warning] javax.ejb.EJBException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer Additional info: This bug manifested itself through the CLI, though it would affect any other use of this particular criteria object.
commit 303467aeda8d90b48cb68581d53211c774a82fd5 fix for ClassCastException when using AlertDefinitionCriteria when filtering by either alertTemplateParentId or alertTemplateResourceTypeId
I tried this out on Build# 166 Version: 2.4 SNAPSHOT. I don't seem to get any output. I'm not seeing any error though. Below is what I did. 1. Created a new alert template at platform level Linux. 2. Ran the below SQL query to identify the ID template1=# select id,description from rhq_alert_definition; id | description -------+---------------------------------- 10001 | Group alert for linux group type 10011 | Alert for an event 10021 | Platform event alert 10031 | linux alert template 10032 | linux alert template 10033 | linux alert template (6 rows) 3. Installed the CLI and ran the below commands, [root@dhcp6-150 bin]# ./rhq-cli.sh -u rhqadmin -P -s dhcp6-150.pnq.redhat.com -t 7080 password: RHQ - RHQ Enterprise Remote CLI 3.0.0-SNAPSHOT Remote server version is: 3.0.0-SNAPSHOT(53d34d5) Login successful rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria() rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10031) rhqadmin.redhat.com:7080$ rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria() rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10032) rhqadmin.redhat.com:7080$ rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria() rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10033) rhqadmin.redhat.com:7080$ rhqadmin.redhat.com:7080$ I tried with all the other IDs too, but no output.
please re-read the reproduction steps. you missing the line where it said to execute "AlertDefinitionManager.findAlertDefinitionsByCriteria(c1)"
Ah, my fault. I retried and below is the output. rhqadmin.redhat.com:7080$ var c1 = new AlertDefinitionCriteria() rhqadmin.redhat.com:7080$ c1.addFilterAlertTemplateParentId(10001) rhqadmin.redhat.com:7080$ AlertDefinitionManager.findAlertDefinitionsByCriteria(c1) one row AlertDefinition: alertDampening: org.rhq.core.domain.alert.AlertDampening[ category=NONE[] ] conditionExpression: ANY context: Resource controlFiltered: false ctime: 1275046299710 deleted: false description: Linux alert template enabled: true id: 10002 mtime: 1275046299710 name: Linux System Load Alert notifyFiltered: false parentId: 10001 priority: !! - Medium readOnly: false recoveryId: 0 resource: Resource[id=10001, type=Linux, key=dhcp6-150.pnq.redhat.com-embedded, name=dhcp6-150.pnq.redhat.com-embedded, parent=<null>, version=Linux 2.6.18-164.11.1.el5] willRecover: false Marking this bug as verified.
Mass-closure of verified bugs against JON.