@Test public void test_should_push_create_usageType_to_queue() { when(codeSequenceNumberGenerator.getNextSequence("SEQ_EGWTR_USAGE_TYPE")).thenReturn("1", "2"); when(applicationProperties.getCreateUsageTypeTopicName()).thenReturn("egov.wcms.usagetype-create"); usageTypeRepository.pushCreateToQueue(getUsageTypeRequest()); verify(kafkaTemplate).send("egov.wcms.usagetype-create", getUsageTypeRequest()); }
public List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest) { final List<UsageType> usageTypes = usageTypeRequest.getUsageTypes(); for (final UsageType usageType : usageTypes) usageType.setCode(codeSequenceNumberGenerator.getNextSequence(UsageType.SEQ_USAGE_TYPE).toString()); logger.info("Sending UsageType request to kafka Queue:" + usageTypeRequest); try { kafkaTemplate.send(applicationProperties.getCreateUsageTypeTopicName(), usageTypeRequest); } catch (final Exception e) { logger.error("Exception encountered:" + e); } return usageTypeRequest.getUsageTypes(); }
UsageTypeRepository { public List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest) { final List<UsageType> usageTypes = usageTypeRequest.getUsageTypes(); for (final UsageType usageType : usageTypes) usageType.setCode(codeSequenceNumberGenerator.getNextSequence(UsageType.SEQ_USAGE_TYPE).toString()); logger.info("Sending UsageType request to kafka Queue:" + usageTypeRequest); try { kafkaTemplate.send(applicationProperties.getCreateUsageTypeTopicName(), usageTypeRequest); } catch (final Exception e) { logger.error("Exception encountered:" + e); } return usageTypeRequest.getUsageTypes(); } }
UsageTypeRepository { public List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest) { final List<UsageType> usageTypes = usageTypeRequest.getUsageTypes(); for (final UsageType usageType : usageTypes) usageType.setCode(codeSequenceNumberGenerator.getNextSequence(UsageType.SEQ_USAGE_TYPE).toString()); logger.info("Sending UsageType request to kafka Queue:" + usageTypeRequest); try { kafkaTemplate.send(applicationProperties.getCreateUsageTypeTopicName(), usageTypeRequest); } catch (final Exception e) { logger.error("Exception encountered:" + e); } return usageTypeRequest.getUsageTypes(); }  }
UsageTypeRepository { public List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest) { final List<UsageType> usageTypes = usageTypeRequest.getUsageTypes(); for (final UsageType usageType : usageTypes) usageType.setCode(codeSequenceNumberGenerator.getNextSequence(UsageType.SEQ_USAGE_TYPE).toString()); logger.info("Sending UsageType request to kafka Queue:" + usageTypeRequest); try { kafkaTemplate.send(applicationProperties.getCreateUsageTypeTopicName(), usageTypeRequest); } catch (final Exception e) { logger.error("Exception encountered:" + e); } return usageTypeRequest.getUsageTypes(); }  List<UsageType> getUsageTypesByCriteria(final UsageTypeGetRequest usageTypeGetRequest); List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest); @SuppressWarnings("unchecked") UsageTypeReq create(final UsageTypeReq usageTypeRequest); List<UsageType> pushUpdateToQueue(final UsageTypeReq usageTypeRequest); @SuppressWarnings("unchecked") UsageTypeReq update(final UsageTypeReq usageTypeRequest); }
UsageTypeRepository { public List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest) { final List<UsageType> usageTypes = usageTypeRequest.getUsageTypes(); for (final UsageType usageType : usageTypes) usageType.setCode(codeSequenceNumberGenerator.getNextSequence(UsageType.SEQ_USAGE_TYPE).toString()); logger.info("Sending UsageType request to kafka Queue:" + usageTypeRequest); try { kafkaTemplate.send(applicationProperties.getCreateUsageTypeTopicName(), usageTypeRequest); } catch (final Exception e) { logger.error("Exception encountered:" + e); } return usageTypeRequest.getUsageTypes(); }  List<UsageType> getUsageTypesByCriteria(final UsageTypeGetRequest usageTypeGetRequest); List<UsageType> pushCreateToQueue(final UsageTypeReq usageTypeRequest); @SuppressWarnings("unchecked") UsageTypeReq create(final UsageTypeReq usageTypeRequest); List<UsageType> pushUpdateToQueue(final UsageTypeReq usageTypeRequest); @SuppressWarnings("unchecked") UsageTypeReq update(final UsageTypeReq usageTypeRequest); static final Logger logger; }