Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OTSWithFeign
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bhaskar Katakam
OTSWithFeign
Commits
5c080d96
Commit
5c080d96
authored
Apr 15, 2020
by
Naren Medarametla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified pojos and properties file wrt to sync with store consumer service
parent
a6ce0cc9
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
42 additions
and
61 deletions
+42
-61
ClientService.java
...m/nisum/offertransactionservice/client/ClientService.java
+2
-2
OfferTransactionConfig.java
...ffertransactionservice/config/OfferTransactionConfig.java
+10
-13
OfferLookupRepo.java
...om/nisum/offertransactionservice/dao/OfferLookupRepo.java
+1
-1
OfferMetaDataRepo.java
.../nisum/offertransactionservice/dao/OfferMetaDataRepo.java
+2
-2
OfferLookup.java
.../com/nisum/offertransactionservice/model/OfferLookup.java
+4
-4
OfferMeta.java
...va/com/nisum/offertransactionservice/model/OfferMeta.java
+3
-3
OfferCallingPEService.java
...ffertransactionservice/service/OfferCallingPEService.java
+0
-3
application.properties
src/main/resources/application.properties
+6
-6
ClientServiceTest.java
...sum/offertransactionservice/client/ClientServiceTest.java
+1
-13
OfferControllerTest.java
...fertransactionservice/controller/OfferControllerTest.java
+2
-2
EndOfSaleTest.java
.../nisum/offertransactionservice/service/EndOfSaleTest.java
+2
-2
OfferServiceTest.java
...sum/offertransactionservice/service/OfferServiceTest.java
+3
-4
application.properties
src/test/resources/application.properties
+6
-6
No files found.
src/main/java/com/nisum/offertransactionservice/client/ClientService.java
View file @
5c080d96
...
@@ -56,9 +56,9 @@ public class ClientService {
...
@@ -56,9 +56,9 @@ public class ClientService {
public
Mono
<
String
>
getStringMono
(
String
uuid
)
{
public
Mono
<
String
>
getStringMono
(
String
uuid
)
{
WebClient
build
=
WebClient
.
builder
().
baseUrl
(
offerTransactionConfig
.
getS
c
BaseUrl
()).
build
();
WebClient
build
=
WebClient
.
builder
().
baseUrl
(
offerTransactionConfig
.
getS
p
BaseUrl
()).
build
();
return
build
.
post
().
return
build
.
post
().
uri
(
offerTransactionConfig
.
getStore
Consum
erUrl
()).
uri
(
offerTransactionConfig
.
getStore
Produc
erUrl
()).
accept
(
MediaType
.
APPLICATION_JSON
).
accept
(
MediaType
.
APPLICATION_JSON
).
body
(
Mono
.
just
(
uuid
),
String
.
class
).
body
(
Mono
.
just
(
uuid
),
String
.
class
).
retrieve
().
retrieve
().
...
...
src/main/java/com/nisum/offertransactionservice/config/OfferTransactionConfig.java
View file @
5c080d96
...
@@ -9,31 +9,28 @@ import org.springframework.context.annotation.Configuration;
...
@@ -9,31 +9,28 @@ import org.springframework.context.annotation.Configuration;
public
class
OfferTransactionConfig
{
public
class
OfferTransactionConfig
{
private
String
store
Consum
erUrl
;
private
String
store
Produc
erUrl
;
private
String
s
c
BaseUrl
;
private
String
s
p
BaseUrl
;
private
String
promotionEngineUrl
;
private
String
promotionEngineUrl
;
private
String
peBaseUrl
;
private
String
peBaseUrl
;
public
String
getStoreProducerUrl
()
{
return
storeProducerUrl
;
public
String
getScBaseUrl
()
{
return
scBaseUrl
;
}
}
public
String
getStoreConsumerUrl
(
)
{
public
void
setStoreProducerUrl
(
String
storeProducerUrl
)
{
return
storeConsum
erUrl
;
this
.
storeProducerUrl
=
storeProduc
erUrl
;
}
}
public
void
setStoreConsumerUrl
(
String
storeConsumerUrl
)
{
public
String
getSpBaseUrl
(
)
{
this
.
storeConsumerUrl
=
storeConsumer
Url
;
return
spBase
Url
;
}
}
public
void
setS
cBaseUrl
(
String
sc
BaseUrl
)
{
public
void
setS
pBaseUrl
(
String
sp
BaseUrl
)
{
this
.
s
cBaseUrl
=
sc
BaseUrl
;
this
.
s
pBaseUrl
=
sp
BaseUrl
;
}
}
public
String
getPromotionEngineUrl
()
{
public
String
getPromotionEngineUrl
()
{
...
...
src/main/java/com/nisum/offertransactionservice/dao/OfferLookupRepo.java
View file @
5c080d96
...
@@ -3,5 +3,5 @@ package com.nisum.offertransactionservice.dao;
...
@@ -3,5 +3,5 @@ package com.nisum.offertransactionservice.dao;
import
com.nisum.offertransactionservice.model.OfferLookup
;
import
com.nisum.offertransactionservice.model.OfferLookup
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.data.repository.CrudRepository
;
public
interface
OfferLookupRepo
extends
CrudRepository
<
OfferLookup
,
Stri
ng
>
{
public
interface
OfferLookupRepo
extends
CrudRepository
<
OfferLookup
,
Lo
ng
>
{
}
}
src/main/java/com/nisum/offertransactionservice/dao/OfferMetaDataRepo.java
View file @
5c080d96
...
@@ -6,8 +6,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -6,8 +6,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
import
java.util.Optional
;
import
java.util.Optional
;
public
interface
OfferMetaDataRepo
extends
JpaRepository
<
OfferMeta
,
Stri
ng
>
{
public
interface
OfferMetaDataRepo
extends
JpaRepository
<
OfferMeta
,
Lo
ng
>
{
public
Optional
<
OfferMeta
>
findByOfferIdAndOfferStatus
(
Stri
ng
offerId
,
String
offerStatus
);
public
Optional
<
OfferMeta
>
findByOfferIdAndOfferStatus
(
Lo
ng
offerId
,
String
offerStatus
);
}
}
src/main/java/com/nisum/offertransactionservice/model/OfferLookup.java
View file @
5c080d96
...
@@ -13,13 +13,13 @@ import javax.persistence.*;
...
@@ -13,13 +13,13 @@ import javax.persistence.*;
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
,
makeFinal
=
false
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
,
makeFinal
=
false
)
@Entity
@Entity
@Table
(
name
=
"offerlookup"
)
@Table
(
name
=
"offer
_
lookup"
)
@IdClass
(
OfferLookupComposite
.
class
)
@IdClass
(
OfferLookupComposite
.
class
)
public
class
OfferLookup
{
public
class
OfferLookup
{
@Id
@Id
@Column
(
name
=
"
offer_lookup_
id"
)
@Column
(
name
=
"id"
)
Stri
ng
id
;
Lo
ng
id
;
@Id
@Id
@Column
(
name
=
"offer_type"
)
@Column
(
name
=
"offer_type"
)
...
@@ -27,7 +27,7 @@ public class OfferLookup {
...
@@ -27,7 +27,7 @@ public class OfferLookup {
@Id
@Id
@Column
(
name
=
"offer_id"
)
@Column
(
name
=
"offer_id"
)
Stri
ng
offerId
;
Lo
ng
offerId
;
@Column
(
name
=
"store_id"
)
@Column
(
name
=
"store_id"
)
String
storeId
;
String
storeId
;
...
...
src/main/java/com/nisum/offertransactionservice/model/OfferMeta.java
View file @
5c080d96
...
@@ -18,12 +18,12 @@ import java.time.LocalDateTime;
...
@@ -18,12 +18,12 @@ import java.time.LocalDateTime;
@AllArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
,
makeFinal
=
false
)
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
,
makeFinal
=
false
)
@Entity
@Entity
@Table
(
name
=
"offer_meta
_
data"
)
@Table
(
name
=
"offer_metadata"
)
public
class
OfferMeta
{
public
class
OfferMeta
{
@Id
@Id
@Column
(
name
=
"offerid"
)
@Column
(
name
=
"offer
_
id"
)
Stri
ng
offerId
;
Lo
ng
offerId
;
@Column
(
name
=
"start_time"
)
@Column
(
name
=
"start_time"
)
LocalDateTime
startTime
;
LocalDateTime
startTime
;
...
...
src/main/java/com/nisum/offertransactionservice/service/OfferCallingPEService.java
View file @
5c080d96
...
@@ -76,9 +76,6 @@ public class OfferCallingPEService {
...
@@ -76,9 +76,6 @@ public class OfferCallingPEService {
.
filter
(
offerLookupDTO
->
offerLookupDTO
!=
null
)
.
filter
(
offerLookupDTO
->
offerLookupDTO
!=
null
)
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
...
...
src/main/resources/application.properties
View file @
5c080d96
spring.datasource.url
=
jdbc:postgresql://127.0.0.1:5432/
postgres
spring.datasource.url
=
jdbc:postgresql://127.0.0.1:5432/
storedb
spring.datasource.username
=
user
spring.datasource.username
=
postgres
spring.datasource.password
=
password
123
spring.datasource.password
=
welcome
123
endpoint.url.promotionEngineUrl
=
/promotionEngine/calculateDiscount
endpoint.url.promotionEngineUrl
=
/promotionEngine/calculateDiscount
endpoint.url.peBaseUrl
=
http://localhost:808
9
endpoint.url.peBaseUrl
=
http://localhost:808
6
endpoint.url.store
Consum
erUrl
=
/store/producer
endpoint.url.store
Produc
erUrl
=
/store/producer
endpoint.url.s
cBaseUrl
=
http://localhost:8081
endpoint.url.s
pBaseUrl
=
http://localhost:7070
server.port
=
8085
server.port
=
8085
src/test/java/com/nisum/offertransactionservice/client/ClientServiceTest.java
View file @
5c080d96
...
@@ -54,12 +54,9 @@ public class ClientServiceTest {
...
@@ -54,12 +54,9 @@ public class ClientServiceTest {
@Mock
@Mock
private
WebClient
.
ResponseSpec
responseMock
;
private
WebClient
.
ResponseSpec
responseMock
;
@InjectMocks
@InjectMocks
ClientService
clientService
;
ClientService
clientService
;
@Mock
@Mock
OfferTransactionConfig
offerTransactionConfig
;;
OfferTransactionConfig
offerTransactionConfig
;;
...
@@ -68,7 +65,7 @@ public class ClientServiceTest {
...
@@ -68,7 +65,7 @@ public class ClientServiceTest {
public
void
getStringMonoTest
(){
public
void
getStringMonoTest
(){
String
uuid
=
"86fd4146-0540-405b-b621-a95f4ccdfa0d"
;
String
uuid
=
"86fd4146-0540-405b-b621-a95f4ccdfa0d"
;
when
(
offerTransactionConfig
.
getPeBaseUrl
()).
thenReturn
(
"http://localhost:8089"
);
when
(
offerTransactionConfig
.
getPeBaseUrl
()).
thenReturn
(
"http://localhost:8089"
);
when
(
offerTransactionConfig
.
getS
c
BaseUrl
()).
thenReturn
(
"http://localhost:8081"
);
when
(
offerTransactionConfig
.
getS
p
BaseUrl
()).
thenReturn
(
"http://localhost:8081"
);
when
(
webClientMock
.
post
()).
thenReturn
(
requestBodyUriMock
);
when
(
webClientMock
.
post
()).
thenReturn
(
requestBodyUriMock
);
when
(
requestBodyUriMock
.
uri
(
"/store/producer"
)).
thenReturn
(
requestBodyMock
);
when
(
requestBodyUriMock
.
uri
(
"/store/producer"
)).
thenReturn
(
requestBodyMock
);
when
(
requestBodyMock
.
bodyValue
(
Mono
.
just
(
uuid
))).
thenReturn
(
requestHeadersMock
);
when
(
requestBodyMock
.
bodyValue
(
Mono
.
just
(
uuid
))).
thenReturn
(
requestHeadersMock
);
...
@@ -91,8 +88,6 @@ public class ClientServiceTest {
...
@@ -91,8 +88,6 @@ public class ClientServiceTest {
return
peRequest
;
return
peRequest
;
}
}
private
PEResponse
getPeResponse
()
{
private
PEResponse
getPeResponse
()
{
PEResponse
peResponse
=
new
PEResponse
();
PEResponse
peResponse
=
new
PEResponse
();
peResponse
.
setHhid
(
"123"
);
peResponse
.
setHhid
(
"123"
);
...
@@ -105,11 +100,4 @@ public class ClientServiceTest {
...
@@ -105,11 +100,4 @@ public class ClientServiceTest {
return
peResponse
;
return
peResponse
;
}
}
}
}
src/test/java/com/nisum/offertransactionservice/controller/OfferControllerTest.java
View file @
5c080d96
...
@@ -64,8 +64,8 @@ public class OfferControllerTest {
...
@@ -64,8 +64,8 @@ public class OfferControllerTest {
}
}
public
List
<
OfferLookup
>
returnOffers
()
{
public
List
<
OfferLookup
>
returnOffers
()
{
OfferLookup
offerLookup1
=
new
OfferLookup
(
"1"
,
"12"
,
"234"
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup1
=
new
OfferLookup
(
1L
,
"12"
,
23L
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
"2"
,
"13"
,
"234"
,
"02"
,
"OR"
,
"BXGY"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
2L
,
"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
);
...
...
src/test/java/com/nisum/offertransactionservice/service/EndOfSaleTest.java
View file @
5c080d96
...
@@ -66,8 +66,8 @@ public class EndOfSaleTest {
...
@@ -66,8 +66,8 @@ public class EndOfSaleTest {
}
}
public
List
<
OfferLookup
>
returnOffers
()
{
public
List
<
OfferLookup
>
returnOffers
()
{
OfferLookup
offerLookup1
=
new
OfferLookup
(
"1"
,
"12"
,
"234"
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup1
=
new
OfferLookup
(
1L
,
"12"
,
23L
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
"2"
,
"13"
,
"234"
,
"02"
,
"OR"
,
"BXGY"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
2L
,
"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
);
...
...
src/test/java/com/nisum/offertransactionservice/service/OfferServiceTest.java
View file @
5c080d96
...
@@ -106,8 +106,8 @@ public class OfferServiceTest {
...
@@ -106,8 +106,8 @@ public class OfferServiceTest {
}
}
public
Iterable
<
OfferLookup
>
returnOffers
()
{
public
Iterable
<
OfferLookup
>
returnOffers
()
{
OfferLookup
offerLookup1
=
new
OfferLookup
(
"1"
,
"12"
,
"234"
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup1
=
new
OfferLookup
(
1L
,
"12"
,
20L
,
"02"
,
"AND"
,
"BOGO"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
"2"
,
"13"
,
"234"
,
"02"
,
"OR"
,
"BXGY"
);
OfferLookup
offerLookup2
=
new
OfferLookup
(
2L
,
"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
);
...
@@ -123,7 +123,7 @@ public class OfferServiceTest {
...
@@ -123,7 +123,7 @@ public class OfferServiceTest {
offerMeta
.
setExpiryTime
(
LocalDateTime
.
of
(
2021
,
01
,
01
,
01
,
01
));
offerMeta
.
setExpiryTime
(
LocalDateTime
.
of
(
2021
,
01
,
01
,
01
,
01
));
offerMeta
.
setStartTime
(
LocalDateTime
.
of
(
2020
,
01
,
01
,
01
,
01
));
offerMeta
.
setStartTime
(
LocalDateTime
.
of
(
2020
,
01
,
01
,
01
,
01
));
offerMeta
.
setOfferDesc
(
"30 percent"
);
offerMeta
.
setOfferDesc
(
"30 percent"
);
offerMeta
.
setOfferId
(
"o1"
);
offerMeta
.
setOfferId
(
1
l
);
offerMeta
.
setOfferStatus
(
"Active"
);
offerMeta
.
setOfferStatus
(
"Active"
);
offerMeta
.
setRcptTxt
(
"text"
);
offerMeta
.
setRcptTxt
(
"text"
);
offerMeta
.
setOfferType
(
"aaa"
);
offerMeta
.
setOfferType
(
"aaa"
);
...
@@ -131,7 +131,6 @@ public class OfferServiceTest {
...
@@ -131,7 +131,6 @@ public class OfferServiceTest {
return
Optional
.
of
(
offerMeta
);
return
Optional
.
of
(
offerMeta
);
}
}
private
List
<
OfferLookupDTO
>
getOfferLookupDto
(){
private
List
<
OfferLookupDTO
>
getOfferLookupDto
(){
OfferLookupDTO
offerLookupDTO
=
new
OfferLookupDTO
();
OfferLookupDTO
offerLookupDTO
=
new
OfferLookupDTO
();
offerLookupDTO
.
setId
(
"123456"
);
offerLookupDTO
.
setId
(
"123456"
);
...
...
src/test/resources/application.properties
View file @
5c080d96
spring.datasource.url
=
jdbc:postgresql://127.0.0.1:5432/
postgres
spring.datasource.url
=
jdbc:postgresql://127.0.0.1:5432/
storedb
spring.datasource.username
=
user
spring.datasource.username
=
postgres
spring.datasource.password
=
password
123
spring.datasource.password
=
welcome
123
endpoint.url.promotionEngineUrl
=
/promotionEngine/calculateDiscount
endpoint.url.promotionEngineUrl
=
/promotionEngine/calculateDiscount
endpoint.url.peBaseUrl
=
http://localhost:808
1
endpoint.url.peBaseUrl
=
http://localhost:808
6
endpoint.url.store
Consum
erUrl
=
/store/producer
endpoint.url.store
Produc
erUrl
=
/store/producer
endpoint.url.s
cBaseUrl
=
http://localhost:8081
endpoint.url.s
pBaseUrl
=
http://localhost:7070
server.port
=
8085
server.port
=
8085
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment