diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml
index 42d718a..6532eeb 100644
--- a/api-gateway/pom.xml
+++ b/api-gateway/pom.xml
@@ -4,53 +4,58 @@
com.quebic.apigateway
api-gateway
- 0.0.1-SNAPSHOT
+ 0.1.1-SNAPSHOT
jar
api-gateway
- http://maven.apache.org
+
-
1.8
-
-
8080
-
+ 1.4.7.RELEASE
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.5.RELEASE
+
-
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
-
-
-
- org.springframework.cloud
- spring-cloud-starter
-
-
-
+
- org.springframework.cloud
- spring-cloud-starter-eureka-server
+ org.springframework.boot
+ spring-boot-starter-undertow
-
+
+
+
+
+
+
+
+
+
+
org.springframework.cloud
spring-cloud-starter-zuul
+ ${zuul.version}
-
-
+
ch.qos.logback
logback-classic
@@ -60,16 +65,13 @@
ch.qos.logback
logback-core
-
-
org.springframework.boot
spring-boot-devtools
true
-
org.springframework.boot
spring-boot-starter-test
@@ -82,7 +84,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Dalston.RELEASE
+ Greenwich.RELEASE
pom
import
diff --git a/api-gateway/src/main/java/com/quebic/apigateway/App.java b/api-gateway/src/main/java/com/quebic/apigateway/App.java
index e2b5e5a..2393f63 100644
--- a/api-gateway/src/main/java/com/quebic/apigateway/App.java
+++ b/api-gateway/src/main/java/com/quebic/apigateway/App.java
@@ -8,10 +8,8 @@
@EnableZuulProxy
@EnableDiscoveryClient
@SpringBootApplication
-public class App
-{
- public static void main( String[] args )
- {
- SpringApplication.run(App.class, args);
+public class App {
+ public static void main(String[] args) {
+ SpringApplication.run(App.class, args);
}
}
diff --git a/api-gateway/src/test/java/com/nexca/apigateway/AppTest.java b/api-gateway/src/test/java/com/nexca/apigateway/AppTest.java
index e0c0394..1f4e14f 100644
--- a/api-gateway/src/test/java/com/nexca/apigateway/AppTest.java
+++ b/api-gateway/src/test/java/com/nexca/apigateway/AppTest.java
@@ -7,32 +7,27 @@
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
+public class AppTest extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
- public AppTest( String testName )
- {
- super( testName );
+ public AppTest(String testName) {
+ super(testName);
}
/**
* @return the suite of tests being tested
*/
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
+ public static Test suite() {
+ return new TestSuite(AppTest.class);
}
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ public void testApp() {
+ assertTrue(true);
}
}
diff --git a/auth-service/pom.xml b/auth-service/pom.xml
index ebab5f9..bc18ca8 100644
--- a/auth-service/pom.xml
+++ b/auth-service/pom.xml
@@ -4,22 +4,22 @@
com.quebic.auth.api
auth-service
- 0.0.1-SNAPSHOT
+ 0.1.1-SNAPSHOT
jar
auth-service
- http://maven.apache.org
+
1.8
- 0.7.0
- 1.1.6
+ 0.9.1
+ 1.3.8
4.2
1.4
- 3.10.1
- 0.0.1-SNAPSHOT
+ 4.1.0
+ 0.1.1-SNAPSHOT
81
@@ -37,55 +37,62 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.5.RELEASE
+
-
-
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
-
-
+
- org.springframework.cloud
- spring-cloud-starter
+ org.springframework.boot
+ spring-boot-starter-undertow
-
org.springframework.cloud
- spring-cloud-starter-eureka-server
+ spring-cloud-starter
+
+
+
+
+
-
org.springframework.boot
spring-boot-starter-security
-
org.springframework.data
spring-data-mongodb
-
-
+
+ de.flapdoodle.embed
+ de.flapdoodle.embed.mongo
+
org.springframework.mobile
spring-mobile-device
+ 1.1.5.RELEASE
-
io.jsonwebtoken
jjwt
${jjwt.version}
-
io.reactivex
rxjava
@@ -93,44 +100,46 @@
-
- ch.qos.logback
- logback-classic
-
-
-
- ch.qos.logback
- logback-core
-
+
+
+
+
+
+
+
+
+
-
javax.mail
mail
${mail.version}
-
com.quebic.common
common-lib
${common.lib.version}
-
org.springframework.boot
spring-boot-devtools
true
-
org.springframework.boot
spring-boot-starter-test
+
+ org.projectlombok
+ lombok
+ 1.18.8
+ compile
+
@@ -138,7 +147,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Dalston.RELEASE
+ Greenwich.RELEASE
pom
import
diff --git a/auth-service/src/main/java/com/quebic/auth/api/App.java b/auth-service/src/main/java/com/quebic/auth/api/App.java
index 9e3d65e..d27c545 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/App.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/App.java
@@ -10,10 +10,8 @@
@EnableDiscoveryClient
@EnableCaching
@EnableScheduling
-public class App
-{
- public static void main( String[] args )
- {
+public class App {
+ public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
diff --git a/auth-service/src/main/java/com/quebic/auth/api/config/AppConfiguration.java b/auth-service/src/main/java/com/quebic/auth/api/config/AppConfiguration.java
index 1114ff7..9c6d0b7 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/config/AppConfiguration.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/config/AppConfiguration.java
@@ -1,8 +1,8 @@
package com.quebic.auth.api.config;
import java.util.Map;
-import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
-import org.springframework.boot.autoconfigure.web.ErrorAttributes;
+//import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
+//import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.cache.CacheManager;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
@@ -25,19 +25,19 @@
@Import({AsyncConfig.class, SseConfig.class, DaoConfig.class, CacheConfig.class})
public class AppConfiguration {
- @Bean
- public ErrorAttributes errorAttributes() {
-
- return new DefaultErrorAttributes(){
- @Override
- public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
- Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
- errorAttributes.remove("exception");
- return errorAttributes;
- }
- };
-
- }
+// @Bean
+// public ErrorAttributes errorAttributes() {
+//
+// return new DefaultErrorAttributes(){
+// @Override
+// public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
+// Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
+// errorAttributes.remove("exception");
+// return errorAttributes;
+// }
+// };
+//
+// }
@Bean
public PasswordEncoder loadPasswordEncoder() {
@@ -66,7 +66,8 @@ public CacheManager cacheManager() {
, "RoleDaoImpl"
, "PermissionDaoImpl");
}
-
+
+// from Spring Cloud starter
@LoadBalanced
@Bean
public RestTemplate restTemplate() {
diff --git a/auth-service/src/main/java/com/quebic/auth/api/model/BuyerProfile.java b/auth-service/src/main/java/com/quebic/auth/api/model/BuyerProfile.java
index a123764..0f806ae 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/model/BuyerProfile.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/model/BuyerProfile.java
@@ -1,21 +1,14 @@
package com.quebic.auth.api.model;
+import lombok.Getter;
+import lombok.Setter;
+
import java.util.ArrayList;
import java.util.List;
+@Getter
+@Setter
public class BuyerProfile {
-
- //temp fields
- private List orders = new ArrayList<>();
-
- public List getOrders() {
- return orders;
- }
-
- public void setOrders(List orders) {
- this.orders = orders;
- }
-
-
-
+ //temp fields
+ private List orders = new ArrayList<>();
}
diff --git a/auth-service/src/main/java/com/quebic/auth/api/model/Role.java b/auth-service/src/main/java/com/quebic/auth/api/model/Role.java
index f86f205..72019ac 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/model/Role.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/model/Role.java
@@ -1,16 +1,24 @@
package com.quebic.auth.api.model;
-import java.util.ArrayList;
-import java.util.List;
-import org.springframework.data.mongodb.core.mapping.DBRef;
-import org.springframework.data.mongodb.core.mapping.Document;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.quebic.common.model.EntityBase;
import com.quebic.common.model.Permission;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import org.springframework.data.mongodb.core.mapping.DBRef;
+import org.springframework.data.mongodb.core.mapping.Document;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@Getter
+@Setter
+@Document(collection = "Role")
+@NoArgsConstructor
+public class Role extends EntityBase {
-@Document(collection="Role")
-public class Role extends EntityBase{
-
public static final String ROLE_ADMIN = "role.admin";
public static final String ROLE_SELLER_ADMIN = "role.seller.admin";
public static final String ROLE_SELLER = "role.seller";
@@ -21,76 +29,41 @@ public class Role extends EntityBase{
@DBRef
private List permissions = new ArrayList<>();
- public Role() {
- }
-
- public Role(String id){
- setId(id);
- }
-
- public String getCode() {
- return this.code;
+ public Role(String id) {
+ setId(id);
}
- public void setCode(String name) {
- this.code = name;
+ //TODO
+ @JsonIgnore
+ public List getPermissions() {
+ return permissions;
}
- @JsonIgnore
- public List getPermissions() {
- return permissions;
- }
-
- public void setPermissions(List permissions) {
- this.permissions = permissions;
- }
-
- public static Role Create_Admin(){
- return new Role(Role.ROLE_ADMIN);
- }
-
- public static Role Create_Seller_Admin(){
- return new Role(Role.ROLE_SELLER_ADMIN);
- }
-
- public static Role Create_Seller(){
- return new Role(Role.ROLE_SELLER);
- }
-
- public static Role Create_Buyer(){
- return new Role(Role.ROLE_BUYER);
- }
-
- public static boolean checkUserIs_Admin(User user){
- return checkUserType(user, Role.Create_Admin());
- }
-
- public static boolean checkUserIs_Seller_Admin(User user){
- return checkUserType(user, Role.Create_Seller_Admin());
- }
-
- public static boolean checkUserIs_Seller(User user){
- return checkUserType(user, Role.Create_Seller());
- }
-
- public static boolean checkUserIs_Buyer(User user){
- return checkUserType(user, Role.Create_Buyer());
- }
-
- public static boolean checkUserType(User user, Role... roles){
-
- for(Role checkRole : roles){
-
- if(user.getRoles().contains(checkRole))
- return true;
-
- }
-
- return false;
-
-
- }
-
-
-
-}
+ public static Role Create_Admin() { return new Role(Role.ROLE_ADMIN); }
+
+ public static Role Create_Seller_Admin() { return new Role(Role.ROLE_SELLER_ADMIN); }
+
+ public static Role Create_Seller() { return new Role(Role.ROLE_SELLER); }
+
+ public static Role Create_Buyer() { return new Role(Role.ROLE_BUYER); }
+
+ public static boolean checkUserIs_Admin(User user) { return checkUserType(user, Role.Create_Admin()); }
+
+ public static boolean checkUserIs_Seller_Admin(User user) { return checkUserType(user, Role.Create_Seller_Admin()); }
+
+ public static boolean checkUserIs_Seller(User user) { return checkUserType(user, Role.Create_Seller()); }
+
+ public static boolean checkUserIs_Buyer(User user) { return checkUserType(user, Role.Create_Buyer()); }
+
+ public static boolean checkUserType(User user, Role... roles) {
+ boolean containsRole = Arrays.stream(roles).anyMatch(checkRole -> user.getRoles().contains(checkRole));
+ return containsRole;
+// for(Role checkRole : roles){
+//
+// if(user.getRoles().contains(checkRole))
+// return true;
+//
+// }
+// return false;
+ }
+}
\ No newline at end of file
diff --git a/auth-service/src/main/java/com/quebic/auth/api/model/SellerProfile.java b/auth-service/src/main/java/com/quebic/auth/api/model/SellerProfile.java
index 464a3d9..b9cec1f 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/model/SellerProfile.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/model/SellerProfile.java
@@ -1,8 +1,12 @@
package com.quebic.auth.api.model;
+import lombok.Getter;
+import lombok.Setter;
+
import java.util.ArrayList;
import java.util.List;
+@Getter @Setter
public class SellerProfile {
private String storeId;
@@ -30,134 +34,4 @@ public class SellerProfile {
private String contactZipCode;
private String contactPhone;
private String contactEmail;
-
- public String getStoreId() {
- return storeId;
- }
- public void setStoreId(String storeId) {
- this.storeId = storeId;
- }
- public List getBusinessClariifications() {
- return businessClariifications;
- }
- public void setBusinessClariifications(List businessClariifications) {
- this.businessClariifications = businessClariifications;
- }
- public List getDeals() {
- return deals;
- }
- public void setDeals(List deals) {
- this.deals = deals;
- }
- public String getLegalBusinessName() {
- return legalBusinessName;
- }
- public void setLegalBusinessName(String legalBusinessName) {
- this.legalBusinessName = legalBusinessName;
- }
- public String getBusinessAddress() {
- return businessAddress;
- }
- public void setBusinessAddress(String businessAddress) {
- this.businessAddress = businessAddress;
- }
- public String getPhysicalAddress() {
- return physicalAddress;
- }
- public void setPhysicalAddress(String physicalAddress) {
- this.physicalAddress = physicalAddress;
- }
- public String getCity() {
- return city;
- }
- public void setCity(String city) {
- this.city = city;
- }
- public String getState() {
- return state;
- }
- public void setState(String state) {
- this.state = state;
- }
- public String getZipCode() {
- return zipCode;
- }
- public void setZipCode(String zipCode) {
- this.zipCode = zipCode;
- }
- public String getBusinessLocatedCountry() {
- return businessLocatedCountry;
- }
- public void setBusinessLocatedCountry(String businessLocatedCountry) {
- this.businessLocatedCountry = businessLocatedCountry;
- }
- public String getBusinessPhone() {
- return businessPhone;
- }
- public void setBusinessPhone(String businessPhone) {
- this.businessPhone = businessPhone;
- }
- public String getBusinessWebsite() {
- return businessWebsite;
- }
- public void setBusinessWebsite(String businessWebsite) {
- this.businessWebsite = businessWebsite;
- }
- public String getContactFirstName() {
- return contactFirstName;
- }
- public void setContactFirstName(String contactFirstName) {
- this.contactFirstName = contactFirstName;
- }
- public String getContactLastName() {
- return contactLastName;
- }
- public void setContactLastName(String contactLastName) {
- this.contactLastName = contactLastName;
- }
- public String getContactBusinessAddress() {
- return contactBusinessAddress;
- }
- public void setContactBusinessAddress(String contactBusinessAddress) {
- this.contactBusinessAddress = contactBusinessAddress;
- }
- public String getContactPhysicalAddress() {
- return contactPhysicalAddress;
- }
- public void setContactPhysicalAddress(String contactPhysicalAddress) {
- this.contactPhysicalAddress = contactPhysicalAddress;
- }
- public String getContactCity() {
- return contactCity;
- }
- public void setContactCity(String contactCity) {
- this.contactCity = contactCity;
- }
- public String getContactState() {
- return contactState;
- }
- public void setContactState(String contactState) {
- this.contactState = contactState;
- }
- public String getContactZipCode() {
- return contactZipCode;
- }
- public void setContactZipCode(String contactZipCode) {
- this.contactZipCode = contactZipCode;
- }
- public String getContactPhone() {
- return contactPhone;
- }
- public void setContactPhone(String contactPhone) {
- this.contactPhone = contactPhone;
- }
- public String getContactEmail() {
- return contactEmail;
- }
- public void setContactEmail(String contactEmail) {
- this.contactEmail = contactEmail;
- }
-
-
-
}
diff --git a/auth-service/src/main/java/com/quebic/auth/api/model/User.java b/auth-service/src/main/java/com/quebic/auth/api/model/User.java
index 788da70..6058909 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/model/User.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/model/User.java
@@ -3,6 +3,9 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+
+import lombok.Getter;
+import lombok.Setter;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -10,6 +13,7 @@
import com.quebic.common.model.Permission;
import com.quebic.common.model.image.ImageContainer;
+@Getter @Setter
@Document(collection="User")
public class User extends EntityBase{
@@ -46,47 +50,12 @@ public class User extends EntityBase{
private SellerProfile sellerProfile = new SellerProfile();
private BuyerProfile buyerProfile = new BuyerProfile();
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
+ //TODO
@JsonIgnore
public String getPassword() {
return password;
}
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
public ImageContainer getProfileImageContainer() {
return profileImageContainer;
}
@@ -103,30 +72,6 @@ public void setCoverImageContainer(ImageContainer coverImageContainer) {
this.coverImageContainer = coverImageContainer;
}
- public Date getLastLoggedOn() {
- return lastLoggedOn;
- }
-
- public void setLastLoggedOn(Date lastLoggedOn) {
- this.lastLoggedOn = lastLoggedOn;
- }
-
- public Date getRegisteredOn() {
- return registeredOn;
- }
-
- public void setRegisteredOn(Date registeredOn) {
- this.registeredOn = registeredOn;
- }
-
- public Integer getAttempts() {
- return attempts;
- }
-
- public void setAttempts(Integer attempts) {
- this.attempts = attempts;
- }
-
public List getRoles() {
return roles;
}
@@ -140,42 +85,14 @@ public List getPermissions() {
return permissions;
}
- public void setPermissions(List permissions) {
- this.permissions = permissions;
- }
-
@JsonIgnore
public EmailVerification getEmailVerification() {
return emailVerification;
}
- public void setEmailVerification(EmailVerification emailVerification) {
- this.emailVerification = emailVerification;
- }
-
@JsonIgnore
public Date getLastPasswordResetDate() {
return lastPasswordResetDate;
}
- public void setLastPasswordResetDate(Date lastPasswordResetDate) {
- this.lastPasswordResetDate = lastPasswordResetDate;
- }
-
- public SellerProfile getSellerProfile() {
- return sellerProfile;
- }
-
- public void setSellerProfile(SellerProfile sellerProfile) {
- this.sellerProfile = sellerProfile;
- }
-
- public BuyerProfile getBuyerProfile() {
- return buyerProfile;
- }
-
- public void setBuyerProfile(BuyerProfile buyerProfile) {
- this.buyerProfile = buyerProfile;
- }
-
}
diff --git a/auth-service/src/main/java/com/quebic/auth/api/security/JwtUser.java b/auth-service/src/main/java/com/quebic/auth/api/security/JwtUser.java
index 6384ecd..49a5696 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/security/JwtUser.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/security/JwtUser.java
@@ -1,44 +1,45 @@
package com.quebic.auth.api.security;
-import java.util.Collection;
-import java.util.Date;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.quebic.auth.api.model.User;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+import java.util.Collection;
+import java.util.Date;
public class JwtUser implements UserDetails {
- private static final long serialVersionUID = -1728234246191170692L;
-
- private User user;
+ private static final long serialVersionUID = -1728234246191170692L;
+
+ private User user;
private final Collection extends GrantedAuthority> authorities;
private final boolean enabled;
public JwtUser(
- User user
- , Collection extends GrantedAuthority> authorities
- , boolean enabled) {
-
- this.user = user;
- this.authorities = authorities;
- this.enabled = enabled;
-
- }
+ User user
+ , Collection extends GrantedAuthority> authorities
+ , boolean enabled) {
+
+ this.user = user;
+ this.authorities = authorities;
+ this.enabled = enabled;
+
+ }
public User getDbUser() {
- return user;
- }
-
+ return user;
+ }
+
public Date getLastPasswordResetDate() {
return user.getLastPasswordResetDate();
}
- @Override
+ @Override
public String getUsername() {
return user.getEmail();
}
-
+
@JsonIgnore
@Override
public String getPassword() {
@@ -72,5 +73,5 @@ public Collection extends GrantedAuthority> getAuthorities() {
public boolean isEnabled() {
return enabled;
}
-
+
}
diff --git a/auth-service/src/main/java/com/quebic/auth/api/service/UserService.java b/auth-service/src/main/java/com/quebic/auth/api/service/UserService.java
index 606a895..ad7b7ab 100644
--- a/auth-service/src/main/java/com/quebic/auth/api/service/UserService.java
+++ b/auth-service/src/main/java/com/quebic/auth/api/service/UserService.java
@@ -1,27 +1,26 @@
package com.quebic.auth.api.service;
-import java.util.List;
-
import com.quebic.auth.api.dto.UserImageDto;
import com.quebic.auth.api.model.User;
import com.quebic.common.service.GenericService;
-
import rx.Single;
-public interface UserService extends GenericService{
-
- Single findByEmail(String email);
-
- Single findByUsernameOrEmail(String username, String email);
-
- Single edit(User user, UserImageDto imageDto);
-
- Single delete(String id);
-
- Single delete(List idList);
-
- Single findUserByToken(String token);
-
- Single changePassword(String oldPassword, String newPassword);
-
+import java.util.List;
+
+public interface UserService extends GenericService {
+
+ Single findByEmail(String email);
+
+ Single findByUsernameOrEmail(String username, String email);
+
+ Single edit(User user, UserImageDto imageDto);
+
+ Single delete(String id);
+
+ Single delete(List idList);
+
+ Single findUserByToken(String token);
+
+ Single changePassword(String oldPassword, String newPassword);
+
}
diff --git a/common-lib/pom.xml b/common-lib/pom.xml
index c4a3521..f78a710 100644
--- a/common-lib/pom.xml
+++ b/common-lib/pom.xml
@@ -4,52 +4,50 @@
com.quebic.common
common-lib
- 0.0.1-SNAPSHOT
+ 0.1.1-SNAPSHOT
jar
common-lib
- http://maven.apache.org
+
1.8
- 0.7.0
- 1.1.6
- 2.1.1
+ 0.9.1
+ 1.3.8
+ 3.1.0
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.5.RELEASE
+
-
-
org.springframework.boot
spring-boot-starter-web
+ compile
-
org.springframework.data
spring-data-mongodb
+ compile
-
org.springframework.security
spring-security-web
-
org.springframework.mobile
spring-mobile-device
+ 1.1.5.RELEASE
-
io.jsonwebtoken
jjwt
@@ -64,39 +62,35 @@
-
- ch.qos.logback
- logback-classic
-
-
-
- ch.qos.logback
- logback-core
-
+
+
+
+
+
+
+
+
+
-
com.dropbox.core
dropbox-core-sdk
${dropbox.version}
-
org.imgscalr
imgscalr-lib
4.2
-
-
- org.springframework.boot
- spring-boot-devtools
- true
-
+
+
+
+
+
-
org.springframework.boot
spring-boot-starter-test
diff --git a/discovery-server/pom.xml b/discovery-server/pom.xml
index f965376..4805378 100644
--- a/discovery-server/pom.xml
+++ b/discovery-server/pom.xml
@@ -8,7 +8,7 @@
jar
discovery-server
- http://maven.apache.org
+
1.8
@@ -18,37 +18,44 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.5.RELEASE
+
-
-
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
-
org.springframework.cloud
spring-cloud-starter
-
org.springframework.cloud
spring-cloud-starter-eureka-server
+ 1.4.7.RELEASE
-
org.springframework.boot
spring-boot-devtools
true
-
ch.qos.logback
logback-classic
@@ -59,7 +66,6 @@
logback-core
-
org.springframework.boot
spring-boot-starter-test
@@ -72,7 +78,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Dalston.RELEASE
+ Greenwich.RELEASE
pom
import
diff --git a/discovery-server/src/main/java/com/quebic/discoveryserver/App.java b/discovery-server/src/main/java/com/quebic/discoveryserver/App.java
index 2ae36c3..7e7f6f9 100644
--- a/discovery-server/src/main/java/com/quebic/discoveryserver/App.java
+++ b/discovery-server/src/main/java/com/quebic/discoveryserver/App.java
@@ -6,10 +6,8 @@
@SpringBootApplication
@EnableEurekaServer
-public class App
-{
- public static void main( String[] args )
- {
- SpringApplication.run(App.class, args);
+public class App {
+ public static void main(String[] args) {
+ SpringApplication.run(App.class, args);
}
}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..7336021
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,21 @@
+
+
+ 4.0.0
+
+ com.rdas
+ microservices-parent-project
+ 0.0.1-SNAPSHOT
+ pom
+
+ microservices-parent-project
+ Spring Boot microservices parent
+
+
+ common-lib
+ api-gateway
+ auth-service
+ discovery-server
+ product-service
+
+
diff --git a/product-service/pom.xml b/product-service/pom.xml
index 109a2d6..917a3f8 100644
--- a/product-service/pom.xml
+++ b/product-service/pom.xml
@@ -14,12 +14,12 @@
1.8
- 0.7.0
- 1.1.6
+ 0.9.1
+ 1.3.8
4.2
1.4
- 3.10.1
- 0.0.1-SNAPSHOT
+ 4.1.0
+ 0.1.1-SNAPSHOT
82
@@ -34,62 +34,69 @@
org.springframework.boot
spring-boot-starter-parent
- 1.4.2.RELEASE
+ 2.1.5.RELEASE
+
-
-
org.springframework.boot
spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
-
-
+
+
+ org.springframework.boot
+ spring-boot-starter-undertow
+
+
org.springframework.cloud
spring-cloud-starter
-
org.springframework.cloud
spring-cloud-starter-eureka-server
+ 1.4.7.RELEASE
-
org.springframework.boot
spring-boot-starter-security
-
org.springframework.data
spring-data-mongodb
-
-
+
+ de.flapdoodle.embed
+ de.flapdoodle.embed.mongo
+
org.springframework.mobile
spring-mobile-device
+ 1.1.5.RELEASE
-
io.jsonwebtoken
jjwt
${jjwt.version}
-
io.reactivex
rxjava
${rxjava.version}
-
ch.qos.logback
logback-classic
@@ -99,9 +106,7 @@
ch.qos.logback
logback-core
-
-
com.quebic.common
common-lib
@@ -115,12 +120,17 @@
true
-
org.springframework.boot
spring-boot-starter-test
+
+ org.projectlombok
+ lombok
+ 1.18.8
+ compile
+
@@ -128,7 +138,7 @@
org.springframework.cloud
spring-cloud-dependencies
- Dalston.RELEASE
+ Greenwich.RELEASE
pom
import
@@ -137,7 +147,6 @@
-
org.springframework.boot
spring-boot-maven-plugin
diff --git a/product-service/src/main/java/com/quebic/product/api/config/AppConfiguration.java b/product-service/src/main/java/com/quebic/product/api/config/AppConfiguration.java
index ea156b6..ecf52d2 100644
--- a/product-service/src/main/java/com/quebic/product/api/config/AppConfiguration.java
+++ b/product-service/src/main/java/com/quebic/product/api/config/AppConfiguration.java
@@ -1,8 +1,8 @@
package com.quebic.product.api.config;
import java.util.Map;
-import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
-import org.springframework.boot.autoconfigure.web.ErrorAttributes;
+//import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
+//import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.cache.CacheManager;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
@@ -25,20 +25,20 @@
@Import({AsyncConfig.class, SseConfig.class, DaoConfig.class, SecurityConfig.class, CacheConfig.class})
public class AppConfiguration {
- @Bean
- public ErrorAttributes errorAttributes() {
-
- return new DefaultErrorAttributes(){
- @Override
- public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
- Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
- errorAttributes.remove("exception");
- return errorAttributes;
- }
- };
-
- }
-
+// @Bean
+// public ErrorAttributes errorAttributes() {
+//
+// return new DefaultErrorAttributes(){
+// @Override
+// public Map getErrorAttributes(RequestAttributes requestAttributes, boolean includeStackTrace) {
+// Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace);
+// errorAttributes.remove("exception");
+// return errorAttributes;
+// }
+// };
+//
+// }
+//
@Bean
public PasswordEncoder loadPasswordEncoder() {
return new BCryptPasswordEncoder();
diff --git a/product-service/src/main/java/com/quebic/product/api/controller/ProductController.java b/product-service/src/main/java/com/quebic/product/api/controller/ProductController.java
index 05ea144..2096d79 100644
--- a/product-service/src/main/java/com/quebic/product/api/controller/ProductController.java
+++ b/product-service/src/main/java/com/quebic/product/api/controller/ProductController.java
@@ -1,43 +1,38 @@
package com.quebic.product.api.controller;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
import com.quebic.common.async.response.AsyncResponseEntity;
import com.quebic.common.util.ControllerBase;
import com.quebic.product.api.model.Product;
import com.quebic.product.api.service.ProductService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/products")
-public class ProductController extends ControllerBase{
+public class ProductController extends ControllerBase {
- @Autowired
- private ProductService productService;
-
- @RequestMapping
+ @Autowired
+ private ProductService productService;
+
+ @RequestMapping
public AsyncResponseEntity getAll() {
- return makeAsyncResponse(productService.getAll());
+ return makeAsyncResponse(productService.getAll());
}
-
- @RequestMapping("/{id}")
+
+ @RequestMapping("/{id}")
public AsyncResponseEntity getById(@PathVariable("id") String id) {
- return makeAsyncResponse(productService.getById(id));
+ return makeAsyncResponse(productService.getById(id));
}
-
- @RequestMapping(method = RequestMethod.POST)
+
+ @RequestMapping(method = RequestMethod.POST)
public AsyncResponseEntity add(@ModelAttribute Product product) {
- return makeAsyncResponse(productService.add(product), HttpStatus.CREATED);
+ return makeAsyncResponse(productService.add(product), HttpStatus.CREATED);
}
-
+
@RequestMapping(method = RequestMethod.PUT)
public AsyncResponseEntity edit(@ModelAttribute Product product) {
- return makeAsyncResponse(productService.edit(product), HttpStatus.ACCEPTED);
+ return makeAsyncResponse(productService.edit(product), HttpStatus.ACCEPTED);
}
-
+
}
diff --git a/product-service/src/main/java/com/quebic/product/api/model/Product.java b/product-service/src/main/java/com/quebic/product/api/model/Product.java
index 4b0eea0..4495d4e 100644
--- a/product-service/src/main/java/com/quebic/product/api/model/Product.java
+++ b/product-service/src/main/java/com/quebic/product/api/model/Product.java
@@ -1,33 +1,15 @@
package com.quebic.product.api.model;
-import org.springframework.data.mongodb.core.mapping.Document;
-
import com.quebic.common.model.EntityBase;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.data.mongodb.core.mapping.Document;
+@Getter
+@Setter
@Document(collection = "Product")
-public class Product extends EntityBase{
-
- private String sellerId;
- private String name;
- private double price;
-
- public String getSellerId() {
- return sellerId;
- }
- public void setSellerId(String sellerId) {
- this.sellerId = sellerId;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public double getPrice() {
- return price;
- }
- public void setPrice(double price) {
- this.price = price;
- }
-
+public class Product extends EntityBase {
+ private String sellerId;
+ private String name;
+ private double price;
}
diff --git a/product-service/src/main/java/com/quebic/product/api/security/config/WebSecurityConfig.java b/product-service/src/main/java/com/quebic/product/api/security/config/WebSecurityConfig.java
index 3cf4481..aa8cd89 100644
--- a/product-service/src/main/java/com/quebic/product/api/security/config/WebSecurityConfig.java
+++ b/product-service/src/main/java/com/quebic/product/api/security/config/WebSecurityConfig.java
@@ -1,5 +1,8 @@
package com.quebic.product.api.security.config;
+import com.quebic.common.model.Permission;
+import com.quebic.common.security.CommonAuthenticationEntryPoint;
+import com.quebic.common.security.CommonAuthenticationTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -11,10 +14,6 @@
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-import com.quebic.common.model.Permission;
-import com.quebic.common.security.CommonAuthenticationEntryPoint;
-import com.quebic.common.security.CommonAuthenticationTokenFilter;
-
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@@ -41,11 +40,11 @@ protected void configure(HttpSecurity httpSecurity) throws Exception {
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
-
+
.antMatchers(HttpMethod.GET, "/products/**").permitAll()
.antMatchers(HttpMethod.POST, "/products/**").hasRole(Permission.USER_SELLER)
- .antMatchers(HttpMethod.PUT, "/products/**").hasRole(Permission.USER_SELLER)
-
+ .antMatchers(HttpMethod.PUT, "/products/**").hasRole(Permission.USER_SELLER)
+
//authenticated requests
.anyRequest().authenticated();
@@ -56,5 +55,5 @@ protected void configure(HttpSecurity httpSecurity) throws Exception {
// disable page caching
httpSecurity.headers().cacheControl();
}
-
+
}
diff --git a/product-service/src/main/java/com/quebic/product/api/service/impl/ProductServiceImpl.java b/product-service/src/main/java/com/quebic/product/api/service/impl/ProductServiceImpl.java
index 608eb79..2411e7e 100644
--- a/product-service/src/main/java/com/quebic/product/api/service/impl/ProductServiceImpl.java
+++ b/product-service/src/main/java/com/quebic/product/api/service/impl/ProductServiceImpl.java
@@ -36,5 +36,4 @@ public Single edit(Product product) {
product.setSellerId(sellerId);
return super.edit(product);
}
-
}
diff --git a/product-service/src/test/java/com/nexca/core/AppTest.java b/product-service/src/test/java/com/nexca/core/AppTest.java
index 5476b0b..5db7870 100644
--- a/product-service/src/test/java/com/nexca/core/AppTest.java
+++ b/product-service/src/test/java/com/nexca/core/AppTest.java
@@ -7,32 +7,28 @@
/**
* Unit test for simple App.
*/
-public class AppTest
- extends TestCase
-{
+public class AppTest
+ extends TestCase {
/**
* Create the test case
*
* @param testName name of the test case
*/
- public AppTest( String testName )
- {
- super( testName );
+ public AppTest(String testName) {
+ super(testName);
}
/**
* @return the suite of tests being tested
*/
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
+ public static Test suite() {
+ return new TestSuite(AppTest.class);
}
/**
* Rigourous Test :-)
*/
- public void testApp()
- {
- assertTrue( true );
+ public void testApp() {
+ assertTrue(true);
}
}