@Test public void testNoVariants() { countDownLatch = new CountDownLatch(1); assertTrue("variants are empty", app.getVariants().isEmpty()); router.submit(app, message); assertEquals(variants(), variantTypeHolder.getVariantTypes()); }
@TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCriteria().getVariants(); if (variantIDs != null) { variantIDs.forEach(variantID -> { Variant variant = genericVariantService.get().findByVariantID(variantID); if (variant != null) { variants.add(variant); } }); } else { variants.addAll(pushApplication.getVariants()); } String jsonMessageContent = message.toStrippedJsonString() ; if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) { jsonMessageContent = message.toMinimizedJsonString(); } final FlatPushMessageInformation pushMessageInformation = metricsService.storeNewRequestFrom( pushApplication.getPushApplicationID(), jsonMessageContent, message.getIpAddress(), message.getClientIdentifier() ); variants.forEach((variantType, variant) -> { logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier())); dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant)); }); }
NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCriteria().getVariants(); if (variantIDs != null) { variantIDs.forEach(variantID -> { Variant variant = genericVariantService.get().findByVariantID(variantID); if (variant != null) { variants.add(variant); } }); } else { variants.addAll(pushApplication.getVariants()); } String jsonMessageContent = message.toStrippedJsonString() ; if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) { jsonMessageContent = message.toMinimizedJsonString(); } final FlatPushMessageInformation pushMessageInformation = metricsService.storeNewRequestFrom( pushApplication.getPushApplicationID(), jsonMessageContent, message.getIpAddress(), message.getClientIdentifier() ); variants.forEach((variantType, variant) -> { logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier())); dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant)); }); } }
NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCriteria().getVariants(); if (variantIDs != null) { variantIDs.forEach(variantID -> { Variant variant = genericVariantService.get().findByVariantID(variantID); if (variant != null) { variants.add(variant); } }); } else { variants.addAll(pushApplication.getVariants()); } String jsonMessageContent = message.toStrippedJsonString() ; if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) { jsonMessageContent = message.toMinimizedJsonString(); } final FlatPushMessageInformation pushMessageInformation = metricsService.storeNewRequestFrom( pushApplication.getPushApplicationID(), jsonMessageContent, message.getIpAddress(), message.getClientIdentifier() ); variants.forEach((variantType, variant) -> { logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier())); dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant)); }); }  }
NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCriteria().getVariants(); if (variantIDs != null) { variantIDs.forEach(variantID -> { Variant variant = genericVariantService.get().findByVariantID(variantID); if (variant != null) { variants.add(variant); } }); } else { variants.addAll(pushApplication.getVariants()); } String jsonMessageContent = message.toStrippedJsonString() ; if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) { jsonMessageContent = message.toMinimizedJsonString(); } final FlatPushMessageInformation pushMessageInformation = metricsService.storeNewRequestFrom( pushApplication.getPushApplicationID(), jsonMessageContent, message.getIpAddress(), message.getClientIdentifier() ); variants.forEach((variantType, variant) -> { logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier())); dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant)); }); }  @TransactionAttribute(TransactionAttributeType.REQUIRED) void submit(PushApplication pushApplication, InternalUnifiedPushMessage message); }
NotificationRouter { @TransactionAttribute(TransactionAttributeType.REQUIRED) public void submit(PushApplication pushApplication, InternalUnifiedPushMessage message) { logger.debug("Processing send request with '{}' payload", message.getMessage()); final VariantMap variants = new VariantMap(); final List<String> variantIDs = message.getCriteria().getVariants(); if (variantIDs != null) { variantIDs.forEach(variantID -> { Variant variant = genericVariantService.get().findByVariantID(variantID); if (variant != null) { variants.add(variant); } }); } else { variants.addAll(pushApplication.getVariants()); } String jsonMessageContent = message.toStrippedJsonString() ; if (jsonMessageContent != null && jsonMessageContent.length() >= 4500) { jsonMessageContent = message.toMinimizedJsonString(); } final FlatPushMessageInformation pushMessageInformation = metricsService.storeNewRequestFrom( pushApplication.getPushApplicationID(), jsonMessageContent, message.getIpAddress(), message.getClientIdentifier() ); variants.forEach((variantType, variant) -> { logger.info(String.format("Internal dispatching of push message for one %s variant (by %s)", variantType.getTypeName(), message.getClientIdentifier())); dispatchVariantMessageEvent.fire(new MessageHolderWithVariants(pushMessageInformation, message, variantType, variant)); }); }  @TransactionAttribute(TransactionAttributeType.REQUIRED) void submit(PushApplication pushApplication, InternalUnifiedPushMessage message);  }