Search in sources :

Example 1 with USERNAME

use of com.epam.ta.reportportal.core.integration.util.property.SauceLabsProperties.USERNAME in project service-api by reportportal.

the class SauceLabsIntegrationService method retrieveCreateParams.

@Override
public Map<String, Object> retrieveCreateParams(String integrationType, Map<String, Object> integrationParams) {
    expect(integrationParams, MapUtils::isNotEmpty).verify(BAD_REQUEST_ERROR, "No integration params provided");
    final String encryptedToken = encryptor.encrypt(ACCESS_TOKEN.getParameter(integrationParams).orElseThrow(() -> new ReportPortalException(BAD_REQUEST_ERROR, "Access token value is not specified")));
    final String username = USERNAME.getParameter(integrationParams).orElseThrow(() -> new ReportPortalException(BAD_REQUEST_ERROR, "Username value is not specified"));
    HashMap<String, Object> result = Maps.newHashMapWithExpectedSize(integrationParams.size());
    result.put(ACCESS_TOKEN.getName(), encryptedToken);
    result.put(USERNAME.getName(), username);
    integrationParams.entrySet().stream().filter(it -> !it.getKey().equals(ACCESS_TOKEN.getName()) && !it.getKey().equals(USERNAME.getName())).forEach(it -> result.put(it.getKey(), it.getValue()));
    return result;
}
Also used : MapUtils(org.apache.commons.collections4.MapUtils) BusinessRule.expect(com.epam.ta.reportportal.commons.validation.BusinessRule.expect) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) BasicTextEncryptor(org.jasypt.util.text.BasicTextEncryptor) Maps(com.google.common.collect.Maps) PluginBox(com.epam.ta.reportportal.core.plugin.PluginBox) USERNAME(com.epam.ta.reportportal.core.integration.util.property.SauceLabsProperties.USERNAME) Service(org.springframework.stereotype.Service) Map(java.util.Map) ACCESS_TOKEN(com.epam.ta.reportportal.core.integration.util.property.SauceLabsProperties.ACCESS_TOKEN) BAD_REQUEST_ERROR(com.epam.ta.reportportal.ws.model.ErrorType.BAD_REQUEST_ERROR) IntegrationRepository(com.epam.ta.reportportal.dao.IntegrationRepository) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException)

Aggregations

BusinessRule.expect (com.epam.ta.reportportal.commons.validation.BusinessRule.expect)1 ACCESS_TOKEN (com.epam.ta.reportportal.core.integration.util.property.SauceLabsProperties.ACCESS_TOKEN)1 USERNAME (com.epam.ta.reportportal.core.integration.util.property.SauceLabsProperties.USERNAME)1 PluginBox (com.epam.ta.reportportal.core.plugin.PluginBox)1 IntegrationRepository (com.epam.ta.reportportal.dao.IntegrationRepository)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 BAD_REQUEST_ERROR (com.epam.ta.reportportal.ws.model.ErrorType.BAD_REQUEST_ERROR)1 Maps (com.google.common.collect.Maps)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MapUtils (org.apache.commons.collections4.MapUtils)1 BasicTextEncryptor (org.jasypt.util.text.BasicTextEncryptor)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1