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; ...@@ -11,29 +11,21 @@ import org.mapstruct.Mapping;
public interface BoToDtoMapper { public interface BoToDtoMapper {
@Mapping(target="offersDTO",source="offersBO") @Mapping(target="offersDTO",source="offersBO")
OffersDataDTO map(OffersDataBO offersDataBO); OffersDataDTO map(OffersDataBO offersDataBO);
@Mapping(target="rulesDTO",source="rulesBO") @Mapping(target="rulesDTO",source="rulesBO")
@Mapping(target="infoDTO",source="infoBO") @Mapping(target="infoDTO",source="infoBO")
OffersDTO map(OffersBO offersBO); OffersDTO map(OffersBO offersBO);
@Mapping(target="idDTO",source="idBO") @Mapping(target="idDTO",source="idBO")
@Mapping(target = "terminalsDTO",source="terminalsBO") @Mapping(target = "terminalsDTO",source="terminalsBO")
InfoDTO map(InfoBO infoBO); InfoDTO map(InfoBO infoBO);
IdDTO map(IdBO idBO); IdDTO map(IdBO idBO);
@Mapping(target="benefitDTO",source="benefitBO") @Mapping(target="benefitDTO",source="benefitBO")
RulesDTO map(RulesBO rulesBO); RulesDTO map(RulesBO rulesBO);
@Mapping(target = "pointsDTO",source="pointsBO") @Mapping(target = "pointsDTO",source="pointsBO")
@Mapping(target = "discountDTO",source="discountBO") @Mapping(target = "discountDTO",source="discountBO")
BenefitDTO map(BenefitBO BenefitBO); BenefitDTO map(BenefitBO BenefitBO);
@Mapping(target = "discountTierDTO",source="discountTierBO") @Mapping(target = "discountTierDTO",source="discountTierBO")
DiscountDTO map(DiscountBO DiscountBO); DiscountDTO map(DiscountBO DiscountBO);
DiscountTierDTO map(DiscountTierBO discountTierBO); DiscountTierDTO map(DiscountTierBO discountTierBO);
PointsDTO map(PointsBO pointsBO); PointsDTO map(PointsBO pointsBO);
} }
...@@ -20,9 +20,10 @@ public class OffersDataProducer { ...@@ -20,9 +20,10 @@ public class OffersDataProducer {
@Autowired @Autowired
private ObjectMapper objectMapper; private ObjectMapper objectMapper;
public ListenableFuture<SendResult<String, String>> sendMessage(OffersDataDTO offersDataDTO) throws JsonProcessingException { public ListenableFuture<SendResult<String, String>> sendMessage(OffersDataDTO offersDataDTO) throws JsonProcessingException {
logger.info(String.format("$$ -> Producing message --> %s", offersDataDTO)); logger.info("Start :: OffersDataProducer.sendMessage");
String offersDataBOResp = objectMapper.writeValueAsString(offersDataDTO); String offersDataDTOResp = objectMapper.writeValueAsString(offersDataDTO);
ListenableFuture<SendResult<String, String>> message= kafkaTemplate.send(AppConfigs.TOPIC_NAME, offersDataBOResp); ListenableFuture<SendResult<String, String>> message= kafkaTemplate.send(AppConfigs.TOPIC_NAME, offersDataDTOResp);
logger.info("End :: OffersDataProducer.sendMessage");
return message; 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