use of com.redhat.cloud.notifications.models.BehaviorGroupAction in project notifications-backend by RedHatInsights.
the class LifecycleITest method addBehaviorGroupAction.
@Transactional
void addBehaviorGroupAction(UUID behaviorGroupId, UUID endpointId) {
BehaviorGroup behaviorGroup = entityManager.find(BehaviorGroup.class, behaviorGroupId);
Endpoint endpoint = entityManager.find(Endpoint.class, endpointId);
BehaviorGroupAction action = new BehaviorGroupAction();
action.setId(new BehaviorGroupActionId());
action.setBehaviorGroup(behaviorGroup);
action.setEndpoint(endpoint);
entityManager.persist(action);
}
use of com.redhat.cloud.notifications.models.BehaviorGroupAction in project notifications-backend by RedHatInsights.
the class BehaviorGroupRepositoryTest method updateAndCheckBehaviorGroupActions.
@Transactional
void updateAndCheckBehaviorGroupActions(String accountId, UUID bundleId, UUID behaviorGroupId, Status expectedResult, UUID... endpointIds) {
Status status = behaviorGroupRepository.updateBehaviorGroupActions(accountId, behaviorGroupId, Arrays.asList(endpointIds));
// Is the update result the one we expected?
assertEquals(expectedResult, status);
if (expectedResult == Status.OK) {
// We need to clear the session L1 cache before checking the update result.
entityManager.clear();
// If we expected a success, the behavior group actions should match exactly the given endpoint IDs.
List<BehaviorGroupAction> actions = findBehaviorGroupActions(accountId, bundleId, behaviorGroupId);
assertEquals(endpointIds.length, actions.size());
for (int i = 0; i < endpointIds.length; i++) {
assertEquals(endpointIds[i], actions.get(i).getEndpoint().getId());
}
}
}
Aggregations