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
CREATE TABLE offer_lookup
(
id INTEGER,
id VARCHAR(500),
store_id VARCHAR(200),
terminal VARCHAR(200),
offer_type VARCHAR(200),
......@@ -61,16 +61,16 @@ Once you create use the below query to insert a data
INSERT INTO public.offer_lookup(
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(
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(
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(
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;
import java.util.List;
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)
public List<OfferLookup> findByHhId(Long hhid);
public List<OfferLookup> findByHhId(String hhid);
......
......@@ -18,7 +18,7 @@ import javax.persistence.EmbeddedId;
public class OfferLookupDTO {
Long id;
String id;
String idType;
Long offerId;
String storeId;
......
......@@ -21,7 +21,7 @@ import static com.google.common.collect.Lists.newArrayList;
public class OfferTransactionRequest {
@NotNull
Long hhId;
String hhId;
String transactionId= UUID.randomUUID().toString();
......
......@@ -19,7 +19,7 @@ public class OfferLookup {
@Id
@Column(name = "id")
Long id;
String id;
@Id
@Column(name ="offer_type")
......
......@@ -19,7 +19,7 @@ public class OfferLookupComposite implements Serializable {
@Column(name = "id")
Long id;
String id;
@Column(name ="offer_type")
String idType;
......
spring.profiles.active=dev
spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/storedb
spring.datasource.username=postgres
spring.datasource.password=dbpwd
......
......@@ -15,6 +15,7 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import java.net.URI;
import java.util.ArrayList;
......@@ -26,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.*;
@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT)
@AutoConfigureWireMock
@ActiveProfiles(value = "integration")
public class OfferTransactionControllerIntegrationTest extends AbstractTestBase{
@Rule
......
......@@ -83,8 +83,8 @@ class OfferTransactionControllerTest {
}
private List<OfferLookup> getOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 234L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 234L, "02", "OR", "BXGY");
OfferLookup offerLookup1 = new OfferLookup("123", "12", 234L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup("1213", "13", 234L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2);
......@@ -141,7 +141,7 @@ class OfferTransactionControllerTest {
private List<OfferLookupDTO> getOfferLookupDto(){
OfferLookupDTO offerLookupDTO = new OfferLookupDTO();
offerLookupDTO.setId(123456L);
offerLookupDTO.setId("123");
offerLookupDTO.setIdType("1234");
offerLookupDTO.setOfferId(1L);
offerLookupDTO.setPreCondition("And");
......@@ -163,7 +163,7 @@ class OfferTransactionControllerTest {
OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO();
offerLookupDTO1.setId(123456L);
offerLookupDTO1.setId("123");
offerLookupDTO1.setIdType("1234");
offerLookupDTO1.setOfferId(1L);
offerLookupDTO1.setPreCondition("And");
......
......@@ -93,8 +93,8 @@ public class EndOfSaleTest {
}
public List<OfferLookup> returnOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 23L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 24L, "02", "OR", "BXGY");
OfferLookup offerLookup1 = new OfferLookup("1", "12", 23L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup("2", "13", 24L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2);
......
......@@ -103,7 +103,7 @@ public class OfferServiceTest {
private OfferTransactionRequest getOfferTransactionRequest() {
OfferTransactionRequest offerTransactionRequest = new OfferTransactionRequest();
offerTransactionRequest.setHhId(123L);
offerTransactionRequest.setHhId("123");
List<Item> itemList = new ArrayList<>();
Item item1 = new Item("Coke", "12", 6.05);
Item item2 = new Item("Thumpsup", "11", 12.32);
......@@ -114,8 +114,8 @@ public class OfferServiceTest {
}
public List<OfferLookup> returnOffers() {
OfferLookup offerLookup1 = new OfferLookup(1L, "12", 20L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup(2L, "13", 23L, "02", "OR", "BXGY");
OfferLookup offerLookup1 = new OfferLookup("1", "12", 20L, "02", "AND", "BOGO");
OfferLookup offerLookup2 = new OfferLookup("2", "13", 23L, "02", "OR", "BXGY");
List<OfferLookup> offerLookups = new ArrayList<>();
offerLookups.add(offerLookup1);
offerLookups.add(offerLookup2);
......@@ -141,7 +141,7 @@ public class OfferServiceTest {
private List<OfferLookupDTO> getOfferLookupDto(){
OfferLookupDTO offerLookupDTO = new OfferLookupDTO();
offerLookupDTO.setId(123456L);
offerLookupDTO.setId("12345");
offerLookupDTO.setIdType("1234");
offerLookupDTO.setOfferId(1L);
offerLookupDTO.setPreCondition("And");
......@@ -163,7 +163,7 @@ public class OfferServiceTest {
OfferLookupDTO offerLookupDTO1 = new OfferLookupDTO();
offerLookupDTO1.setId(123456L);
offerLookupDTO1.setId("12345");
offerLookupDTO1.setIdType("1234");
offerLookupDTO1.setOfferId(1L);
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