@Test public void testReceiveAnomalieEnveloppe() throws IOException, JAXBException { given(acteHistoryRepository.findFirstByFileNameContaining(anyString())) .willReturn(Optional.of(new ActeHistory("uuid", StatusType.SENT))); given(acteRepository.findByUuidAndDraftNull(anyString())) .willReturn(Optional.of(acte())); Pair<AnomalieEnveloppe, Attachment> parsedData = parseClassPathResource("data/ANO_EACT--214400152--20180925-1.xml", AnomalieEnveloppe.class); retourPrefectureService.receiveAnomalieEnveloppe(parsedData.getLeft(), parsedData.getRight()); verify(acteHistoryRepository).findFirstByFileNameContaining("214400152--20180925-1.tar.gz"); verify(acteRepository).findByUuidAndDraftNull("uuid"); verify(retourPrefectureService).publishActeHistory(eq("uuid"), eq(StatusType.NACK_RECEIVED), eq(parsedData.getRight()), eq(Optional.of("ODT-VERIF-17 : La transaction que vous avez envoyé n'est pas reconnu dans l'application ACTES.")), eq(Optional.empty())); }
public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) { String[] splited = attachment.getFilename().split("--"); splited = Arrays.copyOfRange(splited, 1, splited.length); String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz"); ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz) .orElseThrow(ActeNotFoundException::new); Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid()) .orElseThrow(ActeNotFoundException::new); publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment, Optional.of(anomalieEnveloppe.getDetail()), Optional.empty()); }
RetourPrefectureService { public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) { String[] splited = attachment.getFilename().split("--"); splited = Arrays.copyOfRange(splited, 1, splited.length); String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz"); ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz) .orElseThrow(ActeNotFoundException::new); Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid()) .orElseThrow(ActeNotFoundException::new); publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment, Optional.of(anomalieEnveloppe.getDetail()), Optional.empty()); } }
RetourPrefectureService { public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) { String[] splited = attachment.getFilename().split("--"); splited = Arrays.copyOfRange(splited, 1, splited.length); String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz"); ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz) .orElseThrow(ActeNotFoundException::new); Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid()) .orElseThrow(ActeNotFoundException::new); publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment, Optional.of(anomalieEnveloppe.getDetail()), Optional.empty()); } RetourPrefectureService(ActeRepository acteRepository, ActeHistoryRepository acteHistoryRepository,
                                   LocalAuthorityRepository localAuthorityRepository, ApplicationEventPublisher applicationEventPublisher, ZipGeneratorUtil zipGeneratorUtil); }
RetourPrefectureService { public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) { String[] splited = attachment.getFilename().split("--"); splited = Arrays.copyOfRange(splited, 1, splited.length); String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz"); ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz) .orElseThrow(ActeNotFoundException::new); Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid()) .orElseThrow(ActeNotFoundException::new); publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment, Optional.of(anomalieEnveloppe.getDetail()), Optional.empty()); } RetourPrefectureService(ActeRepository acteRepository, ActeHistoryRepository acteHistoryRepository,
                                   LocalAuthorityRepository localAuthorityRepository, ApplicationEventPublisher applicationEventPublisher, ZipGeneratorUtil zipGeneratorUtil); void receiveARActe(ARActe arActe, Attachment attachment); void receiveARAnnulation(ARAnnulation arAnnulation, Attachment attachment); void receiveAnomalieActe(EnveloppeMISILLCL enveloppeMISILLCL, AnomalieActe anomalieActe, Attachment attachment); void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment); void receiveCourrierSimple(CourrierSimple courrierSimple, Attachment attachment); void receiveDemandePieceComplementaire(DemandePieceComplementaire demandePieceComplementaire, Attachment attachment); void receiveLettreObservations(LettreObservations lettreObservations, Attachment attachment); void receiveDefere(DefereTA defereTA, List<Attachment> attachments); void receiveARPieceComplementaire(ARReponseCL arReponseCL, Attachment attachment); void receiveARReponseRejetLettreObservations(ARReponseCL arReponseCL, Attachment attachment); }
RetourPrefectureService { public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) { String[] splited = attachment.getFilename().split("--"); splited = Arrays.copyOfRange(splited, 1, splited.length); String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz"); ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz) .orElseThrow(ActeNotFoundException::new); Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid()) .orElseThrow(ActeNotFoundException::new); publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment, Optional.of(anomalieEnveloppe.getDetail()), Optional.empty()); } RetourPrefectureService(ActeRepository acteRepository, ActeHistoryRepository acteHistoryRepository,
                                   LocalAuthorityRepository localAuthorityRepository, ApplicationEventPublisher applicationEventPublisher, ZipGeneratorUtil zipGeneratorUtil); void receiveARActe(ARActe arActe, Attachment attachment); void receiveARAnnulation(ARAnnulation arAnnulation, Attachment attachment); void receiveAnomalieActe(EnveloppeMISILLCL enveloppeMISILLCL, AnomalieActe anomalieActe, Attachment attachment); void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment); void receiveCourrierSimple(CourrierSimple courrierSimple, Attachment attachment); void receiveDemandePieceComplementaire(DemandePieceComplementaire demandePieceComplementaire, Attachment attachment); void receiveLettreObservations(LettreObservations lettreObservations, Attachment attachment); void receiveDefere(DefereTA defereTA, List<Attachment> attachments); void receiveARPieceComplementaire(ARReponseCL arReponseCL, Attachment attachment); void receiveARReponseRejetLettreObservations(ARReponseCL arReponseCL, Attachment attachment);  }