@Test public void whenThereAreNoKompletteringar() { when(arendeService.getArendenExternal(INTYG_IDS)).thenReturn(new ArrayList<>()); GetCertificateAdditionsResponseType additions = testee.getCertificateAdditions("", buildRequest()); assertEquals(3, additions.getAdditions().size()); assertEquals(0, additions.getAdditions().get(0).getAddition().size()); assertEquals(0, additions.getAdditions().get(1).getAddition().size()); assertEquals(0, additions.getAdditions().get(2).getAddition().size()); }
@Override @PrometheusTimeMethod public GetCertificateAdditionsResponseType getCertificateAdditions( String logicalAddress, GetCertificateAdditionsType request) { if (isNullOrEmpty(request)) { throw new IllegalArgumentException("Request to GetCertificateType is missing required parameter 'intygs-id'"); } LocalTime start = LocalTime.now(); GetCertificateAdditionsResponseType response = new GetCertificateAdditionsResponseType(); response.getAdditions().addAll(new ArrayList<>()); try { List<IntygId> identifiers = request.getIntygsId().stream() .filter(StreamUtil.distinctByKeys(IIType::getExtension)) .collect(Collectors.toList()); List<String> extensions = identifiers.stream() .map(IIType::getExtension) .collect(Collectors.toList()); List<Arende> arendeList = arendeService.getArendenExternal(extensions); identifiers.forEach(identity -> response.getAdditions().add(buildIntygAdditionsType(identity, arendeList))); LOG.debug("GetCertificateAdditionsResponderImpl: Successfully returned {} arenden in {} seconds", response.getAdditions().stream().map(IntygAdditionsType::getAddition).mapToLong(List::size).sum(), getExecutionTime(start)); response.setResult(ResultCodeType.OK); } catch (Exception e) { LOG.error("GetCertificateAdditionsResponderImpl: Failed returning arenden", e); response.setResult(ResultCodeType.ERROR); } return response; }
GetCertificateAdditionsResponderImpl implements GetCertificateAdditionsResponderInterface { @Override @PrometheusTimeMethod public GetCertificateAdditionsResponseType getCertificateAdditions( String logicalAddress, GetCertificateAdditionsType request) { if (isNullOrEmpty(request)) { throw new IllegalArgumentException("Request to GetCertificateType is missing required parameter 'intygs-id'"); } LocalTime start = LocalTime.now(); GetCertificateAdditionsResponseType response = new GetCertificateAdditionsResponseType(); response.getAdditions().addAll(new ArrayList<>()); try { List<IntygId> identifiers = request.getIntygsId().stream() .filter(StreamUtil.distinctByKeys(IIType::getExtension)) .collect(Collectors.toList()); List<String> extensions = identifiers.stream() .map(IIType::getExtension) .collect(Collectors.toList()); List<Arende> arendeList = arendeService.getArendenExternal(extensions); identifiers.forEach(identity -> response.getAdditions().add(buildIntygAdditionsType(identity, arendeList))); LOG.debug("GetCertificateAdditionsResponderImpl: Successfully returned {} arenden in {} seconds", response.getAdditions().stream().map(IntygAdditionsType::getAddition).mapToLong(List::size).sum(), getExecutionTime(start)); response.setResult(ResultCodeType.OK); } catch (Exception e) { LOG.error("GetCertificateAdditionsResponderImpl: Failed returning arenden", e); response.setResult(ResultCodeType.ERROR); } return response; } }
GetCertificateAdditionsResponderImpl implements GetCertificateAdditionsResponderInterface { @Override @PrometheusTimeMethod public GetCertificateAdditionsResponseType getCertificateAdditions( String logicalAddress, GetCertificateAdditionsType request) { if (isNullOrEmpty(request)) { throw new IllegalArgumentException("Request to GetCertificateType is missing required parameter 'intygs-id'"); } LocalTime start = LocalTime.now(); GetCertificateAdditionsResponseType response = new GetCertificateAdditionsResponseType(); response.getAdditions().addAll(new ArrayList<>()); try { List<IntygId> identifiers = request.getIntygsId().stream() .filter(StreamUtil.distinctByKeys(IIType::getExtension)) .collect(Collectors.toList()); List<String> extensions = identifiers.stream() .map(IIType::getExtension) .collect(Collectors.toList()); List<Arende> arendeList = arendeService.getArendenExternal(extensions); identifiers.forEach(identity -> response.getAdditions().add(buildIntygAdditionsType(identity, arendeList))); LOG.debug("GetCertificateAdditionsResponderImpl: Successfully returned {} arenden in {} seconds", response.getAdditions().stream().map(IntygAdditionsType::getAddition).mapToLong(List::size).sum(), getExecutionTime(start)); response.setResult(ResultCodeType.OK); } catch (Exception e) { LOG.error("GetCertificateAdditionsResponderImpl: Failed returning arenden", e); response.setResult(ResultCodeType.ERROR); } return response; }  }
GetCertificateAdditionsResponderImpl implements GetCertificateAdditionsResponderInterface { @Override @PrometheusTimeMethod public GetCertificateAdditionsResponseType getCertificateAdditions( String logicalAddress, GetCertificateAdditionsType request) { if (isNullOrEmpty(request)) { throw new IllegalArgumentException("Request to GetCertificateType is missing required parameter 'intygs-id'"); } LocalTime start = LocalTime.now(); GetCertificateAdditionsResponseType response = new GetCertificateAdditionsResponseType(); response.getAdditions().addAll(new ArrayList<>()); try { List<IntygId> identifiers = request.getIntygsId().stream() .filter(StreamUtil.distinctByKeys(IIType::getExtension)) .collect(Collectors.toList()); List<String> extensions = identifiers.stream() .map(IIType::getExtension) .collect(Collectors.toList()); List<Arende> arendeList = arendeService.getArendenExternal(extensions); identifiers.forEach(identity -> response.getAdditions().add(buildIntygAdditionsType(identity, arendeList))); LOG.debug("GetCertificateAdditionsResponderImpl: Successfully returned {} arenden in {} seconds", response.getAdditions().stream().map(IntygAdditionsType::getAddition).mapToLong(List::size).sum(), getExecutionTime(start)); response.setResult(ResultCodeType.OK); } catch (Exception e) { LOG.error("GetCertificateAdditionsResponderImpl: Failed returning arenden", e); response.setResult(ResultCodeType.ERROR); } return response; }  @Override @PrometheusTimeMethod GetCertificateAdditionsResponseType getCertificateAdditions(
        String logicalAddress,
        GetCertificateAdditionsType request); }
