Search in sources :

Example 11 with IntegrationRQ

use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.

the class IntegrationControllerTest method updateGlobalIntegration.

@Test
void updateGlobalIntegration() throws Exception {
    IntegrationRQ request = new IntegrationRQ();
    Map<String, Object> params = new HashMap<>();
    params.put("param1", "value");
    params.put("param2", "lalala");
    request.setIntegrationParams(params);
    request.setEnabled(true);
    doNothing().when(emailService).testConnection();
    mockMvc.perform(put("/v1/integration/7").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
}
Also used : HashMap(java.util.HashMap) IntegrationRQ(com.epam.ta.reportportal.ws.model.integration.IntegrationRQ) Test(org.junit.jupiter.api.Test) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest)

Example 12 with IntegrationRQ

use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.

the class IntegrationControllerTest method updateGlobalIntegrationNegative.

@Test
void updateGlobalIntegrationNegative() throws Exception {
    IntegrationRQ request = new IntegrationRQ();
    Map<String, Object> params = new HashMap<>();
    params.put("param1", "value");
    params.put("param2", "lalala");
    request.setIntegrationParams(params);
    request.setEnabled(true);
    mockMvc.perform(put("/v1/integration/77").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isNotFound());
}
Also used : HashMap(java.util.HashMap) IntegrationRQ(com.epam.ta.reportportal.ws.model.integration.IntegrationRQ) Test(org.junit.jupiter.api.Test) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest)

Example 13 with IntegrationRQ

use of com.epam.ta.reportportal.ws.model.integration.IntegrationRQ in project service-api by reportportal.

the class IntegrationControllerTest method createGlobalIntegration.

@Test
void createGlobalIntegration() throws Exception {
    IntegrationRQ request = new IntegrationRQ();
    request.setName("email");
    Map<String, Object> params = new HashMap<>();
    params.put("param1", "value");
    params.put("param2", "lalala");
    request.setIntegrationParams(params);
    request.setEnabled(true);
    doNothing().when(emailService).testConnection();
    mockMvc.perform(post("/v1/integration/email").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isCreated());
    mockMvc.perform(post("/v1/integration/email").with(token(oAuthHelper.getSuperadminToken())).contentType(MediaType.APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isConflict());
}
Also used : HashMap(java.util.HashMap) IntegrationRQ(com.epam.ta.reportportal.ws.model.integration.IntegrationRQ) Test(org.junit.jupiter.api.Test) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest)

Aggregations

IntegrationRQ (com.epam.ta.reportportal.ws.model.integration.IntegrationRQ)13 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)10 Test (org.junit.jupiter.api.Test)10 HashMap (java.util.HashMap)9 Integration (com.epam.ta.reportportal.entity.integration.Integration)4 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)2 BusinessRule (com.epam.ta.reportportal.commons.validation.BusinessRule)2 Suppliers (com.epam.ta.reportportal.commons.validation.Suppliers)2 MessageBus (com.epam.ta.reportportal.core.events.MessageBus)2 IntegrationCreatedEvent (com.epam.ta.reportportal.core.events.activity.IntegrationCreatedEvent)2 IntegrationUpdatedEvent (com.epam.ta.reportportal.core.events.activity.IntegrationUpdatedEvent)2 CreateIntegrationHandler (com.epam.ta.reportportal.core.integration.CreateIntegrationHandler)2 IntegrationService (com.epam.ta.reportportal.core.integration.util.IntegrationService)2 IntegrationRepository (com.epam.ta.reportportal.dao.IntegrationRepository)2 IntegrationTypeRepository (com.epam.ta.reportportal.dao.IntegrationTypeRepository)2 ProjectRepository (com.epam.ta.reportportal.dao.ProjectRepository)2 IntegrationType (com.epam.ta.reportportal.entity.integration.IntegrationType)2 Project (com.epam.ta.reportportal.entity.project.Project)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2 TO_ACTIVITY_RESOURCE (com.epam.ta.reportportal.ws.converter.converters.IntegrationConverter.TO_ACTIVITY_RESOURCE)2