use of io.quarkus.test.TestTransaction in project notifications-backend by RedHatInsights.
the class DailyEmailAggregationJobTest method shouldProcessOneSubscriptionOnly.
@Test
@TestTransaction
void shouldProcessOneSubscriptionOnly() {
helpers.addEmailAggregation("tenant", "someOrgId", "rhel", "policies", "somePolicyId", "someHostId");
helpers.addEmailAggregation("tenant", "someOrgId", "rhel", "policies", "somePolicyId", "someHostId");
final List<AggregationCommand> emailAggregations = testee.processAggregateEmails(LocalDateTime.now(UTC), new CollectorRegistry());
assertEquals(1, emailAggregations.size());
final AggregationCommand aggregationCommand = emailAggregations.get(0);
assertEquals("tenant", aggregationCommand.getAggregationKey().getAccountId());
assertEquals("someOrgId", aggregationCommand.getAggregationKey().getOrgId());
assertEquals("rhel", aggregationCommand.getAggregationKey().getBundle());
assertEquals("policies", aggregationCommand.getAggregationKey().getApplication());
assertEquals(DAILY, aggregationCommand.getSubscriptionType());
}
use of io.quarkus.test.TestTransaction in project notifications-backend by RedHatInsights.
the class DailyEmailAggregationJobTest method shouldNotIncreaseAggregationsWhenHostIdIsDifferent.
@Test
@TestTransaction
void shouldNotIncreaseAggregationsWhenHostIdIsDifferent() {
helpers.addEmailAggregation("someTenant", "someOrgId", "someRhel", "somePolicies", "somePolicyId", "hostId1");
helpers.addEmailAggregation("someTenant", "someOrgId", "someRhel", "somePolicies", "somePolicyId", "hostId2");
final List<AggregationCommand> emailAggregations = testee.processAggregateEmails(LocalDateTime.now(UTC), new CollectorRegistry());
assertEquals(1, emailAggregations.size());
}
use of io.quarkus.test.TestTransaction in project notifications-backend by RedHatInsights.
the class DailyEmailAggregationJobTest method shouldProcessFourSubscriptions.
@Test
@TestTransaction
void shouldProcessFourSubscriptions() {
helpers.addEmailAggregation("tenant", "someOrgId", "rhel", "policies", "somePolicyId", "someHostId");
helpers.addEmailAggregation("tenant", "someOrgId", "rhel", "unknown-application", "somePolicyId", "someHostId");
helpers.addEmailAggregation("tenant", "someOrgId", "unknown-bundle", "policies", "somePolicyId", "someHostId");
helpers.addEmailAggregation("tenant", "someOrgId", "unknown-bundle", "unknown-application", "somePolicyId", "someHostId");
final List<AggregationCommand> emailAggregations = testee.processAggregateEmails(LocalDateTime.now(UTC), new CollectorRegistry());
assertEquals(4, emailAggregations.size());
}
use of io.quarkus.test.TestTransaction in project notifications-backend by RedHatInsights.
the class DailyEmailAggregationJobTest method shouldNotIncreaseAggregationsWhenPolicyIdIsDifferent.
@Test
@TestTransaction
void shouldNotIncreaseAggregationsWhenPolicyIdIsDifferent() {
helpers.addEmailAggregation("someTenant", "someOrgId", "someRhel", "somePolicies", "policyId1", "someHostId");
helpers.addEmailAggregation("someTenant", "someOrgId", "someRhel", "somePolicies", "policyId2", "someHostId");
final List<AggregationCommand> emailAggregations = testee.processAggregateEmails(LocalDateTime.now(UTC), new CollectorRegistry());
assertEquals(1, emailAggregations.size());
}
use of io.quarkus.test.TestTransaction in project notifications-backend by RedHatInsights.
the class DailyEmailAggregationJobTest method shouldProcessZeroAggregations.
@Test
@TestTransaction
void shouldProcessZeroAggregations() {
final List<AggregationCommand> emailAggregations = testee.processAggregateEmails(LocalDateTime.now(UTC), new CollectorRegistry());
assertEquals(0, emailAggregations.size());
}
Aggregations