LIGHT

  • News
  • Docs
  • Community
  • Reddit
  • GitHub

User Integration

Integration Test

Get the project from GitHub and build the project:

cd ~/networknt
git clone [email protected]/networknt/light-portal.git
cd light-portal/user-management
mvn clean install

Normal microservice:

It can be run local to and persist the user info to local database only.

Module:

usermanagement-service

Run docker-compose file for the service:

cd ~/networknt/light-portal/user-management

docker-compose up

The docker-compose will start local postgres database and usermanagement-service microservice

Event sourcing microservice:

Integrate the service with light-eventuate-4j framework to process user management with event sourcing. It includes the command side service and query side service.

Module:

rest-coomand – command side service

rest-query – query side service

Before starting any service, we need to make sure that light-eventuate-4j is up and running. Please follow this tutorial to set up.

Run docker-compose file for the service:

cd ~/networknt/light-portal/user-management

docker-compose -f docker-compose-eventuate.yml up

The docker docker-compose-eventuate.yml will start local postgres database (used by query side service) and restful command side service and restful query side service

Verify result:

– New user signup

curl -X POST \
  http://localhost:8080/v1/user \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
   -d '{"screenName":"testUser","contactData":{"email":"[email protected]","firstName":"test1","lastName":"bbb1","addresses":[{"country":"CA","state":"AK","city":"BaBa","addressLine1":"222 Bay Street","addressType":"SHIPPING"}],"gender":"MALE"},"timezone":"CANADA_EASTERN","locale":"English (Canada)","password":"12345678","host":"google","emailChange":false,"passwordReset":false,"screenNameChange":false}
'

– Activate user by the link in the confirm email (replace the token from DB)

curl -X PUT \
  http://localhost:8080/v1/user/token/0000015e2a49af26-0242ac1200020000 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json'

– Get ALL user list (for admin user)

curl -X GET \
  http://localhost:8080/v1/user \
  -H 'cache-control: no-cache' \

–Get user by login in name

curl -X GET \
  'http://localhost:8080/v1/user/name?name=testUser' \
  -H 'cache-control: no-cache' \

–User login

curl -X PUT \
  http://localhost:8080//v1/user/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{"nameOrEmail":"testUser","password":"12345678"}'

– User change (change email)

curl -X PUT \
  http://localhost:8080/v1/user/1080408346077690 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -d '{"screenName":"testUser","contactData":{"email":"[email protected]","gender":"UNKNOWN"},"timezone":"CANADA_EASTERN","locale":"English (Canada)","emailChange":true,"passwordReset":false,"screenNameChange":false}'

– Possword reset

curl -X PUT \
  http://localhost:8081/v1/user/0000015e54ab8932-0242ac1200080000 \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: f88f295d-8bcc-dfad-acd3-0d01d65f40b4' \
  -d '{"screenName":"testUser","password":"22222222", "contactData":{"email":"[email protected]","gender":"UNKNOWN"},"timezone":"CANADA_EASTERN","locale":"English (Canada)","emailChange":false,"passwordReset":true,"screenNameChange":false}'

– Login with token (after password reset, system will require use sign again with new password and confirm token)

curl -X PUT \
  http://localhost:8082/v1/user/login \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 4493c47b-3f83-5c0b-81ed-7032178ca5f6' \
  -d '{"nameOrEmail":"testUser","password":"22222222", "token": "0000015e54c0d4b1-0242ac1200070000"}'

End

  • About Light
    • Overview
    • Testimonials
    • What is Light
    • Features
    • Principles
    • Benefits
    • Roadmap
    • Community
    • Articles
    • Videos
    • License
    • Why Light Platform
  • Getting Started
    • Get Started Overview
    • Environment
    • Light Codegen Tool
    • Light Rest 4j
    • Light Tram 4j
    • Light Graphql 4j
    • Light Hybrid 4j
    • Light Eventuate 4j
    • Light Oauth2
    • Light Portal Service
    • Light Proxy Server
    • Light Router Server
    • Light Config Server
    • Light Saga 4j
    • Light Session 4j
    • Webserver
    • Websocket
    • Spring Boot Servlet
  • Architecture
    • Architecture Overview
    • API Category
    • API Gateway
    • Architecture Patterns
    • CQRS
    • Eco System
    • Event Sourcing
    • Fail Fast vs Fail Slow
    • Integration Patterns
    • JavaEE declining
    • Key Distribution
    • Microservices Architecture
    • Microservices Monitoring
    • Microservices Security
    • Microservices Traceability
    • Modular Monolith
    • Platform Ecosystem
    • Plugin Architecture
    • Scalability and Performance
    • Serverless
    • Service Collaboration
    • Service Mesh
    • SOA
    • Spring is bloated
    • Stages of API Adoption
    • Transaction Management
    • Microservices Cross-cutting Concerns Options
    • Service Mesh Plus
    • Service Discovery
  • Design
    • Design Overview
    • Design First vs Code First
    • Desgin Pattern
    • Service Evolution
    • Consumer Contract and Consumer Driven Contract
    • Handling Partial Failure
    • Idempotency
    • Server Life Cycle
    • Environment Segregation
    • Database
    • Decomposition Patterns
    • Http2
    • Test Driven
    • Multi-Tenancy
    • Why check token expiration
    • WebServices to Microservices
  • Cross-Cutting Concerns
    • Concerns Overview
  • API Styles
    • Light-4j for absolute performance
    • Style Overview
    • Distributed session on IMDG
    • Hybrid Serverless Modularized Monolithic
    • Kafka - Event Sourcing and CQRS
    • REST - Representational state transfer
    • Web Server with Light
    • Websocket with Light
    • Spring Boot Integration
    • Single Page Application
    • GraphQL - A query language for your API
    • Light IBM MQ
    • Light AWS Lambda
    • Chaos Monkey
  • Infrastructure Services
    • Service Overview
    • Light Proxy
    • Light Mesh
    • Light Router
    • Light Portal
    • Messaging Infrastructure
    • Centralized Logging
    • COVID-19
    • Light OAuth2
    • Metrics and Alerts
    • Config Server
    • Tokenization
    • Light Controller
  • Tool Chain
    • Tool Chain Overview
  • Utility Library
  • Service Consumer
    • Service Consumer
  • Development
    • Development Overview
  • Deployment
    • Deployment Overview
    • Frontend Backend
    • Linux Service
    • Windows Service
    • Install Eventuate on Windows
    • Secure API
    • Client vs light-router
    • Memory Limit
    • Deploy to Kubernetes
  • Benchmark
    • Benchmark Overview
  • Tutorial
    • Tutorial Overview
  • Troubleshooting
    • Troubleshoot
  • FAQ
    • FAQ Overview
  • Milestones
  • Contribute
    • Contribute to Light
    • Development
    • Documentation
    • Example
    • Tutorial
“User Integration” was last updated: July 5, 2021: fixes #275 checked and corrected grammar/spelling for majority of pages (#276) (b3bbb7b)
Improve this page
  • News
  • Docs
  • Community
  • Reddit
  • GitHub
  • About Light
  • Getting Started
  • Architecture
  • Design
  • Cross-Cutting Concerns
  • API Styles
  • Infrastructure Services
  • Tool Chain
  • Utility Library
  • Service Consumer
  • Development
  • Deployment
  • Benchmark
  • Tutorial
  • Troubleshooting
  • FAQ
  • Milestones
  • Contribute