Search in sources :

Example 1 with ExpectationResponseCallback

use of org.mockserver.mock.action.ExpectationResponseCallback in project notifications-backend by RedHatInsights.

the class EmailTest method testEmailSubscriptionInstantWrongPayload.

@Test
@Disabled
void testEmailSubscriptionInstantWrongPayload() {
    mockGetUsers(8);
    final String tenant = "instant-email-tenant-wrong-payload";
    final String[] usernames = { "username-1", "username-2", "username-4" };
    String bundle = "rhel";
    String application = "policies";
    for (String username : usernames) {
        subscribe(tenant, username, bundle, application);
    }
    final List<String> bodyRequests = new ArrayList<>();
    ExpectationResponseCallback verifyEmptyRequest = req -> {
        assertEquals(BOP_TOKEN, req.getHeader(EmailSender.BOP_APITOKEN_HEADER).get(0));
        assertEquals(BOP_CLIENT_ID, req.getHeader(EmailSender.BOP_CLIENT_ID_HEADER).get(0));
        assertEquals(BOP_ENV, req.getHeader(EmailSender.BOP_ENV_HEADER).get(0));
        bodyRequests.add(req.getBodyAsString());
        return response().withStatusCode(200);
    };
    HttpRequest postReq = getMockHttpRequest(verifyEmptyRequest);
    Action emailActionMessage = new Action();
    emailActionMessage.setBundle(bundle);
    emailActionMessage.setApplication(application);
    emailActionMessage.setTimestamp(LocalDateTime.of(2020, 10, 3, 15, 22, 13, 25));
    emailActionMessage.setEventType(TestHelpers.eventType);
    emailActionMessage.setRecipients(List.of());
    emailActionMessage.setContext(new Context.ContextBuilder().withAdditionalProperty("inventory_id-wrong", "host-01").withAdditionalProperty("system_check_in-wrong", "2020-08-03T15:22:42.199046").withAdditionalProperty("display_name-wrong", "My test machine").withAdditionalProperty("tags-what?", List.of()).build());
    emailActionMessage.setEvents(List.of(new com.redhat.cloud.notifications.ingress.Event.EventBuilder().withMetadata(new Metadata.MetadataBuilder().build()).withPayload(new Payload.PayloadBuilder().withAdditionalProperty("foo", "bar").build()).build()));
    emailActionMessage.setAccountId(tenant);
    Event event = new Event();
    event.setAction(emailActionMessage);
    EmailSubscriptionProperties properties = new EmailSubscriptionProperties();
    Endpoint ep = new Endpoint();
    ep.setType(EndpointType.EMAIL_SUBSCRIPTION);
    ep.setName("positive feeling");
    ep.setDescription("needle in the haystack");
    ep.setEnabled(true);
    ep.setProperties(properties);
    try {
        List<NotificationHistory> historyEntries = statelessSessionFactory.withSession(statelessSession -> {
            return emailProcessor.process(event, List.of(ep));
        });
        // The processor returns a null history value but Multi does not support null values so the resulting Multi is empty.
        assertTrue(historyEntries.isEmpty());
        // No email, invalid payload
        assertEquals(0, bodyRequests.size());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e);
    } finally {
        // Remove expectations
        MockServerLifecycleManager.getClient().clear(postReq);
    }
    clearSubscriptions();
}
Also used : INSTANT(com.redhat.cloud.notifications.models.EmailSubscriptionType.INSTANT) Assertions.fail(org.junit.jupiter.api.Assertions.fail) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Arrays(java.util.Arrays) EmailSubscriptionProperties(com.redhat.cloud.notifications.models.EmailSubscriptionProperties) HttpRequest(org.mockserver.model.HttpRequest) Endpoint(com.redhat.cloud.notifications.models.Endpoint) ITUserResponse(com.redhat.cloud.notifications.recipients.itservice.pojo.response.ITUserResponse) LocalDateTime(java.time.LocalDateTime) Disabled(org.junit.jupiter.api.Disabled) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) MockServerLifecycleManager(com.redhat.cloud.notifications.MockServerLifecycleManager) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) InjectSpy(io.quarkus.test.junit.mockito.InjectSpy) ITUserRequest(com.redhat.cloud.notifications.recipients.itservice.pojo.request.ITUserRequest) Event(com.redhat.cloud.notifications.models.Event) JsonObject(io.vertx.core.json.JsonObject) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Payload(com.redhat.cloud.notifications.ingress.Payload) Context(com.redhat.cloud.notifications.ingress.Context) InjectMock(io.quarkus.test.junit.mockito.InjectMock) RestClient(org.eclipse.microprofile.rest.client.inject.RestClient) Transactional(javax.transaction.Transactional) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) EntityManager(javax.persistence.EntityManager) Collectors(java.util.stream.Collectors) ITUserService(com.redhat.cloud.notifications.recipients.itservice.ITUserService) Test(org.junit.jupiter.api.Test) JsonArray(io.vertx.core.json.JsonArray) Mockito(org.mockito.Mockito) List(java.util.List) Authentication(com.redhat.cloud.notifications.recipients.itservice.pojo.response.Authentication) EndpointType(com.redhat.cloud.notifications.models.EndpointType) StatelessSessionFactory(com.redhat.cloud.notifications.db.StatelessSessionFactory) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) AccountRelationship(com.redhat.cloud.notifications.recipients.itservice.pojo.response.AccountRelationship) TestHelpers(com.redhat.cloud.notifications.TestHelpers) Metadata(com.redhat.cloud.notifications.ingress.Metadata) Action(com.redhat.cloud.notifications.ingress.Action) Comparator(java.util.Comparator) HttpResponse.response(org.mockserver.model.HttpResponse.response) PersonalInformation(com.redhat.cloud.notifications.recipients.itservice.pojo.response.PersonalInformation) HttpRequest(org.mockserver.model.HttpRequest) Action(com.redhat.cloud.notifications.ingress.Action) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) EmailSubscriptionProperties(com.redhat.cloud.notifications.models.EmailSubscriptionProperties) ArrayList(java.util.ArrayList) Endpoint(com.redhat.cloud.notifications.models.Endpoint) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) Event(com.redhat.cloud.notifications.models.Event) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with ExpectationResponseCallback

