@Test(expected = IllegalArgumentException.class) public void testSituationanpassatCertificateOnSchemaVersion1() throws Exception { NotificationMessage notificationMessage = new NotificationMessage(INTYGS_ID, LUSE, LocalDateTime.now(), HandelsekodEnum.SKAPAT, LOGISK_ADRESS, "{ }", FragorOchSvar.getEmpty(), null, null, SchemaVersion.VERSION_1, "ref"); Message message = new DefaultMessage(camelContext); message.setBody(notificationMessage); transformer.process(message); verifyNoInteractions(notificationPatientEnricher); }
public void process(Message message) throws ModuleException, IOException, ModuleNotFoundException, TemporaryException { LOG.debug("Receiving message: {}", message.getMessageId()); NotificationMessage notificationMessage = message.getBody(NotificationMessage.class); message.setHeader(NotificationRouteHeaders.LOGISK_ADRESS, notificationMessage.getLogiskAdress()); message.setHeader(NotificationRouteHeaders.INTYGS_ID, notificationMessage.getIntygsId()); message.setHeader(NotificationRouteHeaders.HANDELSE, notificationMessage.getHandelse().value()); if (notificationMessage.getVersion() != null) { message.setHeader(NotificationRouteHeaders.VERSION, notificationMessage.getVersion().name()); } else { LOG.warn("Recieved notificationMessage with unknown VERSION header, forcing V3"); message.setHeader(NotificationRouteHeaders.VERSION, SchemaVersion.VERSION_3.name()); } if (SchemaVersion.VERSION_3.equals(notificationMessage.getVersion())) { String intygTypeVersion = resolveIntygTypeVersion(notificationMessage.getIntygsTyp(), message, notificationMessage.getUtkast()); ModuleApi moduleApi = moduleRegistry.getModuleApi(notificationMessage.getIntygsTyp(), intygTypeVersion); Utlatande utlatande = moduleApi.getUtlatandeFromJson(notificationMessage.getUtkast()); Intyg intyg = moduleApi.getIntygFromUtlatande(utlatande); notificationPatientEnricher.enrichWithPatient(intyg); message.setBody(NotificationTypeConverter.convert(notificationMessage, intyg)); } else { throw new IllegalArgumentException("Unsupported combination of version '" + notificationMessage.getVersion() + "' and type '" + notificationMessage.getIntygsTyp() + "'"); } }
NotificationTransformer { public void process(Message message) throws ModuleException, IOException, ModuleNotFoundException, TemporaryException { LOG.debug("Receiving message: {}", message.getMessageId()); NotificationMessage notificationMessage = message.getBody(NotificationMessage.class); message.setHeader(NotificationRouteHeaders.LOGISK_ADRESS, notificationMessage.getLogiskAdress()); message.setHeader(NotificationRouteHeaders.INTYGS_ID, notificationMessage.getIntygsId()); message.setHeader(NotificationRouteHeaders.HANDELSE, notificationMessage.getHandelse().value()); if (notificationMessage.getVersion() != null) { message.setHeader(NotificationRouteHeaders.VERSION, notificationMessage.getVersion().name()); } else { LOG.warn("Recieved notificationMessage with unknown VERSION header, forcing V3"); message.setHeader(NotificationRouteHeaders.VERSION, SchemaVersion.VERSION_3.name()); } if (SchemaVersion.VERSION_3.equals(notificationMessage.getVersion())) { String intygTypeVersion = resolveIntygTypeVersion(notificationMessage.getIntygsTyp(), message, notificationMessage.getUtkast()); ModuleApi moduleApi = moduleRegistry.getModuleApi(notificationMessage.getIntygsTyp(), intygTypeVersion); Utlatande utlatande = moduleApi.getUtlatandeFromJson(notificationMessage.getUtkast()); Intyg intyg = moduleApi.getIntygFromUtlatande(utlatande); notificationPatientEnricher.enrichWithPatient(intyg); message.setBody(NotificationTypeConverter.convert(notificationMessage, intyg)); } else { throw new IllegalArgumentException("Unsupported combination of version '" + notificationMessage.getVersion() + "' and type '" + notificationMessage.getIntygsTyp() + "'"); } } }
NotificationTransformer { public void process(Message message) throws ModuleException, IOException, ModuleNotFoundException, TemporaryException { LOG.debug("Receiving message: {}", message.getMessageId()); NotificationMessage notificationMessage = message.getBody(NotificationMessage.class); message.setHeader(NotificationRouteHeaders.LOGISK_ADRESS, notificationMessage.getLogiskAdress()); message.setHeader(NotificationRouteHeaders.INTYGS_ID, notificationMessage.getIntygsId()); message.setHeader(NotificationRouteHeaders.HANDELSE, notificationMessage.getHandelse().value()); if (notificationMessage.getVersion() != null) { message.setHeader(NotificationRouteHeaders.VERSION, notificationMessage.getVersion().name()); } else { LOG.warn("Recieved notificationMessage with unknown VERSION header, forcing V3"); message.setHeader(NotificationRouteHeaders.VERSION, SchemaVersion.VERSION_3.name()); } if (SchemaVersion.VERSION_3.equals(notificationMessage.getVersion())) { String intygTypeVersion = resolveIntygTypeVersion(notificationMessage.getIntygsTyp(), message, notificationMessage.getUtkast()); ModuleApi moduleApi = moduleRegistry.getModuleApi(notificationMessage.getIntygsTyp(), intygTypeVersion); Utlatande utlatande = moduleApi.getUtlatandeFromJson(notificationMessage.getUtkast()); Intyg intyg = moduleApi.getIntygFromUtlatande(utlatande); notificationPatientEnricher.enrichWithPatient(intyg); message.setBody(NotificationTypeConverter.convert(notificationMessage, intyg)); } else { throw new IllegalArgumentException("Unsupported combination of version '" + notificationMessage.getVersion() + "' and type '" + notificationMessage.getIntygsTyp() + "'"); } }  }
NotificationTransformer { public void process(Message message) throws ModuleException, IOException, ModuleNotFoundException, TemporaryException { LOG.debug("Receiving message: {}", message.getMessageId()); NotificationMessage notificationMessage = message.getBody(NotificationMessage.class); message.setHeader(NotificationRouteHeaders.LOGISK_ADRESS, notificationMessage.getLogiskAdress()); message.setHeader(NotificationRouteHeaders.INTYGS_ID, notificationMessage.getIntygsId()); message.setHeader(NotificationRouteHeaders.HANDELSE, notificationMessage.getHandelse().value()); if (notificationMessage.getVersion() != null) { message.setHeader(NotificationRouteHeaders.VERSION, notificationMessage.getVersion().name()); } else { LOG.warn("Recieved notificationMessage with unknown VERSION header, forcing V3"); message.setHeader(NotificationRouteHeaders.VERSION, SchemaVersion.VERSION_3.name()); } if (SchemaVersion.VERSION_3.equals(notificationMessage.getVersion())) { String intygTypeVersion = resolveIntygTypeVersion(notificationMessage.getIntygsTyp(), message, notificationMessage.getUtkast()); ModuleApi moduleApi = moduleRegistry.getModuleApi(notificationMessage.getIntygsTyp(), intygTypeVersion); Utlatande utlatande = moduleApi.getUtlatandeFromJson(notificationMessage.getUtkast()); Intyg intyg = moduleApi.getIntygFromUtlatande(utlatande); notificationPatientEnricher.enrichWithPatient(intyg); message.setBody(NotificationTypeConverter.convert(notificationMessage, intyg)); } else { throw new IllegalArgumentException("Unsupported combination of version '" + notificationMessage.getVersion() + "' and type '" + notificationMessage.getIntygsTyp() + "'"); } }  void process(Message message); }
NotificationTransformer { public void process(Message message) throws ModuleException, IOException, ModuleNotFoundException, TemporaryException { LOG.debug("Receiving message: {}", message.getMessageId()); NotificationMessage notificationMessage = message.getBody(NotificationMessage.class); message.setHeader(NotificationRouteHeaders.LOGISK_ADRESS, notificationMessage.getLogiskAdress()); message.setHeader(NotificationRouteHeaders.INTYGS_ID, notificationMessage.getIntygsId()); message.setHeader(NotificationRouteHeaders.HANDELSE, notificationMessage.getHandelse().value()); if (notificationMessage.getVersion() != null) { message.setHeader(NotificationRouteHeaders.VERSION, notificationMessage.getVersion().name()); } else { LOG.warn("Recieved notificationMessage with unknown VERSION header, forcing V3"); message.setHeader(NotificationRouteHeaders.VERSION, SchemaVersion.VERSION_3.name()); } if (SchemaVersion.VERSION_3.equals(notificationMessage.getVersion())) { String intygTypeVersion = resolveIntygTypeVersion(notificationMessage.getIntygsTyp(), message, notificationMessage.getUtkast()); ModuleApi moduleApi = moduleRegistry.getModuleApi(notificationMessage.getIntygsTyp(), intygTypeVersion); Utlatande utlatande = moduleApi.getUtlatandeFromJson(notificationMessage.getUtkast()); Intyg intyg = moduleApi.getIntygFromUtlatande(utlatande); notificationPatientEnricher.enrichWithPatient(intyg); message.setBody(NotificationTypeConverter.convert(notificationMessage, intyg)); } else { throw new IllegalArgumentException("Unsupported combination of version '" + notificationMessage.getVersion() + "' and type '" + notificationMessage.getIntygsTyp() + "'"); } }  void process(Message message);  }