GetCertificateAdditionsResponderImpl implements GetCertificateAdditionsResponderInterface { @Override @PrometheusTimeMethod public GetCertificateAdditionsResponseType getCertificateAdditions( String logicalAddress, GetCertificateAdditionsType request) { if (isNullOrEmpty(request)) { throw new IllegalArgumentException("Request to GetCertificateType is missing required parameter 'intygs-id'"); } LocalTime start = LocalTime.now(); GetCertificateAdditionsResponseType response = new GetCertificateAdditionsResponseType(); response.getAdditions().addAll(new ArrayList<>()); try { List<IntygId> identifiers = request.getIntygsId().stream() .filter(StreamUtil.distinctByKeys(IIType::getExtension)) .collect(Collectors.toList()); List<String> extensions = identifiers.stream() .map(IIType::getExtension) .collect(Collectors.toList()); List<Arende> arendeList = arendeService.getArendenExternal(extensions); identifiers.forEach(identity -> response.getAdditions().add(buildIntygAdditionsType(identity, arendeList))); LOG.debug("GetCertificateAdditionsResponderImpl: Successfully returned {} arenden in {} seconds", response.getAdditions().stream().map(IntygAdditionsType::getAddition).mapToLong(List::size).sum(), getExecutionTime(start)); response.setResult(ResultCodeType.OK); } catch (Exception e) { LOG.error("GetCertificateAdditionsResponderImpl: Failed returning arenden", e); response.setResult(ResultCodeType.ERROR); } return response; }  @Override @PrometheusTimeMethod GetCertificateAdditionsResponseType getCertificateAdditions(
        String logicalAddress,
        GetCertificateAdditionsType request);  }