use of com.redhat.cloud.notifications.models.BehaviorGroup in project notifications-backend by RedHatInsights.
the class BehaviorGroupRepositoryTest method testAddMultipleEmailSubscriptionBehaviorGroupActions.
@Test
void testAddMultipleEmailSubscriptionBehaviorGroupActions() {
Bundle bundle = resourceHelpers.createBundle();
BehaviorGroup behaviorGroup = resourceHelpers.createBehaviorGroup(DEFAULT_ACCOUNT_ID, "displayName", bundle.getId());
Endpoint endpoint1 = resourceHelpers.createEndpoint(DEFAULT_ACCOUNT_ID, EMAIL_SUBSCRIPTION);
Endpoint endpoint2 = resourceHelpers.createEndpoint(DEFAULT_ACCOUNT_ID, EMAIL_SUBSCRIPTION);
updateAndCheckBehaviorGroupActions(DEFAULT_ACCOUNT_ID, bundle.getId(), behaviorGroup.getId(), OK, endpoint1.getId(), endpoint2.getId());
}
use of com.redhat.cloud.notifications.models.BehaviorGroup in project notifications-backend by RedHatInsights.
the class BehaviorGroupRepositoryTest method testFindBehaviorGroupsByEventTypeId.
@Test
void testFindBehaviorGroupsByEventTypeId() {
Bundle bundle = resourceHelpers.createBundle();
Application app = resourceHelpers.createApplication(bundle.getId());
EventType eventType = createEventType(app);
BehaviorGroup behaviorGroup = resourceHelpers.createBehaviorGroup(DEFAULT_ACCOUNT_ID, "displayName", bundle.getId());
updateAndCheckEventTypeBehaviors(DEFAULT_ACCOUNT_ID, eventType.getId(), true, behaviorGroup.getId());
List<BehaviorGroup> behaviorGroups = resourceHelpers.findBehaviorGroupsByEventTypeId(eventType.getId());
assertEquals(1, behaviorGroups.size());
assertEquals(behaviorGroup.getId(), behaviorGroups.get(0).getId());
}
use of com.redhat.cloud.notifications.models.BehaviorGroup in project notifications-backend by RedHatInsights.
the class NotificationResourceTest method testUpdateUnknownBehaviorGroupId.
@Test
void testUpdateUnknownBehaviorGroupId() {
Header identityHeader = initRbacMock("tenant", "orgId", "user", FULL_ACCESS);
BehaviorGroup behaviorGroup = new BehaviorGroup();
behaviorGroup.setDisplayName("Behavior group");
// Only used for @NotNull validation.
behaviorGroup.setBundleId(UUID.randomUUID());
given().header(identityHeader).contentType(JSON).pathParam("id", UUID.randomUUID()).body(Json.encode(behaviorGroup)).when().put("/notifications/behaviorGroups/{id}").then().statusCode(404);
}
use of com.redhat.cloud.notifications.models.BehaviorGroup in project notifications-backend by RedHatInsights.
the class BehaviorGroupRepositoryTest method testFindEventTypesByBehaviorGroupId.
@Test
void testFindEventTypesByBehaviorGroupId() {
Bundle bundle = resourceHelpers.createBundle();
Application app = resourceHelpers.createApplication(bundle.getId());
EventType eventType = createEventType(app);
BehaviorGroup behaviorGroup = resourceHelpers.createBehaviorGroup(DEFAULT_ACCOUNT_ID, "displayName", bundle.getId());
updateAndCheckEventTypeBehaviors(DEFAULT_ACCOUNT_ID, eventType.getId(), true, behaviorGroup.getId());
List<EventType> eventTypes = resourceHelpers.findEventTypesByBehaviorGroupId(behaviorGroup.getId());
assertEquals(1, eventTypes.size());
assertEquals(eventType.getId(), eventTypes.get(0).getId());
}
use of com.redhat.cloud.notifications.models.BehaviorGroup in project notifications-backend by RedHatInsights.
the class BehaviorGroupRepositoryTest method testUpdateBehaviorGroupActionsWithWrongAccountId.
@Test
void testUpdateBehaviorGroupActionsWithWrongAccountId() {
Bundle bundle = resourceHelpers.createBundle();
BehaviorGroup behaviorGroup = resourceHelpers.createBehaviorGroup(DEFAULT_ACCOUNT_ID, "displayName", bundle.getId());
Endpoint endpoint = resourceHelpers.createEndpoint(DEFAULT_ACCOUNT_ID, WEBHOOK);
updateAndCheckBehaviorGroupActions("unknownAccountId", bundle.getId(), behaviorGroup.getId(), NOT_FOUND, endpoint.getId());
}
Aggregations