use of org.mockserver.mock.action.ExpectationResponseCallback in project notifications-backend by RedHatInsights.

the class EmailTest method testEmailSubscriptionInstant.

@Test
@Disabled
void testEmailSubscriptionInstant() {
    mockGetUsers(8);
    final String tenant = "instant-email-tenant";
    final String[] usernames = { "username-1", "username-2", "username-4" };
    String bundle = "rhel";
    String application = "policies";
    for (String username : usernames) {
        subscribe(tenant, username, bundle, application);
    }
    final List<String> bodyRequests = new ArrayList<>();
    ExpectationResponseCallback verifyEmptyRequest = req -> {
        assertEquals(BOP_TOKEN, req.getHeader(EmailSender.BOP_APITOKEN_HEADER).get(0));
        assertEquals(BOP_CLIENT_ID, req.getHeader(EmailSender.BOP_CLIENT_ID_HEADER).get(0));
        assertEquals(BOP_ENV, req.getHeader(EmailSender.BOP_ENV_HEADER).get(0));
        bodyRequests.add(req.getBodyAsString());
        return response().withStatusCode(200);
    };
    HttpRequest postReq = getMockHttpRequest(verifyEmptyRequest);
    Action emailActionMessage = TestHelpers.createPoliciesAction(tenant, bundle, application, "My test machine");
    Event event = new Event();
    event.setAction(emailActionMessage);
    EmailSubscriptionProperties properties = new EmailSubscriptionProperties();
    Endpoint ep = new Endpoint();
    ep.setType(EndpointType.EMAIL_SUBSCRIPTION);
    ep.setName("positive feeling");
    ep.setDescription("needle in the haystack");
    ep.setEnabled(true);
    ep.setProperties(properties);
    try {
        List<NotificationHistory> historyEntries = statelessSessionFactory.withSession(statelessSession -> {
            return emailProcessor.process(event, List.of(ep));
        });
        NotificationHistory history = historyEntries.get(0);
        assertTrue(history.isInvocationResult());
        assertEquals(3, bodyRequests.size());
        List<JsonObject> emailRequests = emailRequestIsOK(bodyRequests, usernames);
        for (int i = 0; i < usernames.length; ++i) {
            JsonObject body = emailRequests.get(i);
            JsonArray emails = body.getJsonArray("emails");
            assertNotNull(emails);
            assertEquals(1, emails.size());
            JsonObject firstEmail = emails.getJsonObject(0);
            JsonArray recipients = firstEmail.getJsonArray("recipients");
            assertEquals(1, recipients.size());
            assertEquals(usernames[i], recipients.getString(0));
            JsonArray bccList = firstEmail.getJsonArray("bccList");
            assertEquals(0, bccList.size());
            String bodyRequest = body.toString();
            assertTrue(bodyRequest.contains(TestHelpers.policyId1), "Body should contain policy id" + TestHelpers.policyId1);
            assertTrue(bodyRequest.contains(TestHelpers.policyName1), "Body should contain policy name" + TestHelpers.policyName1);
            assertTrue(bodyRequest.contains(TestHelpers.policyId2), "Body should contain policy id" + TestHelpers.policyId2);
            assertTrue(bodyRequest.contains(TestHelpers.policyName2), "Body should contain policy name" + TestHelpers.policyName2);
            // Display name
            assertTrue(bodyRequest.contains("My test machine"), "Body should contain the display_name");
            // Formatted date
            assertTrue(bodyRequest.contains("03 Aug 2020 15:22 UTC"));
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e);
    } finally {
        // Remove expectations
        MockServerLifecycleManager.getClient().clear(postReq);
    }
    clearSubscriptions();
}
Also used : INSTANT(com.redhat.cloud.notifications.models.EmailSubscriptionType.INSTANT) Assertions.fail(org.junit.jupiter.api.Assertions.fail) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Arrays(java.util.Arrays) EmailSubscriptionProperties(com.redhat.cloud.notifications.models.EmailSubscriptionProperties) HttpRequest(org.mockserver.model.HttpRequest) Endpoint(com.redhat.cloud.notifications.models.Endpoint) ITUserResponse(com.redhat.cloud.notifications.recipients.itservice.pojo.response.ITUserResponse) LocalDateTime(java.time.LocalDateTime) Disabled(org.junit.jupiter.api.Disabled) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) MockServerLifecycleManager(com.redhat.cloud.notifications.MockServerLifecycleManager) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) InjectSpy(io.quarkus.test.junit.mockito.InjectSpy) ITUserRequest(com.redhat.cloud.notifications.recipients.itservice.pojo.request.ITUserRequest) Event(com.redhat.cloud.notifications.models.Event) JsonObject(io.vertx.core.json.JsonObject) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Payload(com.redhat.cloud.notifications.ingress.Payload) Context(com.redhat.cloud.notifications.ingress.Context) InjectMock(io.quarkus.test.junit.mockito.InjectMock) RestClient(org.eclipse.microprofile.rest.client.inject.RestClient) Transactional(javax.transaction.Transactional) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) EntityManager(javax.persistence.EntityManager) Collectors(java.util.stream.Collectors) ITUserService(com.redhat.cloud.notifications.recipients.itservice.ITUserService) Test(org.junit.jupiter.api.Test) JsonArray(io.vertx.core.json.JsonArray) Mockito(org.mockito.Mockito) List(java.util.List) Authentication(com.redhat.cloud.notifications.recipients.itservice.pojo.response.Authentication) EndpointType(com.redhat.cloud.notifications.models.EndpointType) StatelessSessionFactory(com.redhat.cloud.notifications.db.StatelessSessionFactory) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) AccountRelationship(com.redhat.cloud.notifications.recipients.itservice.pojo.response.AccountRelationship) TestHelpers(com.redhat.cloud.notifications.TestHelpers) Metadata(com.redhat.cloud.notifications.ingress.Metadata) Action(com.redhat.cloud.notifications.ingress.Action) Comparator(java.util.Comparator) HttpResponse.response(org.mockserver.model.HttpResponse.response) PersonalInformation(com.redhat.cloud.notifications.recipients.itservice.pojo.response.PersonalInformation) HttpRequest(org.mockserver.model.HttpRequest) Action(com.redhat.cloud.notifications.ingress.Action) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) EmailSubscriptionProperties(com.redhat.cloud.notifications.models.EmailSubscriptionProperties) ArrayList(java.util.ArrayList) JsonObject(io.vertx.core.json.JsonObject) Endpoint(com.redhat.cloud.notifications.models.Endpoint) JsonArray(io.vertx.core.json.JsonArray) Endpoint(com.redhat.cloud.notifications.models.Endpoint) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) Event(com.redhat.cloud.notifications.models.Event) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 3 with ExpectationResponseCallback

