Commit 78aa6eb8 authored by Kali Padhi's avatar Kali Padhi
parents a6e32025 ffb13128
...@@ -40,7 +40,7 @@ In Header click on Tool -> Query Tool --> and paste the below query ...@@ -40,7 +40,7 @@ In Header click on Tool -> Query Tool --> and paste the below query
CREATE TABLE offer_lookup CREATE TABLE offer_lookup
( (
id INTEGER, id VARCHAR(500),
store_id VARCHAR(200), store_id VARCHAR(200),
terminal VARCHAR(200), terminal VARCHAR(200),
offer_type VARCHAR(200), offer_type VARCHAR(200),
...@@ -61,16 +61,16 @@ Once you create use the below query to insert a data ...@@ -61,16 +61,16 @@ Once you create use the below query to insert a data
INSERT INTO public.offer_lookup( INSERT INTO public.offer_lookup(
store_id, terminal, offer_type, offer_id, pre_condition, id) store_id, terminal, offer_type, offer_id, pre_condition, id)
VALUES ('0001','001','Customer',1,'AND',54321); VALUES ('0001','001','Customer',1,'AND',"54321");
INSERT INTO public.offer_lookup( INSERT INTO public.offer_lookup(
store_id, terminal, offer_type, offer_id, pre_condition,id) store_id, terminal, offer_type, offer_id, pre_condition,id)
VALUES ('0001','001','Customer',2,'AND',54321); VALUES ('0001','001','Customer',2,'AND',"54321");
INSERT INTO public.offer_lookup( INSERT INTO public.offer_lookup(
store_id, terminal, offer_type, offer_id, pre_condition,id) store_id, terminal, offer_type, offer_id, pre_condition,id)
VALUES ('0001','001','Customer',3,'AND',54321); VALUES ('0001','001','Customer',3,'AND',"54321");
INSERT INTO public.offer_lookup( INSERT INTO public.offer_lookup(
store_id, terminal, offer_type, offer_id, pre_condition,id) store_id, terminal, offer_type, offer_id, pre_condition,id)
VALUES ('0001','001','Customer',4,'AND',54321); VALUES ('0001','001','Customer',4,'AND',"54321");
``` ```
......
...@@ -10,10 +10,10 @@ import javax.swing.text.html.Option; ...@@ -10,10 +10,10 @@ import javax.swing.text.html.Option;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface OfferLookupRepo extends JpaRepository<OfferLookup,Long> { public interface OfferLookupRepo extends JpaRepository<OfferLookup,String> {
@Query(value= "SELECT * FROM offer_lookup WHERE id=:hhid" , nativeQuery = true) @Query(value= "SELECT * FROM offer_lookup WHERE id=:hhid" , nativeQuery = true)
public List<OfferLookup> findByHhId(Long hhid); public List<OfferLookup> findByHhId(String hhid);
......
...@@ -18,7 +18,7 @@ import javax.persistence.EmbeddedId; ...@@ -18,7 +18,7 @@ import javax.persistence.EmbeddedId;
public class OfferLookupDTO { public class OfferLookupDTO {
Long id; String id;
String idType; String idType;
Long offerId; Long offerId;
String storeId; String storeId;
......
...@@ -21,7 +21,7 @@ import static com.google.common.collect.Lists.newArrayList; ...@@ -21,7 +21,7 @@ import static com.google.common.collect.Lists.newArrayList;
public class OfferTransactionRequest { public class OfferTransactionRequest {
@NotNull @NotNull
Long hhId; String hhId;
String transactionId= UUID.randomUUID().toString(); String transactionId= UUID.randomUUID().toString();
......
...@@ -19,7 +19,7 @@ public class OfferLookup { ...@@ -19,7 +19,7 @@ public class OfferLookup {
@Id @Id
@Column(name = "id") @Column(name = "id")
Long id; String id;
@Id @Id
@Column(name ="offer_type") @Column(name ="offer_type")
......
...@@ -19,7 +19,7 @@ public class OfferLookupComposite implements Serializable { ...@@ -19,7 +19,7 @@ public class OfferLookupComposite implements Serializable {
@Column(name = "id") @Column(name = "id")
Long id; String id;
@Column(name ="offer_type") @Column(name ="offer_type")
String idType; String idType;
......
spring.profiles.active=dev
spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/storedb spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/storedb
spring.datasource.username=postgres spring.datasource.username=postgres
spring.datasource.password=dbpwd spring.datasource.password=dbpwd
......
...@@ -15,6 +15,7 @@ import org.springframework.core.ParameterizedTypeReference; ...@@ -15,6 +15,7 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity; import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -26,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*; ...@@ -26,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*;
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT) @SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT)
@AutoConfigureWireMock @AutoConfigureWireMock
@ActiveProfiles(value = "integration")
public class OfferTransactionControllerIntegrationTest extends AbstractTestBase{ public class OfferTransactionControllerIntegrationTest extends AbstractTestBase{
@Rule @Rule
......
...@@ -83,8 +83,8 @@ class OfferTransactionControllerTest { ...@@ -83,8 +83,8 @@ class OfferTransactionControllerTest {
} }
private List<OfferLookup> getOffers() { private List<OfferLookup> getOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 234L, "02", "AND", "BOGO"); OfferLookup offerLookup1 = new OfferLookup("123", "12", 234L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 234L, "02", "OR", "BXGY"); OfferLookup offerLookup2 = new OfferLookup("1213", "13", 234L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>(); List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1); offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2); offerLookups.add(offerLookup2);
...@@ -141,7 +141,7 @@ class OfferTransactionControllerTest { ...@@ -141,7 +141,7 @@ class OfferTransactionControllerTest {
private List<OfferLookupDTO> getOfferLookupDto(){ private List<OfferLookupDTO> getOfferLookupDto(){
OfferLookupDTO offerLookupDTO = new OfferLookupDTO(); OfferLookupDTO offerLookupDTO = new OfferLookupDTO();
offerLookupDTO.setId(123456L); offerLookupDTO.setId("123");
offerLookupDTO.setIdType("1234"); offerLookupDTO.setIdType("1234");
offerLookupDTO.setOfferId(1L); offerLookupDTO.setOfferId(1L);
offerLookupDTO.setPreCondition("And"); offerLookupDTO.setPreCondition("And");
...@@ -163,7 +163,7 @@ class OfferTransactionControllerTest { ...@@ -163,7 +163,7 @@ class OfferTransactionControllerTest {
OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO(); OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO();
offerLookupDTO1.setId(123456L); offerLookupDTO1.setId("123");
offerLookupDTO1.setIdType("1234"); offerLookupDTO1.setIdType("1234");
offerLookupDTO1.setOfferId(1L); offerLookupDTO1.setOfferId(1L);
offerLookupDTO1.setPreCondition("And"); offerLookupDTO1.setPreCondition("And");
......
...@@ -93,8 +93,8 @@ public class EndOfSaleTest { ...@@ -93,8 +93,8 @@ public class EndOfSaleTest {
} }
public List<OfferLookup> returnOffers() { public List<OfferLookup> returnOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 23L, "02", "AND", "BOGO"); OfferLookup offerLookup1 = new OfferLookup("1", "12", 23L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 24L, "02", "OR", "BXGY"); OfferLookup offerLookup2 = new OfferLookup("2", "13", 24L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>(); List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1); offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2); offerLookups.add(offerLookup2);
......
...@@ -103,7 +103,7 @@ public class OfferServiceTest { ...@@ -103,7 +103,7 @@ public class OfferServiceTest {
private OfferTransactionRequest getOfferTransactionRequest() { private OfferTransactionRequest getOfferTransactionRequest() {
OfferTransactionRequest offerTransactionRequest = new OfferTransactionRequest(); OfferTransactionRequest offerTransactionRequest = new OfferTransactionRequest();
offerTransactionRequest.setHhId(123L); offerTransactionRequest.setHhId("123");
List<Item> itemList = new ArrayList<>(); List<Item> itemList = new ArrayList<>();
Item item1 = new Item("Coke", "12", 6.05); Item item1 = new Item("Coke", "12", 6.05);
Item item2 = new Item("Thumpsup", "11", 12.32); Item item2 = new Item("Thumpsup", "11", 12.32);
...@@ -114,8 +114,8 @@ public class OfferServiceTest { ...@@ -114,8 +114,8 @@ public class OfferServiceTest {
} }
public List<OfferLookup> returnOffers() { public List<OfferLookup> returnOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 20L, "02", "AND", "BOGO"); OfferLookup offerLookup1 = new OfferLookup("1", "12", 20L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 23L, "02", "OR", "BXGY"); OfferLookup offerLookup2 = new OfferLookup("2", "13", 23L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>(); List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1); offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2); offerLookups.add(offerLookup2);
...@@ -141,7 +141,7 @@ public class OfferServiceTest { ...@@ -141,7 +141,7 @@ public class OfferServiceTest {
private List<OfferLookupDTO> getOfferLookupDto(){ private List<OfferLookupDTO> getOfferLookupDto(){
OfferLookupDTO offerLookupDTO = new OfferLookupDTO(); OfferLookupDTO offerLookupDTO = new OfferLookupDTO();
offerLookupDTO.setId(123456L); offerLookupDTO.setId("12345");
offerLookupDTO.setIdType("1234"); offerLookupDTO.setIdType("1234");
offerLookupDTO.setOfferId(1L); offerLookupDTO.setOfferId(1L);
offerLookupDTO.setPreCondition("And"); offerLookupDTO.setPreCondition("And");
...@@ -163,7 +163,7 @@ public class OfferServiceTest { ...@@ -163,7 +163,7 @@ public class OfferServiceTest {
OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO(); OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO();
offerLookupDTO1.setId(123456L); offerLookupDTO1.setId("12345");
offerLookupDTO1.setIdType("1234"); offerLookupDTO1.setIdType("1234");
offerLookupDTO1.setOfferId(1L); offerLookupDTO1.setOfferId(1L);
offerLookupDTO1.setPreCondition("And"); offerLookupDTO1.setPreCondition("And");
......
spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/postgres
spring.datasource.username=user
spring.datasource.password=password123
endpoint.url.promotionEngineUrl=/promotionEngine/calculateDiscount
endpoint.url.peBaseUrl=http://localhost:7073
endpoint.url.storeProducerUrl=/store/producer
endpoint.url.spBaseUrl=http://localhost:7070
server.port = 7072
\ 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