}
@Test(enabled = ENABLE_TESTS)
public void testGetResourceGroupAvailabilities() throws Exception {
executeInTransaction(false, new TransactionCallback() {
public void execute() throws Exception {
setupResource();
setupAnotherResource(1, theResource);
setupAnotherResource(2, theResource);
}
});
// Create some various group availability situations:
// T: 0 10000 20000 30000 40000
// R1: UNKNOWN DOWN UP
// R2: UNKNOWN DOWN UP
// R3: UNKNOWN DOWN UP DISABLED
// ----------------------------------------------------------
// AV: WARN DOWN WARN UP DISABLED
final Resource r1 = theResource;
final Resource r2 = additionalResources.get(0);
final Resource r3 = additionalResources.get(1);
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
report.addAvailability(new Availability(r1, 10000L, DOWN));
report.addAvailability(new Availability(r2, 10000L, DOWN));
report.addAvailability(new Availability(r3, 10000L, DOWN));
report.addAvailability(new Availability(r1, 20000L, UP));
report.addAvailability(new Availability(r2, 20000L, UP));
report.addAvailability(new Availability(r3, 30000L, UP));
report.addAvailability(new Availability(r3, 40000L, DISABLED));
availabilityManager.mergeAvailabilityReport(report);
executeInTransaction(new TransactionCallback() {
public void execute() throws Exception {
// Create the test group
final Subject subject = SessionTestHelper.createNewSubject(em, "testSubject");
final Role roleWithSubject = SessionTestHelper
.createNewRoleForSubject(em, subject, "role with subject");