use of org.mockserver.mock.action.ExpectationResponseCallback in project notifications-backend by RedHatInsights.

the class WebhookTest method testRetry.

private void testRetry(boolean shouldSucceedEventually) {
    String url = getMockServerUrl() + "/foobar";
    AtomicInteger callsCounter = new AtomicInteger();
    ExpectationResponseCallback expectationResponseCallback = request -> {
        if (callsCounter.incrementAndGet() == MAX_RETRY_ATTEMPTS && shouldSucceedEventually) {
            return response().withStatusCode(200);
        } else {
            return response().withStatusCode(500);
        }
    };
    HttpRequest mockServerRequest = getMockHttpRequest(expectationResponseCallback);
    try {
        Action action = buildWebhookAction();
        Event event = new Event();
        event.setAction(action);
        Endpoint ep = buildWebhookEndpoint(url);
        List<NotificationHistory> process = webhookTypeProcessor.process(event, List.of(ep));
        NotificationHistory history = process.get(0);
        assertEquals(shouldSucceedEventually, history.isInvocationResult());
        assertEquals(MAX_RETRY_ATTEMPTS, callsCounter.get());
    } finally {
        // Remove expectations
        MockServerLifecycleManager.getClient().clear(mockServerRequest);
    }
}
Also used : Assertions.fail(org.junit.jupiter.api.Assertions.fail) HttpType(com.redhat.cloud.notifications.models.HttpType) HttpRequest(org.mockserver.model.HttpRequest) Endpoint(com.redhat.cloud.notifications.models.Endpoint) WebhookTypeProcessor(com.redhat.cloud.notifications.processors.webhooks.WebhookTypeProcessor) TestLifecycleManager(com.redhat.cloud.notifications.TestLifecycleManager) LocalDateTime(java.time.LocalDateTime) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) MockServerLifecycleManager(com.redhat.cloud.notifications.MockServerLifecycleManager) QuarkusTest(io.quarkus.test.junit.QuarkusTest) ArrayList(java.util.ArrayList) MockServerLifecycleManager.getMockServerUrl(com.redhat.cloud.notifications.MockServerLifecycleManager.getMockServerUrl) Inject(javax.inject.Inject) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Event(com.redhat.cloud.notifications.models.Event) WebhookProperties(com.redhat.cloud.notifications.models.WebhookProperties) JsonObject(io.vertx.core.json.JsonObject) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Payload(com.redhat.cloud.notifications.ingress.Payload) Context(com.redhat.cloud.notifications.ingress.Context) QuarkusTestResource(io.quarkus.test.common.QuarkusTestResource) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) Test(org.junit.jupiter.api.Test) JsonArray(io.vertx.core.json.JsonArray) List(java.util.List) EndpointType(com.redhat.cloud.notifications.models.EndpointType) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Metadata(com.redhat.cloud.notifications.ingress.Metadata) Action(com.redhat.cloud.notifications.ingress.Action) HttpResponse.response(org.mockserver.model.HttpResponse.response) HttpRequest(org.mockserver.model.HttpRequest) Action(com.redhat.cloud.notifications.ingress.Action) Endpoint(com.redhat.cloud.notifications.models.Endpoint) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) Event(com.redhat.cloud.notifications.models.Event)

