Commit fde0dbec authored by uday's avatar uday

written the component test case for producer

parent 7f355b96
......@@ -11,29 +11,21 @@ import org.mapstruct.Mapping;
public interface BoToDtoMapper {
@Mapping(target="offersDTO",source="offersBO")
OffersDataDTO map(OffersDataBO offersDataBO);
@Mapping(target="rulesDTO",source="rulesBO")
@Mapping(target="infoDTO",source="infoBO")
OffersDTO map(OffersBO offersBO);
@Mapping(target="idDTO",source="idBO")
@Mapping(target = "terminalsDTO",source="terminalsBO")
InfoDTO map(InfoBO infoBO);
IdDTO map(IdBO idBO);
@Mapping(target="benefitDTO",source="benefitBO")
RulesDTO map(RulesBO rulesBO);
@Mapping(target = "pointsDTO",source="pointsBO")
@Mapping(target = "discountDTO",source="discountBO")
BenefitDTO map(BenefitBO BenefitBO);
@Mapping(target = "discountTierDTO",source="discountTierBO")
DiscountDTO map(DiscountBO DiscountBO);
DiscountTierDTO map(DiscountTierBO discountTierBO);
PointsDTO map(PointsBO pointsBO);
}
......@@ -20,9 +20,10 @@ public class OffersDataProducer {
@Autowired
private ObjectMapper objectMapper;
public ListenableFuture<SendResult<String, String>> sendMessage(OffersDataDTO offersDataDTO) throws JsonProcessingException {
logger.info(String.format("$$ -> Producing message --> %s", offersDataDTO));
String offersDataBOResp = objectMapper.writeValueAsString(offersDataDTO);
ListenableFuture<SendResult<String, String>> message= kafkaTemplate.send(AppConfigs.TOPIC_NAME, offersDataBOResp);
logger.info("Start :: OffersDataProducer.sendMessage");
String offersDataDTOResp = objectMapper.writeValueAsString(offersDataDTO);
ListenableFuture<SendResult<String, String>> message= kafkaTemplate.send(AppConfigs.TOPIC_NAME, offersDataDTOResp);
logger.info("End :: OffersDataProducer.sendMessage");
return message;
}
}
{
"offerId": 135918555,
"offersDTO": [
{
"infoDTO":
{
"offerId": 135918555,
"idDTO":
{
"offerId": 135918555,
"manufacturerId": "MMM"
},
"offerProgramCode": "SC",
"terminalsDTO":
[
"Groceryworks (Safeway.com)",
"Smart Cart (QVS Virtual Terminals)",
"Bakery"
]
},
"rulesDTO":
{
"offerId": 135918555,
"startDate": "2019-07-27T07:00:00.000+00:00",
"endDate": "2021-02-27T06:59:58.000+00:00",
"benefitDTO":
{
"benefitValueType": "A",
"discountDTO":
[
{
"allowNegative": false,
"flexNegative": false,
"discountTierDTO":
[
{
"amount": 6.99,
"upTo": "3",
"itemLimit": 5,
"weightLimit": 2
}
]
}
],
"pointsDTO":
[
{
"generalPoints": 5,
"loyaltyPoints": 250
}
]
}
}
}
]
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment