Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
itests-2: fix org.rhq.enterprise.server.alert.GroupAlertDefinitionMan…
Browse files Browse the repository at this point in the history
…agerBeanTest.testBug738799

Criteria filters on Oracle cannot be filled with more than 1000 elements
  • Loading branch information
tsegismont committed Jul 24, 2014
1 parent cede4b6 commit 25a6253
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.test.TransactionCallback;
import org.rhq.enterprise.server.test.TransactionCallbackReturnable;
import org.rhq.enterprise.server.util.BatchIterator;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.ResourceTreeHelper;
import org.rhq.enterprise.server.util.SessionTestHelper;
Expand Down Expand Up @@ -93,16 +94,29 @@ protected void beforeMethod() throws Exception {
*/
public void testBug738799() {
List<Integer> childDefIds = getChildrenAlertDefinitionIds(testData.getGroupAlertDefinitionId());

assertEquals(testData.getResources().size(), childDefIds.size());

int modified = alertDefinitionManager.removeAlertDefinitions(testData.getSubject(),
new int[] { testData.getGroupAlertDefinitionId() });

assertEquals(modified, 1);
assertEquals(0, getChildrenAlertDefinitionIds(testData.getGroupAlertDefinitionId()).size());
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterIds(childDefIds.toArray(new Integer[childDefIds.size()]));
List<AlertDefinition> remainingChildDefs = alertDefinitionManager.findAlertDefinitionsByCriteria(
testData.getSubject(), criteria);
assertEquals(0, remainingChildDefs.size());

childDefIds = getChildrenAlertDefinitionIds(testData.getGroupAlertDefinitionId());

assertEquals(0, childDefIds.size());

BatchIterator<Integer> childDefIdsBatchIterator = new BatchIterator<Integer>(childDefIds);
for (List<Integer> childDefIdsBatch : childDefIdsBatchIterator) {

AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterIds(childDefIdsBatch.toArray(new Integer[childDefIdsBatch.size()]));
List<AlertDefinition> remainingChildDefs = alertDefinitionManager.findAlertDefinitionsByCriteria(
testData.getSubject(), criteria);

assertEquals(0, remainingChildDefs.size());

}
}

@Override
Expand Down

0 comments on commit 25a6253

Please sign in to comment.