Example 4 with ExpectationResponseCallback

use of org.mockserver.mock.action.ExpectationResponseCallback in project conquery by bakdata.

the class OIDCMockServer method init.

public void init(Consumer<ClientAndServer> testMappings) {
    // Mock well-known discovery endpoint (this is actually the output of keycloak)
    OIDC_SERVER.when(request().withMethod("GET").withPath(String.format("/realms/%s/.well-known/uma2-configuration", REALM_NAME))).respond(response().withBody(JsonBody.json(new Object() {

        @Getter
        final String issuer = MOCK_SERVER_URL + "/realms/EVA";

        @Getter
        final String authorization_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/protocol/openid-connect/auth";

        @Getter
        final String token_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/protocol/openid-connect/token";

        @Getter
        final String introspection_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/protocol/openid-connect/token/introspect";

        @Getter
        final String end_session_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/protocol/openid-connect/logout";

        @Getter
        final String jwks_uri = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/protocol/openid-connect/certs";

        @Getter
        final String[] grant_types_supported = { "authorization_code", "implicit", "refresh_token", "password", "client_credentials" };

        @Getter
        final String[] response_types_supported = { "code", "none", "id_token", "token", "id_token token", "code id_token", "code token", "code id_token token" };

        @Getter
        final String[] response_modes_supported = { "query", "fragment", "form_post" };

        @Getter
        final String registration_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/clients-registrations/openid-connect";

        @Getter
        final String[] token_endpoint_auth_methods_supported = { "private_key_jwt", "client_secret_basic", "client_secret_post", "tls_client_auth", "client_secret_jwt" };

        @Getter
        final String[] token_endpoint_auth_signing_alg_values_supported = { "PS384", "ES384", "RS384", "HS256", "HS512", "ES256", "RS256", "HS384", "ES512", "PS256", "PS512", "RS512" };

        @Getter
        final String[] scopes_supported = { "openid", "address", "email", "microprofile-jwt", "offline_access", "phone", "profile", "roles", "web-origins" };

        @Getter
        final String resource_registration_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/authz/protection/resource_set";

        @Getter
        final String permission_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/authz/protection/permission";

        @Getter
        final String policy_endpoint = MOCK_SERVER_URL + "/realms/" + REALM_NAME + "/authz/protection/uma-policy";
    })));
    // Register test provided mappings
    testMappings.accept(OIDC_SERVER);
    // At last (so it has the lowest priority): initialize a trap for debugging, that captures all unmapped requests
    OIDC_SERVER.when(request()).respond(new ExpectationResponseCallback() {

        @Override
        public HttpResponse handle(HttpRequest httpRequest) throws Exception {
            log.error("{} on {}\n\t Headers: {}n\tBody {}", httpRequest.getMethod(), httpRequest.getPath(), httpRequest.getHeaderList(), httpRequest.getBodyAsString());
            fail("Trapped because request did not match. See log.");
            return null;
        }
    });
}
Also used : HttpRequest(org.mockserver.model.HttpRequest) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) Getter(lombok.Getter) HttpResponse(org.mockserver.model.HttpResponse)

Example 5 with ExpectationResponseCallback

use of org.mockserver.mock.action.ExpectationResponseCallback in project notifications-backend by RedHatInsights.

the class WebhookTest method testWebhook.

@Test
void testWebhook() {
    String url = getMockServerUrl() + "/foobar";
    final List<String> bodyRequests = new ArrayList<>();
    ExpectationResponseCallback verifyEmptyRequest = req -> {
        bodyRequests.add(req.getBodyAsString());
        return response().withStatusCode(200);
    };
    HttpRequest postReq = getMockHttpRequest(verifyEmptyRequest);
    Action webhookActionMessage = buildWebhookAction();
    Event event = new Event();
    event.setAction(webhookActionMessage);
    Endpoint ep = buildWebhookEndpoint(url);
    try {
        List<NotificationHistory> process = webhookTypeProcessor.process(event, List.of(ep));
        NotificationHistory history = process.get(0);
        assertTrue(history.isInvocationResult());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e);
    } finally {
        // Remove expectations
        MockServerLifecycleManager.getClient().clear(postReq);
    }
    assertEquals(1, bodyRequests.size());
    JsonObject webhookInput = new JsonObject(bodyRequests.get(0));
    assertEquals("mybundle", webhookInput.getString("bundle"));
    assertEquals("WebhookTest", webhookInput.getString("application"));
    assertEquals("testWebhook", webhookInput.getString("event_type"));
    assertEquals("tenant", webhookInput.getString("account_id"));
    JsonObject webhookInputContext = webhookInput.getJsonObject("context");
    assertEquals("more", webhookInputContext.getString("free"));
    assertEquals(1, webhookInputContext.getInteger("format"));
    assertEquals("stuff", webhookInputContext.getString("here"));
    JsonArray webhookInputEvents = webhookInput.getJsonArray("events");
    assertEquals(2, webhookInputEvents.size());
    JsonObject webhookInputPayload1 = webhookInputEvents.getJsonObject(0).getJsonObject("payload");
    assertEquals("thing", webhookInputPayload1.getString("any"));
    assertEquals(1, webhookInputPayload1.getInteger("we"));
    assertEquals("here", webhookInputPayload1.getString("want"));
}
Also used : Assertions.fail(org.junit.jupiter.api.Assertions.fail) HttpType(com.redhat.cloud.notifications.models.HttpType) HttpRequest(org.mockserver.model.HttpRequest) Endpoint(com.redhat.cloud.notifications.models.Endpoint) WebhookTypeProcessor(com.redhat.cloud.notifications.processors.webhooks.WebhookTypeProcessor) TestLifecycleManager(com.redhat.cloud.notifications.TestLifecycleManager) LocalDateTime(java.time.LocalDateTime) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) MockServerLifecycleManager(com.redhat.cloud.notifications.MockServerLifecycleManager) QuarkusTest(io.quarkus.test.junit.QuarkusTest) ArrayList(java.util.ArrayList) MockServerLifecycleManager.getMockServerUrl(com.redhat.cloud.notifications.MockServerLifecycleManager.getMockServerUrl) Inject(javax.inject.Inject) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Event(com.redhat.cloud.notifications.models.Event) WebhookProperties(com.redhat.cloud.notifications.models.WebhookProperties) JsonObject(io.vertx.core.json.JsonObject) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Payload(com.redhat.cloud.notifications.ingress.Payload) Context(com.redhat.cloud.notifications.ingress.Context) QuarkusTestResource(io.quarkus.test.common.QuarkusTestResource) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) Test(org.junit.jupiter.api.Test) JsonArray(io.vertx.core.json.JsonArray) List(java.util.List) EndpointType(com.redhat.cloud.notifications.models.EndpointType) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Metadata(com.redhat.cloud.notifications.ingress.Metadata) Action(com.redhat.cloud.notifications.ingress.Action) HttpResponse.response(org.mockserver.model.HttpResponse.response) HttpRequest(org.mockserver.model.HttpRequest) Action(com.redhat.cloud.notifications.ingress.Action) ExpectationResponseCallback(org.mockserver.mock.action.ExpectationResponseCallback) ArrayList(java.util.ArrayList) JsonObject(io.vertx.core.json.JsonObject) JsonArray(io.vertx.core.json.JsonArray) Endpoint(com.redhat.cloud.notifications.models.Endpoint) NotificationHistory(com.redhat.cloud.notifications.models.NotificationHistory) Event(com.redhat.cloud.notifications.models.Event) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

ExpectationResponseCallback (org.mockserver.mock.action.ExpectationResponseCallback)5 HttpRequest (org.mockserver.model.HttpRequest)5 MockServerLifecycleManager (com.redhat.cloud.notifications.MockServerLifecycleManager)4 Action (com.redhat.cloud.notifications.ingress.Action)4 Context (com.redhat.cloud.notifications.ingress.Context)4 Metadata (com.redhat.cloud.notifications.ingress.Metadata)4 Payload (com.redhat.cloud.notifications.ingress.Payload)4 Endpoint (com.redhat.cloud.notifications.models.Endpoint)4 EndpointType (com.redhat.cloud.notifications.models.EndpointType)4 Event (com.redhat.cloud.notifications.models.Event)4 NotificationHistory (com.redhat.cloud.notifications.models.NotificationHistory)4 JsonArray (io.vertx.core.json.JsonArray)4 JsonObject (io.vertx.core.json.JsonObject)4 LocalDateTime (java.time.LocalDateTime)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Inject (javax.inject.Inject)4 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)4 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)4 Assertions.fail (org.junit.jupiter.api.Assertions.fail)4