This commit is contained in:
MSI\migue 2025-05-29 15:23:11 -04:00
commit e8fec5cc70
106 changed files with 7007 additions and 0 deletions

145
.drone.yml Normal file
View File

@ -0,0 +1,145 @@
clone:
disable: true
kind: pipeline
type: docker
name: spring-boot-java21
workspace:
base: /drone/src
steps:
- name: manual-clone
image: alpine/git
commands:
- git clone http://10.0.0.126:3000/${DRONE_REPO}.git .
# Paso 1: Build y tests con Maven (Java 21)
- name: build-and-test
image: maven:3.9-eclipse-temurin-21-alpine
environment:
MAVEN_OPTS: -Xmx2048m -XX:+TieredCompilation -XX:TieredStopAtLevel=1
commands:
- mvn clean verify
- mvn jacoco:report
volumes:
- name: maven-cache
path: /root/.m2
# Paso 2: Análisis SonarQube con Maven
- name: sonarqube-analysis
image: maven:3.9-eclipse-temurin-21-alpine
environment:
SONAR_HOST_URL: http://10.0.0.126:9000
SONAR_LOGIN: squ_465ae384ffda803d8e58d9ef0111bef1277c874a
SONAR_PROJECT_KEY: hhh
commands:
- mvn clean verify sonar:sonar -DskipTests
volumes:
- name: maven-cache
path: /root/.m2
when:
event: [push, pull_request]
# Paso 3: Build y Push de Docker Image a Nexus usando plugin oficial
- name: docker-build-push
image: plugins/docker
settings:
registry: 10.0.0.126:8081
insecure: true
repo: 10.0.0.126:8081/docker-repository/${DRONE_REPO_NAME}
tags: ${DRONE_BUILD_NUMBER}
username: yandel
password: yandel
dockerfile: src/main/docker/dockerfile
# Paso 4: Despliegue en Servidor Externo
- name: deploy-to-server
image: appleboy/drone-ssh
environment:
REGISTRY_ADDRESS: 10.0.0.126:8081
REPOSITORY_NAME: docker-repository
settings:
host:
- 10.0.0.117
- 10.0.0.116
username:
from_secret: ssh_usuario_117
password:
from_secret: ssh_password_117
port: 22
command_timeout: 2m
script:
- echo "Iniciando despliegue..."
- docker login -u yandel -p yandel 10.0.0.126:8081
- docker stop mi-app || true
- docker rm mi-app || true
#- docker pull 10.0.0.126:8081/docker-repository/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER}
#- docker run -d --name mi-app -p 8082:8080 10.0.0.126:8081/docker-repository/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER}
- docker pull 10.0.0.126:8085/docker-repository/prueba:${DRONE_BUILD_NUMBER}
- docker run -d --restart=always --name mi-app-prueba -p 8082:8080 10.0.0.126:8085/docker-repository/prueba:${DRONE_BUILD_NUMBER}
- echo "Fin despliegue..."
-
- name: send-email
image: drillster/drone-email
settings:
host: smtp.ipage.com
port: 465
username:
from_secret: email_user
password:
from_secret: email_pass
from: miguel.claure@myapps.com.bo
recipients:
#- sureflatron@gmail.com
- miguel.claure@myapps.com.bo
subject: "Resultado del pipeline: ${DRONE_BUILD_STATUS}"
# no_starttls: true
# skip_verify: true
body: |
<html>
<body style="font-family: Arial, sans-serif; color: #333; background-color: #f9f9f9; padding: 20px;">
<div style="background: #ffffff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);">
<h2 style="color: #2c3e50;">🚀 Resultado del Pipeline</h2>
<table style="width: 100%; border-collapse: collapse; margin-top: 20px;">
<tr>
<td style="font-weight: bold; padding: 8px; border-bottom: 1px solid #ddd;">Pipeline</td>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${DRONE_REPO_NAME}</td>
</tr>
<tr>
<td style="font-weight: bold; padding: 8px; border-bottom: 1px solid #ddd;">Estado</td>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${DRONE_BUILD_STATUS}</td>
</tr>
<tr>
<td style="font-weight: bold; padding: 8px; border-bottom: 1px solid #ddd;">Commit</td>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${DRONE_COMMIT}</td>
</tr>
<tr>
<td style="font-weight: bold; padding: 8px; border-bottom: 1px solid #ddd;">Autor</td>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${DRONE_COMMIT_AUTHOR}</td>
</tr>
<tr>
<td style="font-weight: bold; padding: 8px; border-bottom: 1px solid #ddd;">Revisión</td>
<td style="padding: 8px; border-bottom: 1px solid #ddd;">${DRONE_COMMIT_SHA}</td>
</tr>
</table>
<div style="margin-top: 30px; text-align: center;">
<a href="${DRONE_BUILD_LINK}" style="display: inline-block; padding: 10px 20px; background-color: #3498db; color: white; text-decoration: none; border-radius: 5px;">
Ver Detalles del Pipeline
</a>
</div>
<p style="font-size: 12px; color: #777; margin-top: 20px;">Este es un correo automático generado por el sistema de CI/CD.</p>
</div>
</body>
</html>
when:
status:
- success
- failure
volumes:
- name: maven-cache
host:
path: /tmp/drone-maven-cache

93
.droneBK.yml Normal file
View File

@ -0,0 +1,93 @@
kind: pipeline
type: docker
name: spring-boot-java21
workspace:
base: /drone/src
steps:
# Paso 1: Build y tests con Maven (Java 21)
- name: build-and-test
image: maven:3.9-eclipse-temurin-21-alpine
environment:
MAVEN_OPTS: -Xmx2048m -XX:+TieredCompilation -XX:TieredStopAtLevel=1
commands:
- mvn clean verify #-Poffline --settings nexus-settings.xml
- mvn jacoco:report # Generar reporte de cobertura
volumes:
- name: maven-cache
path: /root/.m2
# # Paso 2: Análisis SonarQube con Maven
- name: sonarqube-analysis
image: maven:3.9-eclipse-temurin-21-alpine
environment:
#SONAR_HOST_URL: ${SONARQUBE_URL} # URL de tu servidor SonarQube
#SONAR_LOGIN: ${SONARQUBE_TOKEN} # Token de autenticación en SonarQube
#SONAR_PROJECT_KEY: ${SONARQUBE_PROJECT_KEY} # Clave del proyecto en SonarQube
SONAR_HOST_URL: http://10.0.0.126:9000 # URL de tu servidor SonarQube
SONAR_LOGIN: squ_465ae384ffda803d8e58d9ef0111bef1277c874a # Token de autenticación en SonarQube
SONAR_PROJECT_KEY: hhh # Clave del proyecto en SonarQube
commands:
#- mvn sonar:sonar # Ejecuta el análisis de SonarQube usando Maven
- mvn clean verify sonar:sonar -DskipTests #--settings nexus-settings.xml
volumes:
- name: maven-cache
path: /root/.m2
when:
event: [push, pull_request]
# Paso 3: Build y Push de Docker Image a Nexus (NUEVO)
- name: docker-build-push
image: docker:20.10.24
environment:
NEXUS_USER: yandel # Usuario de Nexus con permisos push
NEXUS_PASSWORD: yandel # Contraseña del usuario
REGISTRY_ADDRESS: 10.0.0.126:8081
REPOSITORY_NAME: docker-repository # Nombre del repositorio Docker en Nexus
commands:
# Login a Nexus Docker Registry
- docker login -u $NEXUS_USER -p $NEXUS_PASSWORD $REGISTRY_ADDRESS
# Construir imagen con tag dinámico ${DRONE_BUILD_NUMBER}
- docker build -t $REGISTRY_ADDRESS/$REPOSITORY_NAME/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER} -f src/main/docker/dockerfile . # -f para especificar ruta
# Push de la imagen
- docker push $REGISTRY_ADDRESS/$REPOSITORY_NAME/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER}
volumes:
- name: docker-sock
path: /var/run/docker.sock
# Paso 4: Despliegue en Servidor Externo
- name: deploy-to-server
image: appleboy/drone-ssh
environment:
REGISTRY_ADDRESS: 10.0.0.126:8081
REPOSITORY_NAME: docker-repository # Nombre del repositorio Docker en Nexus
settings:
host:
- 10.0.0.117
- 10.0.0.116
username:
from_secret: ssh_usuario_117
password:
from_secret: ssh_password_117
port: 22
command_timeout: 2m
script:
- echo "Iniciando despliegue..."
- docker login -u yandel -p yandel 10.0.0.126:8081
- docker stop mi-app || true
- docker rm mi-app || true
- docker pull 10.0.0.126:8081/docker-repository/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER}
- docker run -d --name mi-app -p 8082:8080 10.0.0.126:8081/docker-repository/${DRONE_REPO_NAME}:${DRONE_BUILD_NUMBER}
#- docker pull $NEXUS_PASSWORD $REGISTRY_ADDRESS/docker-repository/${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA}
#- docker run -d --name mi-app -p 8082:8080 $NEXUS_PASSWORD $REGISTRY_ADDRESS/docker-repository/${DRONE_REPO_NAME}:${DRONE_COMMIT_SHA}
- echo "Fin despliegue..."
volumes:
- name: maven-cache
host:
path: /tmp/drone-maven-cache
- name: docker-sock
host:
path: /var/run/docker.sock # Montar socket de Docker

3
.env Normal file
View File

@ -0,0 +1,3 @@
SONARQUBE_URL=http://10.0.0.126:9000
SONARQUBE_TOKEN=squ_465ae384ffda803d8e58d9ef0111bef1277c874a
SONARQUBE_PROJECT_KEY=hhh

33
.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

131
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,131 @@
# Official docker image.
image: docker:dind
services:
- docker:dind
stages:
- quality
- test
- compile
- build-image
- deploy
- test-deploy
.code-quality:
stage: code-quality
image: maven:3.9.6-eclipse-temurin-21-alpine
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- mvn clean install
- mvn sonar:sonar verify -DskipTests=true -Dmaven.test.failure.ignore=true -Dsonar.projectKey=$PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.java.binaries=**/*
allow_failure: true
.test:
stage: test
image: maven:latest
script:
- mvn test
artifacts:
paths:
- target/surefire-reports/TEST-*.xml
reports:
junit:
- target/surefire-reports/TEST-*.xml
.compile:
stage: compile
image: maven:3.9.6-eclipse-temurin-21-alpine
cache:
key: milicom
paths:
- ../.m2/repository
script:
- echo $CI_COMMIT_MESSAGE
- echo $CI_COMMIT_REF_NAME
- mvn package -Drevision=$CI_PIPELINE_IID -DskipTests
artifacts:
paths:
- ./target/*.jar
.stg-build-image:
stage: build-image
script:
- echo ${PROJECT_CONTAINER_IMAGE}
- docker build -f ./src/main/docker/dockerfile -t ${PROJECT_CONTAINER_IMAGE} .
- docker tag ${PROJECT_CONTAINER_IMAGE} $NEXUS_REGISTER_SERVER/${PROJECT_CONTAINER_IMAGE}
- docker login -u $CI_LON_REGISTRY_USER -p $CI_LON_REGISTRY_PASSWORD $NEXUS_REGISTER_SERVER
- docker push $NEXUS_REGISTER_SERVER/${PROJECT_CONTAINER_IMAGE}
- docker rmi ${PROJECT_CONTAINER_IMAGE}
.deploy:
stage: deploy
image: dtzar/helm-kubectl
variables:
NAMESPACE: default
POD_ENV: development
K8S_ENV_DEPLOY: deployment.yml
dependencies: []
script:
- sed -i "s/PROJECT_NAME/$POD_NAME/g" $K8S_ENV_DEPLOY
- sed -i "s~CONTAINER_IMAGE~$PROJECT_CONTAINER_IMAGE~g" $K8S_ENV_DEPLOY
- sed -i "s/APP_ENV/$POD_ENV/g" $K8S_ENV_DEPLOY
- sed -i "s/APP_ID/$POD_NAME/g" $K8S_ENV_DEPLOY
- sed -i "s/APP_PORT/8080/g" $K8S_ENV_DEPLOY
- kubectl apply -f $K8S_ENV_DEPLOY -n $NAMESPACE
variables:
IMG_REPOSITORY: $NEXUS_REGISTER_SERVER
PROJECT_KEY: checksuscribers-orchestator-api
CI_DISABLE_CACHE: "true"
POD_NAME: $CI_PROJECT_NAME
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_MIC
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_MIC
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
PROJECT_CONTAINER_IMAGE: longinus/${CI_PROJECT_NAME}:${VERSION} #$CI_PIPELINE_ID
VERSION: stg-v1.0.1 # Deprecated -> Use commit sha as tag for dev/test environments
### STAGES CLOUD
.cloud-code-quality:
only:
- develop
extends:
- .code-quality
.cloud-unit-test:
only:
- develop
- feature/performanceEntityResponseWrapper
extends:
- .test
cloud-compile:
only:
- develop
extends:
- .compile
cloud-build-image:
only:
- develop
extends:
- .stg-build-image
#Deployment en lon-bo development
deploy-bo-dev:
before_script:
- export KUBECONFIG=${KUBECONFIG_BO}
# tags:
# - longinus-bo-dev
only:
- develop
extends:
- .deploy

4
.mvn/maven.config Normal file
View File

@ -0,0 +1,4 @@
-s./.mvn/settings.xml
-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true

77
.mvn/settings.xml Normal file
View File

@ -0,0 +1,77 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<servers>
<server>
<id>millicom-nexus-mirror</id>
<username>admin</username>
<password>LTLmv4sPnAp9Hpb</password>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>XXXXXXXXXX</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>millicom-nexus-cbs-mirror</id>
<username>admin</username>
<password>LTLmv4sPnAp9Hpb</password>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>XXXXXXXXXX</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>millicom-nexus-mirror</id>
<name>Mirror</name>
<url>http://3.208.115.4:30081/repository/maven-public</url>
<mirrorOf>millicom-nexus</mirrorOf>
</mirror>
<mirror>
<id>millicom-nexus-cbs-mirror</id>
<name>Mirror CBS</name>
<url>http://3.208.115.4:30081/repository/maven-public-cbs</url>
<mirrorOf>millicom-nexus-cbs</mirrorOf>
</mirror>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:dummy:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
</mirrors>
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.host.url>
https://54.81.5.122:31645
</sonar.host.url>
</properties>
</profile>
</profiles>
</settings>

BIN
.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

2
.mvn/wrapper/maven-wrapper.properties vendored Normal file
View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

185
README.md Normal file
View File

@ -0,0 +1,185 @@
# MS Template
- Microservice template.
- Has Postgres database
### Integrations
| Origin | Target | Operation | HTTP METHOD |
|:------------------|:---------|:--------------------------------|:------------|
| External services | system-x | /api/v2/orderManagement/entityX | GET |
## Config map
### Telemetry
- **spring.sleuth.otel.exporter.otlp.endpoint**=#ex.http://localhost:4317 sleuth endpoint
- **spring.sleuth.otel.config.trace-id-ratio-based**= #ex:0.0- 0% rate / 1.0 - 100% rate
### DATABASE
- **spring.datasource.url**=#ex. jdbc:postgresql://localhost:5432/catalogdomain
- **spring.datasource.username**=#ex. admin
- **spring.datasource.password**=#ex. admin
### Environment Parametrization
#### External System Endpoints
#### Events
- **event.processing.kafka.address**=#ex. localhost:9092 Kafka Address
- **event.processing.queue.business**=#ex. event-tracing Topic for business event
- **event.processing.queue.message**=#ex. event-tracing Topic for message event
- **event.processing.queue.application**=#ex. event-tracing Topic for application event
- **event.processing.client.producer.enable**=#ex. false values true/false parameter to on/of publish event to kafka
#### Logging
- **modules.logging.message.enable** = ex: true
- **modules.logging.message.configuration** = ex: EVENT #listOfValues: CONSOLE,DB,EVENT
- **modules.logging.application.enable** = ex: true
- **modules.logging.application.level** = ex: ERROR #listOfValues: ERROR,DEBUG,WARN
- **modules.logging.application.configuration** = ex:{'*':'CONSOLE,EVENT'} ##listOfValues {'*':{'CONSOLE','DB','FULL','EVENT'}}
### Business Configuration
# Domain Orchestration Template
***Project Structure***:
Note: com.readinessit.microservice should be replaced by the customer domain when working on customer project
``` bash
com
└── readinessit.microservice.template -> root folder should only have application
├── adapters -> contains all external system related classes
| ├── externalsystem(customer) -> contains classes related to this system, for example generic filling of header structures and error handling and interpretation
| └── dto -> all external structures devided by corresponding system
| └── crm -> data structure for external system crm
└── configuration -> implementation specific spring boot configuration on startup
| └── security -> spring configuration related to security
└── ece -> External Communication Engine - engine for all outbound communication (adapters)
| ├── action -> All implementations of the action service divided by type
| | ├── courier -> All actions related with external system communication
| | ├── handler -> All actions that will handle a request or response validation/mapping
| | └── mapper -> All actions related to mapping data from/to dtos
| ├── condition -> All implementations of the condition service
| └── service -> Any service related to a common pipeline implementation, tha can be executed anywhere in the code
└── domain/functionality -> Specific entity/domain for example an entity or a domain like customer domain
├── controller -> Exposed services to the exterior
├── entity -> Table entity class
├── persistence -> Repository class
└── service -> Logic to interact with the entity/domain
```
ECE Guidelines
-
- An ECE interaction is usually defined by a pipeline execution of 3 actions as follows:
- a mapper ("PRE_RUN_ACTION_ID") that maps the controller request DTO to the external system request DTO structure;
- a courier ("EXECUTION_ACTION_ID") to make the actual call to the external system;
- an handler ("POST_RUN_ACTION_ID") to treat the external system response DTO and apply business logic and/or map the information to the execution context or final response;
- A Courier action must only contain the logic for the actual external system call.
**No mappings or data validation** -> this must be done in a Mapper action;
**No business logic or response handling** -> this must be done in an Handler action;
- A Courier action external system call must be done via an Adapter;
- A Mapper action should only do request info validation and/or map information from a DTO to the execution context or another DTO;
- An Handler action should handle all business logic and/or the external system response validations and mapping to the execution context;
- A pipeline may be one single execution or be composed of several execution steps in an ordered sequence;
- A pipeline execution may be one handler or sequence up to 3 handlers, a mapper or a sequence up to 3 mappers or an external system call (as explained above);
- Any action may (and should) be used in multiple pipeline executions, wherever the same logic applies;
---
HOW TO DEVELOP AN ECE INTERFACE
-
With the "EXECUTION_CODE" being the "baseService.operation" name defined in a controller: (ex: CustomerRequest.createCustomerRequest)
1) configure the new service in the OC_SERVICES table;
2) configure the pipeline in the correct sequence ("EXECUTION_INDEX"), in the OC_EXECUTION_PIPELINE table.
- each step is defined by a "PIPELINE_ID" and the "STATUS" (0 or 1) defines if the step is active for execution;
- if a step must be executed on condition, define the condition class path in "EXECUTION_CONDITION";
3) (if it does not exist already) configure each individual pipeline step ("PIPELINE_ID") in the OC_PIPELINE_DEFINITION table.
- pipeline executions may (and should) be used in multiple pipelines definitions;
- an ECE interaction is usually defined by a pipeline execution of 3 actions as follows:
- a mapper ("PRE_RUN_ACTION_ID") that maps the controller request DTO to the external system request DTO structure;
- a courier ("EXECUTION_ACTION_ID") to make the actual call to the external system;
- an handler ("POST_RUN_ACTION_ID") to treat the external system response DTO and apply business logic and/or map the information to the execution context or final response;
- a pipeline execution may also be just composed of handler(s) action(s) for business logic ("EXECUTION_ACTION_ID");
- a pipeline execution may also be just composed of mapper(s) action(s) for the pipeline ("EXECUTION_ACTION_ID"); example: a multiple executions pipeline final execution being a mapper to the controller's request final response DTO;
4) (if it does not exist already) configure the class path of each individual pipeline execution action ("EXECUTION_ACTION_ID") in the OC_ACTION_DEFINITION table;
- actions may (and should) be used in multiple pipelines executions;
5) (if it does not exist already) configure the external system interface information to be used by the adapter for the actual messaging communication in the OC_ADAPTER_DEFINITION;
6) for each adapter interface definition: configure the endpoint of the interface for each environment in the OC_ADAPTER_ENDPOINT table;
---
HOW TO generate liquibase changeset
-
If you are creating or updating an existing table you will need to generate a loquibase changeset, to perform this you will need to do the following:
1) mvn clean
2) mvn compile
3) mvn liquibase:diff
This will generate a new file under resources\db\changelog something like
20220811103406_entity_update.xml
4) Add a more user-friendly message than, entity_update example update_tableName or create_tableName
---
HOW TO UPDATE THE DATABASE
-
***Is it a new Virtual Configuration Table?***
1) create the table data csv file in the resources\db\data folder;
2) generate/create the liquibase changeset in the resources\db\changelog\data folder;
3) include the DB update in the liquibase file: resources\db\master.xml file;
***Is it a new Configuration Table?***
1) create all the necessary JPA entities, repositories, etc;
2) generate/create the liquibase changeset for the table creation in the resources\db\changelog\structure folder;
3) include the DB update in the liquibase file: resources\db\master.xml file;
4) create the table data csv file in the resources\db\data folder;
5) generate/create the liquibase changeset in the resources\db\changelog\data folder;
6) include the DB update in the liquibase file: resources\db\master.xml file under **update data**;
***Is it a structure update to an existing table?***
1) update all the necessary JPA entities, repositories, etc;
2) generate/create the liquibase changeset for the table update in the resources\db\changelog\structure folder;
3) include the DB update in the liquibase file: resources\db\master.xml file under **update structure**;
***Is it a data update to an existing table?***
- just update the respective resources\db\data\*.csv file
---
HOW TO CREATE A NEW CONTROLLER
-
1) Always create a interface class that contains all the relevant operation details
1) Request Parameters / Headers
2) Request structure
3) ExecutionContextDTO
4) Httpcodes with there corresponding output structure ex: 200 SuccessDto, 400 ErrorDto
2) Implementation class for the created interface, this class will contain the following
1) Add @RestController annotation to the class
2) Add @RequestMapping annotation with the path to the api to the class
3) Add @ControllerECE annotation to each implemented method
4) The response is always ResponseEntity without the type declaration ex:ResponseEntity<Success> in interface equals to ResponseEntity in implementation, this allows you to responde with error structure on error
---
HOW TO RUN THE UNIT TESTS
-
Note: **unit tests must be run after every implementation to assure regression**
Either:
- run the test maven command
or
- right-click the test\java folder and choose "Run/Debug All Tests";
A single specific unit test may be run individually by right-clicking the implementing class and choosing "Run/Debug Test";
---

222
deployment.yml Normal file
View File

@ -0,0 +1,222 @@
apiVersion: v1
kind: Service
metadata:
name: PROJECT_NAME
labels:
app: PROJECT_NAME
service: PROJECT_NAME
plaftorm: lon-customer
spec:
ports:
- port: 8080
name: http
selector:
app: PROJECT_NAME
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: PROJECT_NAME-sa
labels:
account: PROJECT_NAME-sa
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: PROJECT_NAME
labels:
app: PROJECT_NAME
version: v1
plaftorm: lon-customer
spec:
replicas: 1
selector:
matchLabels:
app: PROJECT_NAME
version: v1
template:
metadata:
labels:
app: PROJECT_NAME
version: v1
spec:
serviceAccountName: PROJECT_NAME-sa
containers:
- name: PROJECT_NAME
image: 34.233.44.173.nip.io/repository/docker-hosted/CONTAINER_IMAGE
args: ["--spring.config.location=$APP_BASE/applicationDEV.properties"]
command: ["sh", "-c", "java $JAVA_OPTS -Dserver.port=8080 -Dapplication.container.version=1.0 -Djava.security.egd=file:/dev/./urandom -Dapplication.log=/home/microservice/logs -Dspring.config.location=/home/microservice/application.properties -jar 'app.jar' '$@'"]
resources:
requests:
memory: "4Mi"
cpu: "3m"
limits:
memory: "1408Mi"
cpu: "500m"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsNonRoot: true
runAsUser: 101
imagePullPolicy: Always
env:
- name: APP_BASE
value: "/home/microservice"
- name: APP_BOOTSTRAP
value: "/usr/config"
- name: APPPROPERTIES_FILE
value: "./src/main/resources/application.properties"
- name: SERVER_PORT
value: "8080"
- name: MODULES_LOGGING_MESSAGE_ENABLE_INTERCEPTORS
value: "true"
- name: MODULES_LOGGING_MESSAGE_ENABLE
value: "true"
- name: MODULES_LOGGING_MESSAGE_CONFIGURATION
value: "CONSOLE,EVENT"
- name: MODULES_LOGGING_APPLICATION_ENABLE
value: "true"
- name: MODULES_LOGGING_APPLICATION_LEVEL
value: "DEBUG"
- name: MODULES_LOGGING_APPLICATION_CONFIGURATION
value: "{'*':'CONSOLE,EVENT'}"
- name: MODULES_COMMON_VTCONFIG_ENABLE
value: "true"
- name: MODULES_COMMON_VTCONFIG_USE_CACHE
value: "true"
- name: MODULES_COMMON_I18N_ERRORMESSAGE_ENABLE
value: "true"
- name: MODULES_COMMON_I18N_ERRORMESSAGE_DEFAULT_LANG
value: "en-US"
- name: MODULES_COMMON_I18N_LOCALE
value: "en-US,es-ES"
- name: MODULES_COMMON_I18N_DEFAULT_LANG
value: "en-US"
- name: MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE
value: "health,info,metrics,prometheus"
- name: MANAGEMENT_PROMETHEUS_METRICS_EXPORT_ENABLED
value: "true"
- name: MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED
value: "true"
- name: MANAGEMENT_METRICS_TAGS_APPLICATION
- name: SPRING_APPLICATION_NAME
value: "numerotemporal-service-api"
- name: SPRING_SLEUTH_OTEL_CONFIG_TRACE_ID_RATIO_BASED
value: "0"
- name: SPRING_SLEUTH_OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://localhost:4317"
- name: SPRING_SLEUTH_OTEL_LOG_EXPORTER_ENABLED
value: "false"
- name: SPRING_SLEUTH_ASYNC_ENABLED
value: "false"
- name: SPRING_SLEUTH_PROPAGATION_TYPE
value: "b3"
- name: SPRING_SLEUTH_BAGGAGE_REMOTE_FIELDS
value: "x-consumer-username"
- name: EVENT_PROCESSING_CLIENT_PRODUCER_ENABLE
value: "true"
- name: EVENT_PROCESSING_QUEUE_ENGINE
value: "KAFKA"
- name: EVENT_PROCESSING_KAFKA_ADDRESS
value: "kf-cluster-kafka-bootstrap.msg-prod.svc.cluster.local:9092"
- name: EVENT_PROCESSING_QUEUE_BUSINESS
value: "event-tracing"
- name: EVENT_PROCESSING_QUEUE_MESSAGE
value: "event-tracing"
- name: EVENT_PROCESSING_QUEUE_APPLICATION
value: "event-tracing"
- name: EVENT_PROCESSING_LOGGER_EVENT_ENABLE
value: "true"
- name: APP_ENVIRONMENT
value: "PROD"
- name: MODULES_MESSAGING_BASEURL_ISPROPERTY
value: "true"
- name: MODULES_LOGGING_OBFUSCATION_ENABLED
value: "true"
- name: MODULES_LOGGING_OBFUSCATION_DEFAULTREPLACETYPE
value: "-"
- name: MODULES_LOGGING_OBFUSCATION_REPLACETYPE_NUMBER
value: "000000"
- name: MODULES_LOGGING_OBFUSCATION_REPLACETYPE_STRING
value: "XXXXXX"
- name: MODULES_LOGGING_OBFUSCATION_CONFIGURATIONLIST[0]
value: "GET,.*,$[0].name.common,string"
- name: SPRING_NATIVE_REMOVE_UNUSED_AUTOCONFIG
value: "true"
- name: SPRING_NATIVE_REMOVE_YAML_SUPPORT
value: "true"
- name: SERVICE_NUMEROTEMPORAL_OPERACION
value: "numerotemporal"
- name: SERVICE_NUMEROTEMPORAL_SISTEMA
value: "numerotemporal"
- name: SERVICE_NUMEROTEMPORAL_METODO
value: "POST"
- name: MODULES_MESSAGING_CONFIGURATION_ADAPTERDEFINITIONS[0]
value: "AD_COD_0001,com.millicom.microservice.service.service.numero.temporal.ConsultarImplementacion,${service.numerotemporal.operacion},${service.numerotemporal.metodo},,com.millicom.microservice.service.external.services.personalizado.ConsultarResponse,${service.numerotemporal.sistema}"
- name: MODULES_MESSAGING_CONFIGURATION_ADAPTERENDPOINTS[0]
value: "AE_COD_0001,AD_COD_0001,messaging.baseUrl.numerotemporal.orquestador,PROD,,,"
- name: MESSAGING_BASEURL_NUMEROTEMPORAL_ORQUESTADOR
value: "http://numerotemporal-orchestrator-api:8080/api/v1/resourceValidation"
- name: SERVICE_NUMEROTEMPORAL_LEGADO_HEADER_CONTENT_TYPE
value: "application/json"
- name: SERVICE_NUMEROTEMPORAL_DEVOLVER_CABECERAS_DEL_LEGADO
value: "false"
- name: SERVICE_NUMEROTEMPORAL_PATCH
value: "/api/v1/numerotemporal"
- name: SERVICE_NUMEROTEMPORAL_CODIGOS_HTTP_A_CONTROLAR
value: "502"
- name: RESPONSE_ERRORS_400_ERRORS[0]_MESSAGE
value: "Cannot query field 'lifecycleStatus6' on type 'Products'. Did you mean 'lifecycleStatus', 'lifecycles' or 'lifecyclesList'? (line 6, column 11):\n statusPhone_status: lifecycleStatus6\n ^"
- name: RESPONSE_ERRORS_400_ERRORS[0]_LOCATIONS[0]_LINE
value: "2"
- name: RESPONSE_ERRORS_400_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "3"
- name: RESPONSE_ERRORS_405_ERRORS[0]_MESSAGE
value: "Method Not Allowed"
- name: RESPONSE_ERRORS_405_ERRORS[0]_LOCATIONS[0]_LINE
value: "2"
- name: RESPONSE_ERRORS_405_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "3"
- name: RESPONSE_ERRORS_500_ERRORS[0]_MESSAGE
value: "unknown_error"
- name: RESPONSE_ERRORS_500_ERRORS[0]_LOCATIONS[0]_LINE
value: "1"
- name: RESPONSE_ERRORS_500_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "2"
- name: RESPONSE_ERRORS_503_ERRORS[0]_MESSAGE
value: "server that is down for maintenance or that is overloaded"
- name: RESPONSE_ERRORS_503_ERRORS[0]_LOCATIONS[0]_LINE
value: "1"
- name: RESPONSE_ERRORS_503_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "2"
- name: RESPONSE_ERRORS_502_ERRORS[0]_MESSAGE
value: "No se pudo establecer conexion con el Servidor: ${messaging.baseUrl.numerotemporal.orquestador}"
- name: RESPONSE_ERRORS_502_ERRORS[0]_LOCATIONS[0]_LINE
value: "1"
- name: RESPONSE_ERRORS_502_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "2"
- name: RESPONSE_ERRORS_415_ERRORS[0]_MESSAGE
value: "The request's Content-Type is not supported. Expected:application/json or application/vnd.api+json"
- name: RESPONSE_ERRORS_415_ERRORS[0]_LOCATIONS[0]_LINE
value: "1"
- name: RESPONSE_ERRORS_415_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "2"
- name: RESPONSE_ERRORS_DEFAULT_ERRORS[0]_MESSAGE
value: "Error Interno del Adaptador"
- name: RESPONSE_ERRORS_DEFAULT_ERRORS[0]_LOCATIONS[0]_LINE
value: "1"
- name: RESPONSE_ERRORS_DEFAULT_ERRORS[0]_LOCATIONS[0]_COLUMN
value: "2"
ports:
- containerPort: APP_PORT
imagePullSecrets:
- name: docker-hosted2

4
entrypoint.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "The application will start in ${START_SLEEP}s..." && sleep ${START_SLEEP}
exec java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar "${HOME}/app.jar" "$@"

316
mvnw vendored Normal file
View File

@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
mvnw.cmd vendored Normal file
View File

@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

105
nexus-settings.xml Normal file
View File

@ -0,0 +1,105 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus</id>
<username>yandel</username>
<password>yandel</password>
</server>
<server>
<id>millicom-nexus-mirror</id>
<username>admin</username>
<password>LTLmv4sPnAp9Hpb</password>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>XXXXXXXXXX</value>
</property>
</httpHeaders>
</configuration>
</server>
<server>
<id>millicom-nexus-cbs-mirror</id>
<username>admin</username>
<password>LTLmv4sPnAp9Hpb</password>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>XXXXXXXXXX</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<mirrors>
<mirror>
<id>millicom-nexus-mirror</id>
<name>Mirror</name>
<url>http://3.208.115.4:30081/repository/maven-public</url>
<mirrorOf>millicom-nexus</mirrorOf>
</mirror>
<mirror>
<id>millicom-nexus-cbs-mirror</id>
<name>Mirror CBS</name>
<url>http://3.208.115.4:30081/repository/maven-public-cbs</url>
<mirrorOf>millicom-nexus-cbs</mirrorOf>
</mirror>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:dummy:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
</mirror>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<!-- <url>https://nexus.myapps.bo/repository/maven-public/</url>-->
<url>http://10.0.0.126:8084/repository/maven-public/</url>
</mirror>
</mirrors>
<pluginGroups>
<pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.host.url>http://10.0.0.126:9000</sonar.host.url>
<sonar.login>squ_465ae384ffda803d8e58d9ef0111bef1277c874a</sonar.login>
</properties>
</profile>
<profile>
<id>offline</id>
<properties>
<maven.offline>true</maven.offline>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>sonar</activeProfile>
</activeProfiles>
</settings>

View File

@ -0,0 +1,184 @@
# replace values:
# numerotemporal-service-api
# snc-isd
# IMAGE_REPOSITORY_URL
# CONTAINER_IMAGE_URL
apiVersion: v1
kind: Service
metadata:
name: numerotemporal-service-api
labels:
app: numerotemporal-service-api
service: numerotemporal-service-api
plaftorm: lon-customer
namespace: snc-isd
spec:
ports:
- port: 8080
name: http
selector:
app: numerotemporal-service-api
sessionAffinity: None
type: ClusterIP
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: numerotemporal-service-api-sa
labels:
account: numerotemporal-service-api-sa
namespace: snc-isd
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: numerotemporal-service-api
labels:
app: numerotemporal-service-api
version: v1
plaftorm: lon-customer
namespace: snc-isd
spec:
replicas: 1
selector:
matchLabels:
app: numerotemporal-service-api
version: v1
template:
metadata:
labels:
app: numerotemporal-service-api
version: v1
spec:
serviceAccountName: numerotemporal-service-api-sa
containers:
- name: numerotemporal-service-api
image: emstrgprdapp01.tigo.net.bo:8084/longinus/snc/tbb/facade/numerotemporal-service-api:prd-v1.0.0 #example: emstrgprdapp01.tigo.net.bo:8084/longinus/snc/isd/adapter/query-adapter-api:prd-v1.0.0
args: ["--spring.config.location=$APP_BASE/applicationDEV.properties"]
command: ["sh", "-c", "java $JAVA_OPTS -Dserver.port=8080 -Dapplication.container.version=1.0 -Djava.security.egd=file:/dev/./urandom -Dapplication.log=/home/microservice/logs -Dspring.config.location=/home/microservice/applicationDEV.properties -jar 'app.jar' '$@'"]
resources:
requests:
memory: "4Mi"
cpu: "3m"
limits:
memory: "1408Mi"
cpu: "500m"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
privileged: false
runAsNonRoot: true
runAsUser: 101
imagePullPolicy: Always
env:
- name: APP_BASE
value: "/home/microservice"
- name: APP_BOOTSTRAP
value: "/usr/config"
- name: APPPROPERTIES_FILE
value: "./src/main/resources/application.properties"
- name: START_SLEEP
value: "5"
- name: SERVER_PORT
value: "8080"
- name: MODULES_LOGGING_MESSAGE_ENABLE_INTERCEPTORS
value: "true"
- name: MODULES_LOGGING_MESSAGE_ENABLE
value: "true"
- name: MODULES_LOGGING_MESSAGE_CONFIGURATION
value: "CONSOLE,EVENT"
- name: MODULES_LOGGING_APPLICATION_ENABLE
value: "true"
- name: MODULES_LOGGING_APPLICATION_LEVEL
value: "DEBUG"
- name: MODULES_LOGGING_APPLICATION_CONFIGURATION
value: "{'*':'CONSOLE,EVENT'}"
- name: MODULES_COMMON_VTCONFIG_ENABLE
value: "true"
- name: MODULES_COMMON_VTCONFIG_USE_CACHE
value: "true"
- name: MODULES_COMMON_I18N_ERRORMESSAGE_ENABLE
value: "true"
- name: MODULES_COMMON_I18N_ERRORMESSAGE_DEFAULT_LANG
value: "en-US"
- name: MODULES_COMMON_I18N_LOCALE
value: "en-US,es-ES"
- name: MODULES_COMMON_I18N_DEFAULT_LANG
value: "en-US"
- name: MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE
value: "health,info,metrics,prometheus"
- name: MANAGEMENT_PROMETHEUS_METRICS_EXPORT_ENABLED
value: "true"
- name: MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED
value: "true"
- name: MANAGEMENT_METRICS_TAGS_APPLICATION
- name: SPRING_APPLICATION_NAME
value: "numerotemporal-service-api"
- name: SPRING_SLEUTH_OTEL_CONFIG_TRACE_ID_RATIO_BASED
value: "0"
- name: SPRING_SLEUTH_OTEL_EXPORTER_OTLP_ENDPOINT
value: "http://localhost:4317"
- name: SPRING_SLEUTH_OTEL_LOG_EXPORTER_ENABLED
value: "false"
- name: SPRING_SLEUTH_ASYNC_ENABLED
value: "false"
- name: SPRING_SLEUTH_PROPAGATION_TYPE
value: "b3"
- name: SPRING_SLEUTH_BAGGAGE_REMOTE_FIELDS
value: "x-consumer-username"
- name: EVENT_PROCESSING_CLIENT_PRODUCER_ENABLE
value: "true"
- name: EVENT_PROCESSING_QUEUE_ENGINE
value: "KAFKA"
- name: EVENT_PROCESSING_KAFKA_ADDRESS
value: "kf-cluster-kafka-bootstrap.msg-prod.svc.cluster.local:9092"
- name: EVENT_PROCESSING_QUEUE_BUSINESS
value: topic-business-bo
- name: EVENT_PROCESSING_QUEUE_MESSAGE
value: topic-message-bo
- name: EVENT_PROCESSING_QUEUE_APPLICATION
value: topic-application-bo
- name: EVENT_PROCESSING_LOGGER_EVENT_ENABLE
value: "true"
- name: APP_ENVIRONMENT
value: "PROD"
- name: MODULES_MESSAGING_BASEURL_ISPROPERTY
value: "true"
- name: MODULES_LOGGING_OBFUSCATION_ENABLED
value: "true"
- name: MODULES_LOGGING_OBFUSCATION_DEFAULTREPLACETYPE
value: "-"
- name: MODULES_LOGGING_OBFUSCATION_REPLACETYPE_NUMBER
value: "000000"
- name: MODULES_LOGGING_OBFUSCATION_REPLACETYPE_STRING
value: "XXXXXX"
- name: SPRING_NATIVE_REMOVE_UNUSED_AUTOCONFIG
value: "true"
- name: SPRING_NATIVE_REMOVE_YAML_SUPPORT
value: "true"
- name: SERVICE_NUMEROTEMPORAL_OPERACION
value: "numerotemporal"
- name: SERVICE_NUMEROTEMPORAL_SISTEMA
value: "numerotemporal"
- name: SERVICE_NUMEROTEMPORAL_METODO
value: "POST"
- name: MESSAGING_BASEURL_NUMEROTEMPORAL_ORQUESTADOR
value: "http://numerotemporal-orchestrator-api.snc-isd.svc.cluster.local:8080/api/v1/resourceValidation"
- name: SERVICE_NUMEROTEMPORAL_LEGADO_HEADER_CONTENT_TYPE
value: "application/json"
- name: SERVICE_NUMEROTEMPORAL_DEVOLVER_CABECERAS_DEL_LEGADO
value: "false"
- name: SERVICE_NUMEROTEMPORAL_PATCH
value: "/api/v1/consultaNumeroTemporalV2"
- name: SERVICE_NUMEROTEMPORAL_CODIGOS_HTTP_A_CONTROLAR
value: "502"
ports:
- containerPort: 8080
imagePullSecrets:
- name: nexus-secret

344
pom.xml Normal file
View File

@ -0,0 +1,344 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.millicom.microservice</groupId>
<artifactId>numerotemporal-service-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bom</artifactId>
<version>${micrometer-tracing.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<java.version>21</java.version>
<!-- SONAR Properties -->
<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<junit.itReportFolder>${project.testresult.directory}/integrationTest</junit.itReportFolder>
<sonar.qualitygate.wait>true</sonar.qualitygate.wait>
<!-- RIT Library versions -->
<rit.library.common-interfaces.version>2.0.4</rit.library.common-interfaces.version>
<rit.library.logging.version>2.0.4</rit.library.logging.version>
<rit.library.messaging.version>2.0.3</rit.library.messaging.version>
<rit.library.eventprocessingclient.version>2.0.1</rit.library.eventprocessingclient.version>
<rit.library.messaging.configuration.version>1.0.0</rit.library.messaging.configuration.version>
<!-- This is used for liquibase name -->
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://10.0.0.126:8084/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>spring-milestones</id>
<url>https://repo.spring.io/milestone</url>
</repository>
<repository>
<id>millicom-nexus-mirror</id>
<url>http://3.208.115.4:30081/repository/maven-public</url>
</repository>
<repository>
<id>nexus</id>
<url>http://10.0.0.126:8084/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>3.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>3.1.11</version>
<exclusions>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-brave</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
<version>1.1.0-M6</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp-trace</artifactId>
<version>1.14.0</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<!-- KAFKA LIBRERIA TRACERT-->
<dependency>
<groupId>com.readinessit.library</groupId>
<artifactId>common-interfaces</artifactId>
<version>${rit.library.common-interfaces.version}</version>
</dependency>
<dependency>
<groupId>com.readinessit.library</groupId>
<artifactId>logging</artifactId>
<version>${rit.library.logging.version}</version>
</dependency>
<dependency>
<groupId>com.readinessit.library</groupId>
<artifactId>messaging</artifactId>
<version>${rit.library.messaging.version}</version>
</dependency>
<dependency>
<groupId>com.readinessit.library</groupId>
<artifactId>event-processing-client</artifactId>
<version>${rit.library.eventprocessingclient.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<verbose>true</verbose>
<buildArgs>
<arg>
ch.qos.logback.core.util.Loader,ch.qos.logback.classic.Logger,ch.qos.logback.core.status.StatusBase,com.ctc.wstx.stax.WstxInputFactory,ch.qos.logback.core.util.StatusPrinter,com.ctc.wstx.util.DefaultXmlSymbolTable,com.ctc.wstx.api.CommonConfig,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Level,com.ctc.wstx.api.ReaderConfig,ch.qos.logback.core.CoreConstants,org.slf4j.LoggerFactory
</arg>
</buildArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>native-image-build</id>
<phase>package</phase>
<configuration>
<environment>
<GRAALVM_NATIVE_IMAGE_OPTIONS>
--initialize-at-build-time=com.ctc.wstx.stax.WstxInputFactory
</GRAALVM_NATIVE_IMAGE_OPTIONS>
</environment>
<commandLine>
</commandLine>
</configuration>
</execution>
</executions>
<configuration>
<image>
<env>
<BP_JVM_VERSION>${java.version}</BP_JVM_VERSION>
<GRAALVM_NATIVE_IMAGE_OPTIONS>
--initialize-at-build-time=com.ctc.wstx.stax.WstxInputFactory
</GRAALVM_NATIVE_IMAGE_OPTIONS>
</env>
</image>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>${properties-maven-plugin.version}</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>sonar-project.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<dataFile>target/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${junit.itReportFolder}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<outputChangeLogFile>
${project.basedir}/src/main/resources/db/changelog/${maven.build.timestamp}_changelog.xml
</outputChangeLogFile>
<diffChangeLogFile>
${project.basedir}/src/main/resources/db/changelog/structure/${maven.build.timestamp}_entity_update.xml
</diffChangeLogFile>
<verbose>true</verbose>
<contexts>!test</contexts>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>4.15.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.3.22</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.11</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

22
sonar-project.properties Normal file
View File

@ -0,0 +1,22 @@
sonar.projectKey=hhh
sonar.projectName=numerotemporal-service-api2
sonar.sources=src/main/
#sonar.host.url=http://192.168.1.90:9000
#sonar.token=sqp_be04510fcd7f726558c210489203cc8cb9a3b799
sonar.tests=src/test/
sonar.exclusions=**/controller/core/**,**/graphql/**
sonar.host.url=http://sonarqube:9000
#sonar.token=squ_095e01f2e60e4d77838a5a114356927fb1c99861
sonar.login=squ_465ae384ffda803d8e58d9ef0111bef1277c874a
#sonar.login=sqp_249804bd04cbc7f86f7441a227ed7408b6b584ca
#sonar.login=channel
#sonar.password=Arroyo2024*
#mvn clean verify sonar:sonar -DskipTests

2
src/main/docker/app.env Normal file
View File

@ -0,0 +1,2 @@
JAVA_OPTS=-Xmx1024m -Xms256m
START_SLEEP=5

View File

@ -0,0 +1,20 @@
FROM amazoncorretto:21.0.2-alpine3.19
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS
RUN adduser --system --shell /bin/sh microservice
WORKDIR /home/microservice
ADD entrypoint.sh entrypoint.sh
COPY /src/main/resources/application.properties /home/microservice/application.properties
RUN chmod 755 entrypoint.sh && chown microservice entrypoint.sh
USER microservice
RUN mkdir data
RUN chmod -R 766 data/
EXPOSE 8080
ADD target/*.jar app.jar
ENTRYPOINT ["./entrypoint.sh"]

View File

@ -0,0 +1,22 @@
package com.millicom.microservice.service;
import com.readinessit.library.logging.application.services.LoggerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.scheduling.annotation.EnableAsync;
@SpringBootApplication(scanBasePackages = {"com.readinessit","com.millicom"})
@EntityScan(basePackages = {"com.readinessit","com.millicom"})
@EnableAsync
public class NumeroTemporalAplicacion {
@Autowired
LoggerService loggerService;
public static void main(String[] args) {
SpringApplication.run(NumeroTemporalAplicacion.class, args);
}
}

View File

@ -0,0 +1,22 @@
package com.millicom.microservice.service.adapters;
import com.readinessit.library.messaging.api.services.SendMessageOperations;
import com.readinessit.library.messaging.data.MessageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class Adapter {
@Autowired
SendMessageOperations sendOutgoingMessage;
private MessageResponse sendMessage(Class<?> classType, String operation, Object request, Map<String, String> dynamicParams, Map<String, String> headers, Map<String, String> queryStr,String system) {
return sendOutgoingMessage.processMessage(system, classType.getName(), operation, request, queryStr, dynamicParams, headers);
}
public MessageResponse sendMessage(Class<?> classType, String operation, Object request, Map<String, String> pathVars, Map<String, String> headers , String system) {
return sendMessage(classType, operation, request, pathVars, headers, null, system);
}
}

View File

@ -0,0 +1,48 @@
package com.millicom.microservice.service.adapters.controlador.numero.temporal;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.constraints.NotNull;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping("")
public interface NumeroTemporalAdaptador {
@Operation(summary = "Obtener la respuesta de SimCard", description = "POST method to retrieve service Individuals", tags = {"Individuals"})
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "204", description = "GET means no record found DELETE means sucessfully deletion"),
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "405", description = "Method Not allowed", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "409", description = "Conflict", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "503", description = "Service Unavailable", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class))),
@ApiResponse(responseCode = "504", description = "Gateway Timeout", content = @Content(mediaType = "application/json;charset=utf-8", schema = @Schema(implementation = Error.class)))})
/**
* Obtiene información de la tarjeta SIM a partir del cuerpo de la solicitud.
*
* @param cuerpo El cuerpo de la solicitud que contiene información de la tarjeta SIM.
* @return Una ResponseEntity con la información de la tarjeta SIM o una estructura de error en caso de problemas.
*/
@PostMapping(value = "${service.numerotemporal.patch}**", consumes = {MediaType.TEXT_XML_VALUE}, produces = {"text/xml;charset=utf-8"})
ResponseEntity<Object> consultarNumeroTemporal(@RequestBody @NotNull String cuerpo, HttpServletRequest solicitudHttp);
@GetMapping(path = "${service.numerotemporal.patch}**", produces = {"text/xml;charset=utf-8"})
ResponseEntity<Object> obtenerFirma(HttpServletRequest solicitudHttp);
}

View File

@ -0,0 +1,251 @@
package com.millicom.microservice.service.adapters.controlador.numero.temporal;
import com.millicom.microservice.service.adapters.dto.common.OperationException;
import com.millicom.microservice.service.external.services.personalizado.ConsultarResponse;
import com.millicom.microservice.service.service.numero.temporal.Consultar;
import com.readinessit.library.logging.application.services.LoggerService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.xml.bind.*;
import jakarta.xml.soap.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.w3c.dom.Document;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import static com.millicom.microservice.service.external.services.common.Constants.MODULO;
@RestController
public class NumeroTemporalRecurso implements NumeroTemporalAdaptador {
private final Consultar consultar;
@Value("classpath:wsdl/MAIN.wsdl")
private Resource recurso;
@Autowired
public NumeroTemporalRecurso(Consultar consultar) {
this.consultar = consultar;
}
/**
* Obtiene información de una Simcard.
*
* @param cuerpoSolicitud Datos de la solicitud.
* @return ResponseEntity con la respuesta.
*/
@Override
public ResponseEntity<Object> consultarNumeroTemporal(String cuerpoSolicitud, HttpServletRequest solicitudHttp) {
try {
SOAPMessage mensajeSoap = obtenerSoapMessageDeXml(cuerpoSolicitud);
SOAPElement elementoSoap = obtenerPrimerSoapElement(mensajeSoap.getSOAPBody());
if (elementoSoap != null) {
if (elementoSoap.getLocalName().equals("Consultar")) {
String xml = obtenerXmlDeSoapElement(elementoSoap, false, true);
com.millicom.microservice.service.external.services.Consultar solicitud = obtenerObjetoDeXml(xml, com.millicom.microservice.service.external.services.Consultar.class, false);
com.millicom.microservice.service.external.services.personalizado.ConsultarResponse response = consultar.consultar(solicitud.getConsultaRequest());
return new ResponseEntity<>(obtenerSoapMessage(response), null, HttpStatus.OK);
} else {
return new ResponseEntity<>(obtenerSoapFault("Metodo no implementado"), HttpStatus.OK);
}
}
} catch (OperationException e) {
try {
return new ResponseEntity<>(obtenerSoapFault(e.getErrorStructure().getValor()), e.getErrorStatus());
} catch (Exception ex) {
LoggerService.logBusiness(MODULO, "Exception: " + e.getMessage(), e);
}
} catch (Exception e) {
try {
return new ResponseEntity<>(obtenerSoapFault(e.toString()), HttpStatus.BAD_GATEWAY);
} catch (Exception ex) {
LoggerService.logBusiness(MODULO, "Exception: " + e.getMessage(), e);
}
}
return ResponseEntity.badRequest().body("");
}
@Override
public ResponseEntity<Object> obtenerFirma(HttpServletRequest request) {
try {
// Obtener el esquema (http o https)
String scheme = request.getHeader("X-Forwarded-Proto");
if (scheme == null) {
scheme = request.getScheme(); // Usa el esquema de la solicitud si no está presente en los encabezados
}
// Obtener el nombre del servidor (dominio)
String serverName = request.getHeader("X-Forwarded-Host");
if (serverName == null) {
serverName = request.getServerName(); // Usa el nombre del servidor de la solicitud si no está presente en los encabezados
}
// Obtener el puerto (si no es el puerto por defecto)
String port = request.getHeader("X-Forwarded-Port");
if (port == null) {
int serverPort = request.getServerPort();
// El puerto 80 para HTTP y 443 para HTTPS son por defecto y generalmente no se muestran
if (serverPort == 80 || serverPort == 443) {
port = "";
} else {
port = ":" + serverPort;
}
} else {
port = ":" + port;
}
// Obtener el contexto de la aplicación
String contextPath = request.getContextPath();
// Obtener la URI completa
String requestUri = request.getRequestURI();
// Obtener los parámetros de la consulta (query string)
String queryString = request.getQueryString();
// Construir la URL absoluta
String absoluteUrl = scheme + "://" + serverName + port + contextPath + requestUri;
if (queryString != null) {
absoluteUrl += "?" + queryString;
}
String firma = new String(recurso.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
firma = firma.replace("LOCALHOST", absoluteUrl);
return new ResponseEntity<>(firma, HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
/**
* Permite convertir a un Objeto serializable a paratir de un xml
*
* @param xml Objeto a convertir en formato xml
* @param clase Clase al cual se va convertir el xml
* @param conJaxElement Indica si va convertir a objeto usando JAXElement
* @param <T> Objeto generico a convertir el xml
* @return Retorna un Objeto de tipo clase
* @throws JAXBException
*/
public static <T> T obtenerObjetoDeXml(String xml, Class clase, Boolean conJaxElement) throws JAXBException {
StringReader sr = new StringReader(xml);
JAXBContext jaxbContext = JAXBContext.newInstance(clase);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
if (Boolean.TRUE.equals(conJaxElement)) {
return (T) ((JAXBElement) unmarshaller.unmarshal(sr)).getValue();
} else {
return (T) unmarshaller.unmarshal(sr);
}
}
/**
* Permite convertir un xml a partir de un SoapElement
*
* @param elemento Objeto SOAPElement
* @param declaracionXml Indicador que señala si el xml tendrá el tag de declaracion xml
* @param tabularXml Indicador que señala si el xml estará formateado
* @return Retorna un xml de un SoapElement
*/
private String obtenerXmlDeSoapElement(SOAPElement elemento, boolean declaracionXml, boolean tabularXml) {
DOMImplementationLS implementacionDom = (DOMImplementationLS) elemento.getOwnerDocument().getImplementation().getFeature("LS", "3.0");
LSSerializer serializador = implementacionDom.createLSSerializer();
serializador.getDomConfig().setParameter("xml-declaration", declaracionXml);
serializador.getDomConfig().setParameter("format-pretty-print", tabularXml);
return serializador.writeToString(elemento);
}
/**
* Permite obtener en formato texto un SoapFault a partir del detalle del error
*
* @param detalle Detalle del error con el cual se generará el SoapFault
* @return Retorna un SoapFault en formato texto
* @throws SOAPException
* @throws IOException
*/
private String obtenerSoapFault(String detalle) throws SOAPException, IOException {
SOAPMessage mensajeSoap = MessageFactory.newInstance().createMessage();
mensajeSoap.getSOAPPart().getEnvelope().getBody().addFault().setFaultString(detalle);
ByteArrayOutputStream flujoSalida = new ByteArrayOutputStream();
mensajeSoap.writeTo(flujoSalida);
return flujoSalida.toString(StandardCharsets.UTF_8);
}
/**
* Permite obtener un objeto SoapMessage a partir de un xml
*
* @param requestXml SoapMessage en formato texto
* @return retorna un objeto SoapMessage a partir de un xml
* @throws SOAPException
*/
private SOAPMessage obtenerSoapMessageDeXml(String requestXml) throws SOAPException {
SOAPMessage mensajeSoap = MessageFactory.newInstance().createMessage();
SOAPPart seccionSoap = mensajeSoap.getSOAPPart();
InputStream flujoEntrada = new ByteArrayInputStream(requestXml.getBytes(StandardCharsets.UTF_8));
StreamSource flujoOrigen = new StreamSource(flujoEntrada);
seccionSoap.setContent(flujoOrigen);
mensajeSoap.saveChanges();
return mensajeSoap;
}
/**
* Permite obtener el primer objeto SoapElement del cuerpo de un SoapMessage
*
* @param cuerpoSoap Objeto SoapBody
* @return Retorna el primer objeto de tipo SoapElement de un SoapBody
*/
private SOAPElement obtenerPrimerSoapElement(SOAPBody cuerpoSoap) {
for (Iterator<?> iterador = cuerpoSoap.getChildElements(); iterador.hasNext(); ) {
Object hijo = iterador.next();
if (hijo instanceof SOAPElement) {
return (SOAPElement) hijo;
}
}
return null;
}
private String convertirAXml(ConsultarResponse response) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(ConsultarResponse.class);
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.FALSE);
StringWriter writer = new StringWriter();
marshaller.marshal(response, writer);
return writer.toString();
}
private Document obtenerDocumento(String xmlString) throws ParserConfigurationException, IOException, SAXException {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
dbFactory.setNamespaceAware(true);
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
return dBuilder.parse(new ByteArrayInputStream(xmlString.getBytes(StandardCharsets.UTF_8)));
}
private String obtenerSoapMessage(ConsultarResponse response) throws SOAPException, IOException, JAXBException, ParserConfigurationException, SAXException {
SOAPMessage mensajeSoap = MessageFactory.newInstance().createMessage();
String xml = convertirAXml(response);
LoggerService.logBusiness(MODULO, xml, null);
Document documento = obtenerDocumento(xml);
mensajeSoap.getSOAPPart().getEnvelope().getBody().addDocument(documento);
mensajeSoap.saveChanges();
ByteArrayOutputStream flujoSalida = new ByteArrayOutputStream();
mensajeSoap.writeTo(flujoSalida);
return new String(flujoSalida.toByteArray(), StandardCharsets.UTF_8);
}
}

View File

@ -0,0 +1,15 @@
package com.millicom.microservice.service.adapters.dto.common;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;
@Getter
@Setter
public class ErrorStructure extends ResponseError {
@JsonIgnore
private HttpStatus httpStatus;
}

View File

@ -0,0 +1,14 @@
package com.millicom.microservice.service.adapters.dto.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
@AllArgsConstructor
public class OperationException extends RuntimeException {
private HttpStatus errorStatus;
private ErrorStructure errorStructure;
}

View File

@ -0,0 +1,10 @@
package com.millicom.microservice.service.adapters.dto.common;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ResponseError {
private String valor;
}

View File

@ -0,0 +1,31 @@
package com.millicom.microservice.service.adapters.soap.service;
import com.millicom.microservice.service.external.services.personalizado.ConsultarResponse;
import com.millicom.microservice.service.service.numero.temporal.Consultar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
@Endpoint
public class TemporalEndpoint {
private static final String NAMESPACE_URI = "http://services.tigo.com.bo/";
private final Consultar consultar;
@Autowired
public TemporalEndpoint(Consultar consultar) {
this.consultar = consultar;
}
@PayloadRoot(localPart = "Consultar", namespace = NAMESPACE_URI)
@ResponsePayload
public ConsultarResponse consultar(@RequestPayload com.millicom.microservice.service.external.services.Consultar consultaRequest) {
return consultar.consultar(consultaRequest.getConsultaRequest());
}
}

View File

@ -0,0 +1,52 @@
package com.millicom.microservice.service.adapters.soap.service;
import org.springframework.context.annotation.Configuration;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
/*private final EndpointInterceptor payloadLoggingInterceptor;
private final CustomPayloadTransformingInterceptor interceptor;
@Autowired
public WebServiceConfig(EndpointInterceptor payloadLoggingInterceptor, CustomPayloadTransformingInterceptor interceptor) {
this.payloadLoggingInterceptor = payloadLoggingInterceptor;
this.interceptor = interceptor;
}
@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
interceptors.add(payloadLoggingInterceptor);
interceptors.add(interceptor);
}
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
// LoggerService.logBusiness(MODULO, "Ingresando a messageDispatcherServlet", null);
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
//servlet.setContentType("application/soap+xml"); // Configurar el tipo de contenido de las respuestas SOAP
return new ServletRegistrationBean(servlet, "/*");
}
@Bean(name = "consultaNumeroTemporalV2")
public Wsdl11Definition defaultWsdl11Definition() {
// LoggerService.logBusiness(MODULO,"Ingresando a defaultWsdl11Definition",null);
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl(new ClassPathResource("wsdl/MAIN.wsdl"));
// wsdl11Definition.setContentType("application/soap+xml");
return wsdl11Definition;
}*/
}

View File

@ -0,0 +1,38 @@
package com.millicom.microservice.service.adapters.soap.service;
/*
@EnableWs
@Configuration
public class WebServiceConfig2 extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/*");
}
@Bean(name = "consultaNumeroTemporalV2")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("ConsultarNumeroTemporalPortBinding");
//wsdl11Definition.setLocationUri("/mnp-services/bccsneuvo");
wsdl11Definition.setLocationUri("/consultaNumeroTemporalV2");
wsdl11Definition.setTargetNamespace("http://services.tigo.com.bo/");
wsdl11Definition.setSchema(countriesSchema);
wsdl11Definition.setCreateSoap11Binding(true);
// wsdl11Definition.setCreateSoap12Binding(true);
wsdl11Definition.setServiceName("PortabilityProcessPortType");
return wsdl11Definition;
}
@Bean
public XsdSchema countriesSchema() {
return new SimpleXsdSchema(new ClassPathResource("wsdl/ConsultarNumeroTemporal.xsd"));
}
}*/

View File

@ -0,0 +1,73 @@
package com.millicom.microservice.service.adapters.soap.service.interceptor;
import com.readinessit.library.logging.application.services.LoggerService;
import com.readinessit.library.messaging.logs.MessagingLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.ws.server.endpoint.interceptor.PayloadTransformingInterceptor;
import org.springframework.xml.transform.ResourceSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import javax.xml.transform.Templates;
import javax.xml.transform.TransformerFactory;
import static com.millicom.microservice.service.external.services.common.Constants.MODULO;
@Component
public class CustomPayloadTransformingInterceptor extends PayloadTransformingInterceptor {
private final MessagingLogger messagingLogger;
private Resource requestXslt;
private Resource responseXslt;
private Templates requestTemplates;
private Templates responseTemplates;
@Autowired
public CustomPayloadTransformingInterceptor(MessagingLogger messagingLogger) {
this.messagingLogger = messagingLogger;
}
@Override
public void afterPropertiesSet() throws Exception {
if (this.requestXslt == null && this.responseXslt == null) {
// LoggerService.logBusiness(MODULO, "NULL", requestXslt);
} else {
TransformerFactory transformerFactory = this.getTransformerFactory();
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
ResourceSource responseSource;
if (this.requestXslt != null) {
Assert.isTrue(this.requestXslt.exists(), "requestXslt \"" + this.requestXslt + "\" does not exit");
LoggerService.logBusiness(MODULO, "Transforming request using " + this.requestXslt, null);
responseSource = new ResourceSource(xmlReader, this.requestXslt);
this.requestTemplates = transformerFactory.newTemplates(responseSource);
LoggerService.logBusiness(MODULO, "Request", requestXslt);
}
if (this.responseXslt != null) {
Assert.isTrue(this.responseXslt.exists(), "responseXslt \"" + this.responseXslt + "\" does not exit");
LoggerService.logBusiness(MODULO, "Transforming response using " + this.responseXslt, null);
responseSource = new ResourceSource(xmlReader, this.responseXslt);
this.responseTemplates = transformerFactory.newTemplates(responseSource);
LoggerService.logBusiness(MODULO, "Response", responseXslt);
}
// this.messagingLogger.createMessageLog(requestBodyUriSpec, sentDate, request, adapterDefinition, url, clientResponse, respBody);
// this.messagingLogger.createMessageLog(requestBodyUriSpec, sentDate, requestXslt, adapterDefinition, url, clientResponse, responseXslt);
}
}
}

View File

@ -0,0 +1,18 @@
package com.millicom.microservice.service.adapters.soap.service.interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor;
@Configuration
public class InterceptorConfig {
@Bean
public EndpointInterceptor payloadLoggingInterceptor() {
PayloadLoggingInterceptor interceptor = new PayloadLoggingInterceptor();
interceptor.setLogRequest(true);
interceptor.setLogResponse(true);
interceptor.setLoggerName("org.springframework.ws.server.MessageTracing");
return interceptor;
}
}

View File

@ -0,0 +1,24 @@
package com.millicom.microservice.service.configuration;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MsTemplateConfig {
@Autowired
ObjectMapper objectMapper;
@PostConstruct
public void setUp() {
objectMapper.registerModule(new JavaTimeModule());
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
}
}

View File

@ -0,0 +1,108 @@
package com.millicom.microservice.service.controller.core;
import com.millicom.microservice.service.adapters.dto.common.ErrorStructure;
import com.millicom.microservice.service.service.common.GenerateErrorService;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.ConversionNotSupportedException;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import org.springframework.lang.Nullable;
import org.springframework.validation.BindException;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.HttpMediaTypeNotSupportedException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.MissingPathVariableException;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.async.AsyncRequestTimeoutException;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.multipart.support.MissingServletRequestPartException;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
//import com.readinessit.library.internationalization.interceptor.RequestInterceptor;
@RestControllerAdvice
public class BaseController {
@Autowired
GenerateErrorService generateErrorService;
private ResponseEntityExceptionHandler responseEntityExceptionHandler;
// @Autowired
// RequestInterceptor requestInterceptor;
public BaseController() {
responseEntityExceptionHandler = new ResponseEntityExceptionHandler() {
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception ex, @Nullable Object body, HttpHeaders headers, HttpStatusCode status, WebRequest request) {
return handleErrorResponseCreation(ex, headers, status, request);
}
};
}
@ExceptionHandler({HttpMediaTypeNotSupportedException.class, HttpMediaTypeNotAcceptableException.class, MissingPathVariableException.class, MissingServletRequestParameterException.class, ServletRequestBindingException.class, ConversionNotSupportedException.class, TypeMismatchException.class, HttpMessageNotReadableException.class, HttpMessageNotWritableException.class, MethodArgumentNotValidException.class, MissingServletRequestPartException.class, BindException.class, AsyncRequestTimeoutException.class})
public final ResponseEntity<Object> handleException(Exception ex, WebRequest request, HandlerMethod handlerMethod) throws Exception {
ResponseEntity<Object> error = responseEntityExceptionHandler.handleException(ex, request);
if(error != null ) {
ErrorStructure body = error.hasBody() ? (ErrorStructure) error.getBody() : null;
if(body != null)
// body.getLonginusInternalErrorCode().set_atMoreInfo(handlerMethod.getBeanType().getName() + ":" + handlerMethod.getMethod().getName());
return error;
}
throw ex;
}
@ExceptionHandler({HttpRequestMethodNotSupportedException.class, NoHandlerFoundException.class})
public final ResponseEntity<Object> handleException(Exception ex, WebRequest request) throws Exception {
// requestInterceptor.preHandle(((ServletWebRequest)request).getRequest(), ((ServletWebRequest)request).getResponse(), null);
return responseEntityExceptionHandler.handleException(ex, request);
}
@ExceptionHandler({Exception.class})
public final ResponseEntity<Object> handleUnknownException(Exception ex, WebRequest request, HandlerMethod handlerMethod) {
ResponseEntity<Object> error = handleErrorResponseCreation(ex, null, HttpStatus.INTERNAL_SERVER_ERROR, request);
ErrorStructure body = error.hasBody() ? (ErrorStructure) error.getBody() : null;
if(body != null){}
// body.getLonginusInternalErrorCode().set_atMoreInfo(handlerMethod.getBeanType().getName() + ":" + handlerMethod.getMethod().getName());
return error;
}
@ExceptionHandler({ HttpClientErrorException.class, HttpServerErrorException.class })
public final ResponseEntity<Object> handleClientError(HttpClientErrorException ex, WebRequest request, HandlerMethod handlerMethod) {
ResponseEntity<Object> error = handleErrorResponseCreation(ex, null, ex.getStatusCode(), request);
ErrorStructure body = error.hasBody() ? (ErrorStructure) error.getBody() : null;
if (body != null){}
//body.getLonginusInternalErrorCode().set_atMoreInfo(handlerMethod.getBeanType().getName() + ":" + handlerMethod.getMethod().getName());
//body.getBackendErrorCode().setErrorDescription(ex.getResponseBodyAsString());
return error;
}
private ResponseEntity<Object> handleErrorResponseCreation(Exception ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) {
String stacktrace = null;
if (HttpStatus.INTERNAL_SERVER_ERROR.equals(status)) {
request.setAttribute("javax.servlet.error.exception", ex, 0);
stacktrace = ExceptionUtils.getStackTrace(ex);
}
String simpleStackTrace = ex.getMessage();
ErrorStructure error = generateErrorService.generateError(status, "MT_ERR_GEN_0001", new String[]{simpleStackTrace}, stacktrace, getClass());
return new ResponseEntity<>(error, headers, status);
}
}

View File

@ -0,0 +1,66 @@
package com.millicom.microservice.service.controller.core;
import com.millicom.microservice.service.adapters.controlador.numero.temporal.NumeroTemporalRecurso;
import com.millicom.microservice.service.adapters.dto.common.ErrorStructure;
import com.millicom.microservice.service.service.common.GenerateErrorServiceImp;
import com.millicom.microservice.service.service.numero.propiedades.map.PropiedadesRespuesta;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import static com.millicom.microservice.service.external.services.common.Constants.ERROR_CODE_EXCEPTION;
import static com.millicom.microservice.service.external.services.common.Constants.ERROR_CODE_NOT_FOUND;
@RestController
public class ErrorPageController implements ErrorController {
@Autowired
PropiedadesRespuesta propiedadesRespuesta;
@Autowired
GenerateErrorServiceImp generateErrorService;
@Autowired
NumeroTemporalRecurso createOrderRecurso;
@RequestMapping(value = "/error", method = {
RequestMethod.GET,
RequestMethod.POST,
RequestMethod.DELETE,
RequestMethod.PATCH,
RequestMethod.OPTIONS})
public ResponseEntity<Object> handleError(HttpServletRequest request) {
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
if (status != null) {
int statusCode = Integer.parseInt(status.toString());
HttpStatus httpStatus = HttpStatus.valueOf(statusCode);
if (httpStatus == HttpStatus.NOT_FOUND) {
// String requestedPath = request.getAttribute("javax.servlet.error.request_uri").toString();
//ErrorStructure error = generateErrorService.generateError(httpStatus, ERROR_CODE_NOT_FOUND, null, "There is no controller for this operation" + requestedPath, getClass());
return ResponseEntity.status(httpStatus).body("The requested resource could not be found.");
// return ResponseEntity.status(200).contentType(MediaType.TEXT_XML).body(createOrderRecurso.obtenerFirma(request));
}
if (propiedadesRespuesta.getErrors().containsKey(String.valueOf(httpStatus.value()))) {
ErrorStructure error = generateErrorService.generateError(httpStatus, ERROR_CODE_NOT_FOUND, null, "N/A", getClass());
return ResponseEntity.status(httpStatus).body(error);
}
}
ErrorStructure error = generateErrorService.generateError(HttpStatus.INTERNAL_SERVER_ERROR, ERROR_CODE_EXCEPTION, null, "Default /error mapping", getClass());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
}
}

View File

@ -0,0 +1,71 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Clase Java para AdditionalParameters complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="AdditionalParameters"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="parametersList" type="{http://services.tigo.com.bo/}Parameters" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AdditionalParameters", propOrder = {
"parametersList"
})
public class AdditionalParameters {
@XmlElement(required = true)
protected List<Parameters> parametersList;
/**
* Gets the value of the parametersList property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the parametersList property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getParametersList().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Parameters }
*
*
*/
public List<Parameters> getParametersList() {
if (parametersList == null) {
parametersList = new ArrayList<Parameters>();
}
return this.parametersList;
}
}

View File

@ -0,0 +1,61 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para ConsultaRequest complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="ConsultaRequest"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="bodyRequest" type="{http://services.tigo.com.bo/}RequestBody"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConsultaRequest", propOrder = {
"bodyRequest"
})
public class ConsultaRequest {
@XmlElement(required = true)
protected RequestBody bodyRequest;
/**
* Obtiene el valor de la propiedad bodyRequest.
*
* @return
* possible object is
* {@link RequestBody }
*
*/
public RequestBody getBodyRequest() {
return bodyRequest;
}
/**
* Define el valor de la propiedad bodyRequest.
*
* @param value
* allowed object is
* {@link RequestBody }
*
*/
public void setBodyRequest(RequestBody value) {
this.bodyRequest = value;
}
}

View File

@ -0,0 +1,293 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Clase Java para ConsultaResponse complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="ConsultaResponse"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="headerResponse" type="{http://services.tigo.com.bo/}ResponseHeader"/&gt;
* &lt;element name="bodyResponse"&gt;
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="msisdnList" type="{http://services.tigo.com.bo/}MsisdnInformationType" minOccurs="0"/&gt;
* &lt;element name="transactionStatus" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="additionalResults" minOccurs="0"&gt;
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element ref="{http://services.tigo.com.bo/}ParameterType" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConsultaResponse", propOrder = {
"headerResponse",
"bodyResponse"
})
@XmlRootElement(name = "consultaResponse")
public class ConsultaResponse {
@XmlElement(required = true)
protected ResponseHeader headerResponse;
@XmlElement(required = true)
protected ConsultaResponse.BodyResponse bodyResponse;
/**
* Obtiene el valor de la propiedad headerResponse.
*
* @return
* possible object is
* {@link ResponseHeader }
*
*/
public ResponseHeader getHeaderResponse() {
return headerResponse;
}
/**
* Define el valor de la propiedad headerResponse.
*
* @param value
* allowed object is
* {@link ResponseHeader }
*
*/
public void setHeaderResponse(ResponseHeader value) {
this.headerResponse = value;
}
/**
* Obtiene el valor de la propiedad bodyResponse.
*
* @return
* possible object is
* {@link ConsultaResponse.BodyResponse }
*
*/
public ConsultaResponse.BodyResponse getBodyResponse() {
return bodyResponse;
}
/**
* Define el valor de la propiedad bodyResponse.
*
* @param value
* allowed object is
* {@link ConsultaResponse.BodyResponse }
*
*/
public void setBodyResponse(ConsultaResponse.BodyResponse value) {
this.bodyResponse = value;
}
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="msisdnList" type="{http://services.tigo.com.bo/}MsisdnInformationType" minOccurs="0"/&gt;
* &lt;element name="transactionStatus" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="additionalResults" minOccurs="0"&gt;
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element ref="{http://services.tigo.com.bo/}ParameterType" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"msisdnList",
"transactionStatus",
"additionalResults"
})
@XmlRootElement(name = "bodyResponse")
public static class BodyResponse {
protected MsisdnInformationType msisdnList;
@XmlElement(required = true)
protected String transactionStatus;
protected ConsultaResponse.BodyResponse.AdditionalResults additionalResults;
/**
* Obtiene el valor de la propiedad msisdnList.
*
* @return
* possible object is
* {@link MsisdnInformationType }
*
*/
public MsisdnInformationType getMsisdnList() {
return msisdnList;
}
/**
* Define el valor de la propiedad msisdnList.
*
* @param value
* allowed object is
* {@link MsisdnInformationType }
*
*/
public void setMsisdnList(MsisdnInformationType value) {
this.msisdnList = value;
}
/**
* Obtiene el valor de la propiedad transactionStatus.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTransactionStatus() {
return transactionStatus;
}
/**
* Define el valor de la propiedad transactionStatus.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTransactionStatus(String value) {
this.transactionStatus = value;
}
/**
* Obtiene el valor de la propiedad additionalResults.
*
* @return
* possible object is
* {@link ConsultaResponse.BodyResponse.AdditionalResults }
*
*/
public ConsultaResponse.BodyResponse.AdditionalResults getAdditionalResults() {
return additionalResults;
}
/**
* Define el valor de la propiedad additionalResults.
*
* @param value
* allowed object is
* {@link ConsultaResponse.BodyResponse.AdditionalResults }
*
*/
public void setAdditionalResults(ConsultaResponse.BodyResponse.AdditionalResults value) {
this.additionalResults = value;
}
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element ref="{http://services.tigo.com.bo/}ParameterType" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"parameterType"
})
public static class AdditionalResults {
@XmlElement(name = "ParameterType", namespace = "http://services.tigo.com.bo/", required = true)
protected List<ParameterType> parameterType;
/**
* Gets the value of the parameterType property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the parameterType property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getParameterType().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ParameterType }
*
*
*/
public List<ParameterType> getParameterType() {
if (parameterType == null) {
parameterType = new ArrayList<ParameterType>();
}
return this.parameterType;
}
}
}
}

View File

@ -0,0 +1,63 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para Consultar complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="Consultar"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="consultaRequest" type="{http://services.tigo.com.bo/}ConsultaRequest" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Consultar", propOrder = {
"consultaRequest"
})
//nuevo
@XmlRootElement(name = "Consultar")
public class Consultar {
protected ConsultaRequest consultaRequest;
/**
* Obtiene el valor de la propiedad consultaRequest.
*
* @return
* possible object is
* {@link ConsultaRequest }
*
*/
public ConsultaRequest getConsultaRequest() {
return consultaRequest;
}
/**
* Define el valor de la propiedad consultaRequest.
*
* @param value
* allowed object is
* {@link ConsultaRequest }
*
*/
public void setConsultaRequest(ConsultaRequest value) {
this.consultaRequest = value;
}
}

View File

@ -0,0 +1,31 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService(targetNamespace = "http://services.tigo.com.bo/", name = "ConsultarNumeroTemporal")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface ConsultarNumeroTemporal {
@WebMethod(operationName = "Consultar")
//@RequestWrapper(localName = "Consultar", targetNamespace = "http://services.tigo.com.bo/", className = "bo.com.tigo.services.Consultar")
//@ResponseWrapper(localName = "ConsultarResponse", targetNamespace = "http://services.tigo.com.bo/", className = "bo.com.tigo.services.ConsultarResponse")
// @WebResult(name = "return", targetNamespace = "")
// @WebResult(name = "ConsultarResponse", targetNamespace = "http://services.tigo.com.bo/", partName = "part1")
@WebResult(name = "ConsultarResponse", targetNamespace = "http://services.tigo.com.bo/")
public com.millicom.microservice.service.external.services.personalizado.ConsultarResponse consultar(
//@WebParam(name = "consultaRequest", targetNamespace = "")
//com.millicom.microservice.adaptador.external.services.ConsultaRequest consultaRequest
@WebParam(partName = "part1", name = "Consultar", targetNamespace = "http://services.tigo.com.bo/")
com.millicom.microservice.service.external.services.Consultar consultaRequest
);
}

View File

@ -0,0 +1,88 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.ws.Service;
import jakarta.xml.ws.WebEndpoint;
import jakarta.xml.ws.WebServiceClient;
import jakarta.xml.ws.WebServiceFeature;
import javax.xml.namespace.QName;
import java.net.MalformedURLException;
import java.net.URL;
/**
* This class was generated by Apache CXF 3.5.5
* 2024-05-01T11:12:44.275-04:00
* Generated source version: 3.5.5
*
*/
@WebServiceClient(name = "ConsultarNumeroTemporal",
wsdlLocation = "file:/C:/TIGO/DESAROLLO/REPOSITORIO/NUMERO_TEMPORAL/numerotemporal-service-api/src/main/resources/wsdl/ConsultarNumeroTemporal_1.wsdl",
targetNamespace = "http://services.tigo.com.bo/")
public class ConsultarNumeroTemporal_Service extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://services.tigo.com.bo/", "ConsultarNumeroTemporal");
public final static QName ConsultarNumeroTemporalPort = new QName("http://services.tigo.com.bo/", "ConsultarNumeroTemporalPort");
static {
URL url = null;
try {
url = new URL("file:/C:/TIGO/DESAROLLO/REPOSITORIO/NUMERO_TEMPORAL/numerotemporal-service-api/src/main/resources/wsdl/ConsultarNumeroTemporal_1.wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(ConsultarNumeroTemporal_Service.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "file:/C:/TIGO/DESAROLLO/REPOSITORIO/NUMERO_TEMPORAL/numerotemporal-service-api/src/main/resources/wsdl/ConsultarNumeroTemporal_1.wsdl");
}
WSDL_LOCATION = url;
}
public ConsultarNumeroTemporal_Service(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public ConsultarNumeroTemporal_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public ConsultarNumeroTemporal_Service() {
super(WSDL_LOCATION, SERVICE);
}
public ConsultarNumeroTemporal_Service(WebServiceFeature... features) {
super(WSDL_LOCATION, SERVICE, features);
}
public ConsultarNumeroTemporal_Service(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
public ConsultarNumeroTemporal_Service(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns ConsultarNumeroTemporal
*/
@WebEndpoint(name = "ConsultarNumeroTemporalPort")
public ConsultarNumeroTemporal getConsultarNumeroTemporalPort() {
return super.getPort(ConsultarNumeroTemporalPort, ConsultarNumeroTemporal.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns ConsultarNumeroTemporal
*/
@WebEndpoint(name = "ConsultarNumeroTemporalPort")
public ConsultarNumeroTemporal getConsultarNumeroTemporalPort(WebServiceFeature... features) {
return super.getPort(ConsultarNumeroTemporalPort, ConsultarNumeroTemporal.class, features);
}
}

View File

@ -0,0 +1,62 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para ConsultarResponse complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="ConsultarResponse"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="return" type="{http://services.tigo.com.bo/}ConsultaResponse" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConsultarResponse", propOrder = {
"_return"
})
public class ConsultarResponse {
@XmlElement(name = "return")
protected ConsultaResponse _return;
/**
* Obtiene el valor de la propiedad return.
*
* @return
* possible object is
* {@link ConsultaResponse }
*
*/
public ConsultaResponse getReturn() {
return _return;
}
/**
* Define el valor de la propiedad return.
*
* @param value
* allowed object is
* {@link ConsultaResponse }
*
*/
public void setReturn(ConsultaResponse value) {
this._return = value;
}
}

View File

@ -0,0 +1,68 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Clase Java para MsisdnInformationType complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="MsisdnInformationType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="msisdnInfo" type="{http://services.tigo.com.bo/}ResponseBody" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MsisdnInformationType", propOrder = {
"msisdnInfo"
})
@XmlRootElement(name = "msisdnList")
public class MsisdnInformationType {
@XmlElement(required = true)
protected List<ResponseBody> msisdnInfo;
/**
* Gets the value of the msisdnInfo property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the msisdnInfo property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMsisdnInfo().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ResponseBody }
*
*
*/
public List<ResponseBody> getMsisdnInfo() {
if (msisdnInfo == null) {
msisdnInfo = new ArrayList<ResponseBody>();
}
return this.msisdnInfo;
}
}

View File

@ -0,0 +1,71 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Clase Java para MsisdnListType complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="MsisdnListType"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="numbers" type="{http://services.tigo.com.bo/}Numbers" maxOccurs="unbounded"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MsisdnListType", propOrder = {
"numbers"
})
//@XmlRootElement(name = "msisdnList")
public class MsisdnListType {
@XmlElement(required = true)
protected List<Numbers> numbers;
/**
* Gets the value of the numbers property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the numbers property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNumbers().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Numbers }
*
*
*/
public List<Numbers> getNumbers() {
if (numbers == null) {
numbers = new ArrayList<Numbers>();
}
return this.numbers;
}
}

View File

@ -0,0 +1,89 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para Numbers complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="Numbers"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="temporaryNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="portNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Numbers", propOrder = {
"temporaryNumber",
"portNumber"
})
@XmlRootElement(name = "numbers")
public class Numbers {
protected String temporaryNumber;
protected String portNumber;
/**
* Obtiene el valor de la propiedad temporaryNumber.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTemporaryNumber() {
return temporaryNumber;
}
/**
* Define el valor de la propiedad temporaryNumber.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTemporaryNumber(String value) {
this.temporaryNumber = value;
}
/**
* Obtiene el valor de la propiedad portNumber.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPortNumber() {
return portNumber;
}
/**
* Define el valor de la propiedad portNumber.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPortNumber(String value) {
this.portNumber = value;
}
}

View File

@ -0,0 +1,184 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlElementDecl;
import jakarta.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the bo.com.tigo.services package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _Consultar_QNAME = new QName("http://services.tigo.com.bo/", "Consultar");
private final static QName _ConsultarResponse_QNAME = new QName("http://services.tigo.com.bo/", "ConsultarResponse");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: bo.com.tigo.services
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ConsultaResponse }
*
*/
public ConsultaResponse createConsultaResponse() {
return new ConsultaResponse();
}
/**
* Create an instance of {@link ConsultaResponse.BodyResponse }
*
*/
public ConsultaResponse.BodyResponse createConsultaResponseBodyResponse() {
return new ConsultaResponse.BodyResponse();
}
/**
* Create an instance of {@link Consultar }
*
*/
public Consultar createConsultar() {
return new Consultar();
}
/**
* Create an instance of {@link ConsultarResponse }
*
*/
public ConsultarResponse createConsultarResponse() {
return new ConsultarResponse();
}
/**
* Create an instance of {@link ParameterType }
*
*/
public ParameterType createParameterType() {
return new ParameterType();
}
/**
* Create an instance of {@link ConsultaRequest }
*
*/
public ConsultaRequest createConsultaRequest() {
return new ConsultaRequest();
}
/**
* Create an instance of {@link RequestBody }
*
*/
public RequestBody createRequestBody() {
return new RequestBody();
}
/**
* Create an instance of {@link MsisdnListType }
*
*/
public MsisdnListType createMsisdnListType() {
return new MsisdnListType();
}
/**
* Create an instance of {@link Numbers }
*
*/
public Numbers createNumbers() {
return new Numbers();
}
/**
* Create an instance of {@link AdditionalParameters }
*
*/
public AdditionalParameters createAdditionalParameters() {
return new AdditionalParameters();
}
/**
* Create an instance of {@link Parameters }
*
*/
public Parameters createParameters() {
return new Parameters();
}
/**
* Create an instance of {@link ResponseHeader }
*
*/
public ResponseHeader createResponseHeader() {
return new ResponseHeader();
}
/**
* Create an instance of {@link MsisdnInformationType }
*
*/
public MsisdnInformationType createMsisdnInformationType() {
return new MsisdnInformationType();
}
/**
* Create an instance of {@link ResponseBody }
*
*/
public ResponseBody createResponseBody() {
return new ResponseBody();
}
/**
* Create an instance of {@link ConsultaResponse.BodyResponse.AdditionalResults }
*
*/
public ConsultaResponse.BodyResponse.AdditionalResults createConsultaResponseBodyResponseAdditionalResults() {
return new ConsultaResponse.BodyResponse.AdditionalResults();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Consultar }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link Consultar }{@code >}
*/
@XmlElementDecl(namespace = "http://services.tigo.com.bo/", name = "Consultar")
public JAXBElement<Consultar> createConsultar(Consultar value) {
return new JAXBElement<Consultar>(_Consultar_QNAME, Consultar.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ConsultarResponse }{@code >}
*
* @param value
* Java instance representing xml element's value.
* @return
* the new instance of {@link JAXBElement }{@code <}{@link ConsultarResponse }{@code >}
*/
@XmlElementDecl(namespace = "http://services.tigo.com.bo/", name = "ConsultarResponse")
public JAXBElement<ConsultarResponse> createConsultarResponse(ConsultarResponse value) {
return new JAXBElement<ConsultarResponse>(_ConsultarResponse_QNAME, ConsultarResponse.class, null, value);
}
}

View File

@ -0,0 +1,88 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.*;
/**
* <p>Clase Java para anonymous complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="parameterName" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="parameterValue" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"parameterName",
"parameterValue"
})
@XmlRootElement(name = "ParameterType")
public class ParameterType {
@XmlElement(required = true)
protected String parameterName;
@XmlElement(required = true)
protected String parameterValue;
/**
* Obtiene el valor de la propiedad parameterName.
*
* @return
* possible object is
* {@link String }
*
*/
public String getParameterName() {
return parameterName;
}
/**
* Define el valor de la propiedad parameterName.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setParameterName(String value) {
this.parameterName = value;
}
/**
* Obtiene el valor de la propiedad parameterValue.
*
* @return
* possible object is
* {@link String }
*
*/
public String getParameterValue() {
return parameterValue;
}
/**
* Define el valor de la propiedad parameterValue.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setParameterValue(String value) {
this.parameterValue = value;
}
}

View File

@ -0,0 +1,87 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para Parameters complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="Parameters"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Parameters", propOrder = {
"name",
"value"
})
public class Parameters {
protected String name;
protected String value;
/**
* Obtiene el valor de la propiedad name.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Define el valor de la propiedad name.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Obtiene el valor de la propiedad value.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Define el valor de la propiedad value.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,90 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Clase Java para RequestBody complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="RequestBody"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="msisdnList" type="{http://services.tigo.com.bo/}MsisdnListType"/&gt;
* &lt;element name="additionalParameters" type="{http://services.tigo.com.bo/}AdditionalParameters" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RequestBody", propOrder = {
"msisdnList",
"additionalParameters"
})
//@XmlRootElement(name = "requestBody")
public class RequestBody {
@XmlElement(required = true)
protected MsisdnListType msisdnList;
protected AdditionalParameters additionalParameters;
/**
* Obtiene el valor de la propiedad msisdnList.
*
* @return
* possible object is
* {@link MsisdnListType }
*
*/
public MsisdnListType getMsisdnList() {
return msisdnList;
}
/**
* Define el valor de la propiedad msisdnList.
*
* @param value
* allowed object is
* {@link MsisdnListType }
*
*/
public void setMsisdnList(MsisdnListType value) {
this.msisdnList = value;
}
/**
* Obtiene el valor de la propiedad additionalParameters.
*
* @return
* possible object is
* {@link AdditionalParameters }
*
*/
public AdditionalParameters getAdditionalParameters() {
return additionalParameters;
}
/**
* Define el valor de la propiedad additionalParameters.
*
* @param value
* allowed object is
* {@link AdditionalParameters }
*
*/
public void setAdditionalParameters(AdditionalParameters value) {
this.additionalParameters = value;
}
}

View File

@ -0,0 +1,335 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.*;
import javax.xml.datatype.XMLGregorianCalendar;
/**
* <p>Clase Java para ResponseBody complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="ResponseBody"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="code" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="temporaryNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="portInNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="iccid" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="dateAssociation" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&gt;
* &lt;element name="dateEnabling" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/&gt;
* &lt;element name="state" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="modality" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="commercialPlan" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;element name="idPlan" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseBody", propOrder = {
"code",
"description",
"temporaryNumber",
"portInNumber",
"iccid",
"dateAssociation",
"dateEnabling",
"state",
"modality",
"commercialPlan",
"idPlan"
})
@XmlRootElement(name = "msisdnInfo")
public class ResponseBody {
@XmlElement(required = true)
protected String code;
@XmlElement(required = true)
protected String description;
protected String temporaryNumber;
protected String portInNumber;
protected String iccid;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateAssociation;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateEnabling;
protected String state;
protected String modality;
protected String commercialPlan;
protected String idPlan;
/**
* Obtiene el valor de la propiedad code.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCode() {
return code;
}
/**
* Define el valor de la propiedad code.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCode(String value) {
this.code = value;
}
/**
* Obtiene el valor de la propiedad description.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Define el valor de la propiedad description.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Obtiene el valor de la propiedad temporaryNumber.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTemporaryNumber() {
return temporaryNumber;
}
/**
* Define el valor de la propiedad temporaryNumber.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTemporaryNumber(String value) {
this.temporaryNumber = value;
}
/**
* Obtiene el valor de la propiedad portInNumber.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPortInNumber() {
return portInNumber;
}
/**
* Define el valor de la propiedad portInNumber.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPortInNumber(String value) {
this.portInNumber = value;
}
/**
* Obtiene el valor de la propiedad iccid.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIccid() {
return iccid;
}
/**
* Define el valor de la propiedad iccid.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIccid(String value) {
this.iccid = value;
}
/**
* Obtiene el valor de la propiedad dateAssociation.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDateAssociation() {
return dateAssociation;
}
/**
* Define el valor de la propiedad dateAssociation.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDateAssociation(XMLGregorianCalendar value) {
this.dateAssociation = value;
}
/**
* Obtiene el valor de la propiedad dateEnabling.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDateEnabling() {
return dateEnabling;
}
/**
* Define el valor de la propiedad dateEnabling.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDateEnabling(XMLGregorianCalendar value) {
this.dateEnabling = value;
}
/**
* Obtiene el valor de la propiedad state.
*
* @return
* possible object is
* {@link String }
*
*/
public String getState() {
return state;
}
/**
* Define el valor de la propiedad state.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setState(String value) {
this.state = value;
}
/**
* Obtiene el valor de la propiedad modality.
*
* @return
* possible object is
* {@link String }
*
*/
public String getModality() {
return modality;
}
/**
* Define el valor de la propiedad modality.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setModality(String value) {
this.modality = value;
}
/**
* Obtiene el valor de la propiedad commercialPlan.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCommercialPlan() {
return commercialPlan;
}
/**
* Define el valor de la propiedad commercialPlan.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCommercialPlan(String value) {
this.commercialPlan = value;
}
/**
* Obtiene el valor de la propiedad idPlan.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIdPlan() {
return idPlan;
}
/**
* Define el valor de la propiedad idPlan.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIdPlan(String value) {
this.idPlan = value;
}
}

View File

@ -0,0 +1,88 @@
package com.millicom.microservice.service.external.services;
import jakarta.xml.bind.annotation.*;
/**
* <p>Clase Java para ResponseHeader complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* &lt;complexType name="ResponseHeader"&gt;
* &lt;complexContent&gt;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
* &lt;sequence&gt;
* &lt;element name="code" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string"/&gt;
* &lt;/sequence&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResponseHeader", propOrder = {
"code",
"description"
})
@XmlRootElement(name = "headerResponse")
public class ResponseHeader {
@XmlElement(required = true)
protected String code;
@XmlElement(required = true)
protected String description;
/**
* Obtiene el valor de la propiedad code.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCode() {
return code;
}
/**
* Define el valor de la propiedad code.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCode(String value) {
this.code = value;
}
/**
* Obtiene el valor de la propiedad description.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Define el valor de la propiedad description.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
}

View File

@ -0,0 +1,26 @@
package com.millicom.microservice.service.external.services.common;
public class Constants {
//Error Codes:
public static final String ERROR_CODE_EXCEPTION = "ERR_GEN_0000";
public static final String ERROR_DESC_EXCEPTION = "An Exception has occured.";
public static final String ERROR_MISSING_FIELD_EXCEPTION = "Missing required field: ";
public static final String ERROR_CODE_NOT_FOUND = "ERR_GEN_0001";
public static final String GET_COUNTRY = "getCountryName";
public static final String CAPITAL_ID = "capital";
public static final String CONTENT_TYPE = "content-type";
public static final String SYSTEM_COMMON_DOMAIN = "getCountryName";
public static final String VALIDACION_FALIIDA = "Validacion Fallida";
public static final String MODULO ="numerotemporal-service-api";
private Constants() {
}
}

View File

@ -0,0 +1,2 @@
@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://services.tigo.com.bo/")
package com.millicom.microservice.service.external.services;

View File

@ -0,0 +1,34 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "bodyResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class BodyResponse {
@XmlElement(name = "msisdnList")
private MsisdnList msisdnList;
@XmlElement(name = "transactionStatus")
private String transactionStatus;
public MsisdnList getMsisdnList() {
return msisdnList;
}
public void setMsisdnList(MsisdnList msisdnList) {
this.msisdnList = msisdnList;
}
public String getTransactionStatus() {
return transactionStatus;
}
public void setTransactionStatus(String transactionStatus) {
this.transactionStatus = transactionStatus;
}
}

View File

@ -0,0 +1,17 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import lombok.Getter;
@XmlRootElement(name = "ConsultarResponse", namespace = "http://services.tigo.com.bo/")
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
public class ConsultarResponse {
@XmlElement(name = "return")
private ReturnElement returnElement;
}

View File

@ -0,0 +1,33 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "headerResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class HeaderResponse {
@XmlElement(name = "code")
private String code;
@XmlElement(name = "description")
private String description;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

View File

@ -0,0 +1,121 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.*;
import javax.xml.datatype.XMLGregorianCalendar;
@XmlRootElement(name = "msisdnInfo")
@XmlAccessorType(XmlAccessType.FIELD)
public class MsisdnInfo {
@XmlElement(name = "code")
private String code;
@XmlElement(name = "description")
private String description;
@XmlElement(name = "temporaryNumber")
private String temporaryNumber;
@XmlElement(name = "portInNumber")
private String portInNumber;
protected String iccid;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateAssociation;
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar dateEnabling;
protected String state;
protected String modality;
protected String commercialPlan;
protected String idPlan;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getTemporaryNumber() {
return temporaryNumber;
}
public void setTemporaryNumber(String temporaryNumber) {
this.temporaryNumber = temporaryNumber;
}
public String getPortInNumber() {
return portInNumber;
}
public void setPortInNumber(String portInNumber) {
this.portInNumber = portInNumber;
}
public String getIccid() {
return iccid;
}
public void setIccid(String iccid) {
this.iccid = iccid;
}
public XMLGregorianCalendar getDateAssociation() {
return dateAssociation;
}
public void setDateAssociation(XMLGregorianCalendar dateAssociation) {
this.dateAssociation = dateAssociation;
}
public XMLGregorianCalendar getDateEnabling() {
return dateEnabling;
}
public void setDateEnabling(XMLGregorianCalendar dateEnabling) {
this.dateEnabling = dateEnabling;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getModality() {
return modality;
}
public void setModality(String modality) {
this.modality = modality;
}
public String getCommercialPlan() {
return commercialPlan;
}
public void setCommercialPlan(String commercialPlan) {
this.commercialPlan = commercialPlan;
}
public String getIdPlan() {
return idPlan;
}
public void setIdPlan(String idPlan) {
this.idPlan = idPlan;
}
}

View File

@ -0,0 +1,26 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "msisdnList")
@XmlAccessorType(XmlAccessType.FIELD)
public class MsisdnList {
@XmlElement(name = "msisdnInfo")
private List<MsisdnInfo> msisdnInfo;
public List<MsisdnInfo> getMsisdnInfo() {
return msisdnInfo;
}
public void setMsisdnInfo(List<MsisdnInfo> msisdnInfo) {
this.msisdnInfo = msisdnInfo;
}
}

View File

@ -0,0 +1,37 @@
package com.millicom.microservice.service.external.services.personalizado;
import jakarta.xml.bind.annotation.*;
import lombok.Getter;
@XmlRootElement(name = "return")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "return", propOrder = {
"headerResponse",
"bodyResponse"
})
@Getter
public class ReturnElement {
@XmlElement(name = "headerResponse")
private HeaderResponse headerResponse;
@XmlElement(name = "bodyResponse")
private BodyResponse bodyResponse;
public HeaderResponse getHeaderResponse() {
return headerResponse;
}
public void setHeaderResponse(HeaderResponse headerResponse) {
this.headerResponse = headerResponse;
}
public BodyResponse getBodyResponse() {
return bodyResponse;
}
public void setBodyResponse(BodyResponse bodyResponse) {
this.bodyResponse = bodyResponse;
}
}

View File

@ -0,0 +1,14 @@
package com.millicom.microservice.service.service.common;
import com.millicom.microservice.service.adapters.dto.common.ErrorStructure;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.stereotype.Service;
@Service
public interface GenerateErrorService {
ErrorStructure generateError(HttpStatusCode httpStatus, String errorCode, String[] params, String description, Class<?> ownerObject);
void generarExcepcion( HttpStatus httpStatus, String descripcion);
}

View File

@ -0,0 +1,92 @@
package com.millicom.microservice.service.service.common;
import com.millicom.microservice.service.adapters.dto.common.ErrorStructure;
import com.millicom.microservice.service.adapters.dto.common.OperationException;
import com.millicom.microservice.service.service.numero.propiedades.Propiedades;
import com.readinessit.library.logging.application.services.LoggerService;
import io.micrometer.tracing.Tracer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.stereotype.Service;
import static com.millicom.microservice.service.external.services.common.Constants.MODULO;
@Service
public class GenerateErrorServiceImp implements GenerateErrorService {
public final Tracer tracer;
private final Propiedades propiedades;
@Value("${modules.common.i18n.errorMessage.default.lang:en-US}")
public String defaultCountry;
@Autowired
public GenerateErrorServiceImp(Tracer tracer, Propiedades propiedades) {
this.tracer = tracer;
this.propiedades = propiedades;
}
@Override
public ErrorStructure generateError(HttpStatusCode httpStatus, String errorCode, String[] params, String description, Class ownerObject) {
return generarErrorNuevo((HttpStatus) httpStatus, description);
}
/**
* Genera una estructura de error para una respuesta HTTP y descripción proporcionadas.
*
* @param httpStatus El estado HTTP de la respuesta.
* @param description La descripción del error.
* @return Una estructura de error que contiene el estado HTTP y la lista de errores correspondiente.
*/
public ErrorStructure generarErrorNuevo(HttpStatus httpStatus, String description) {
ErrorStructure errorStructure = new ErrorStructure();
errorStructure.setHttpStatus(httpStatus);
String status = String.valueOf(httpStatus.value());
String error = propiedades.getMapResponse().getOrDefault(status, null);
if (error != null) {
errorStructure.setHttpStatus(httpStatus);
errorStructure.setValor(error);
}
if (errorStructure.getValor() == null) {
LoggerService.logBusiness(MODULO, "Devolviendo Respuesta por Default", null);
errorStructure.setValor(propiedades.getMapResponse().getOrDefault("default", "SoapFault Exception"));
errorStructure.setHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR);
}
return errorStructure;
}
/**
* Obtiene la lista de errores a partir del estado y la respuesta proporcionados.
*
* @param status El estado de la respuesta.
* @param response La respuesta en formato JSON.
* @return Una lista de errores, o una lista vacía si el estado no está mapeado o hay problemas de procesamiento.
*/
/**
* Método para generar y lanzar una excepción de operación.
*
* @param httpStatus Estado HTTP que se utilizará en la excepción.
* @throws OperationException Excepción de operación generada con el error correspondiente.
*/
@Override
public void generarExcepcion(HttpStatus httpStatus, String descripcion) {
throw new OperationException(httpStatus, generateError(
httpStatus,
descripcion,
new String[]{descripcion},
descripcion,
this.getClass()
));
}
}

View File

@ -0,0 +1,99 @@
package com.millicom.microservice.service.service.messaging;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.millicom.microservice.service.adapters.dto.common.ErrorStructure;
import com.millicom.microservice.service.service.common.GenerateErrorService;
import com.readinessit.library.logging.application.services.LoggerService;
import com.readinessit.library.messaging.data.MessageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
import static com.millicom.microservice.service.external.services.common.Constants.*;
@Service
public class ErrorMapper {
private final GenerateErrorService generateErrorService;
private final ObjectMapper mapper;
@Value("${service.numerotemporal.codigos.http.a.controlar}")
private List<Integer> httpCodes;
@Autowired
public ErrorMapper(GenerateErrorService generateErrorService, ObjectMapper mapper) {
this.generateErrorService = generateErrorService;
this.mapper = mapper;
}
public ErrorStructure validate(Object response) {
if (response == null) {
return generateErrorService.generateError(HttpStatus.BAD_GATEWAY, ERROR_CODE_EXCEPTION,
new String[]{ERROR_DESC_EXCEPTION}, ERROR_DESC_EXCEPTION, this.getClass());
} else if (response instanceof MessageResponse resp && resp.isError()) {
if (httpCodes.contains(resp.getResponseStatus().value())) {
ResponseEntity<Object> error = handleErrorResponseCreation(resp.getResponseHeaders(),
resp.getResponseStatus(), resp.getResponse());
ErrorStructure errorStructure = error.hasBody() ? (ErrorStructure) error.getBody() : null;
if (errorStructure != null && errorStructure.getValor() != null) {
return generateErrorService.generateError(resp.getResponseStatus(), errorStructure.toString(),
new String[]{errorStructure.toString()}, obtenerJsonDeMessageResponse(resp), getClass());
}
return errorStructure;
} else {
LoggerService.logBusiness(MODULO, "No se controlara el http: " + resp.getResponseStatus().toString(), null);
}
}
return null;
}
private ResponseEntity<Object> handleErrorResponseCreation(HttpHeaders headers, HttpStatusCode status, Object response) {
ErrorStructure error;
try {
error = mapper.convertValue(response, ErrorStructure.class);
if (error == null || error.getValor() == null) {
if (HttpStatus.INTERNAL_SERVER_ERROR.equals(status))
response = ERROR_DESC_EXCEPTION;
String description;
try {
description = response != null ? mapper.writeValueAsString(response) : null;
} catch (JsonProcessingException e) {
LoggerService.logException(MODULO, "JsonProcessingException: " + e.getMessage(), e);
description = ERROR_DESC_EXCEPTION;
}
error = generateErrorService.generateError(status, ERROR_CODE_EXCEPTION, new String[]{ERROR_DESC_EXCEPTION}, description, getClass());
}
} catch (Exception ex) {
error = generateErrorService.generateError(HttpStatus.INTERNAL_SERVER_ERROR, ERROR_CODE_EXCEPTION, new String[]{ERROR_DESC_EXCEPTION}, ERROR_DESC_EXCEPTION, getClass());
}
return new ResponseEntity<>(error, headers, status);
}
public String obtenerJsonDeMessageResponse(MessageResponse messageResponse) {
try {
return mapper.writeValueAsString(messageResponse.getResponse());
} catch (JsonProcessingException jsonProcessingException) {
LoggerService.logException(MODULO, "JsonProcessingException: " + jsonProcessingException.getMessage(), jsonProcessingException);
// Manejar la excepción o registrarla si es necesario
return null;
}
}
}

View File

@ -0,0 +1,80 @@
package com.millicom.microservice.service.service.messaging;
import com.readinessit.library.commoninterfaces.common.ISessionInfo;
import com.readinessit.library.commoninterfaces.messages.MessageIdentifiers;
import io.micrometer.tracing.Tracer;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.stereotype.Service;
import java.util.UUID;
@Service
public class MessageIdentifiersImp implements MessageIdentifiers {
@Autowired
ISessionInfo sessionDTO;
@Autowired
Tracer tracer;
@Override
public String calculateInternalId(HttpServletRequest httpServletRequest) {
return handleInternalId();
}
@Override
public String calculateInteractionId(HttpServletRequest httpServletRequest) {
return handleInteractionId();
}
@Override
public String calculateNegotiationId(HttpServletRequest httpServletRequest) {
return sessionDTO.getExternalId();
}
@Override
public String calculateUserId(ServerHttpResponse httpServletRequest) {
return sessionDTO.getUserId();
}
@Override
public String calculateInternalId(ServerHttpResponse httpServletResponse) {
return handleInternalId();
}
@Override
public String calculateInteractionId(ServerHttpResponse httpServletRequest) {
return handleInteractionId();
}
@Override
public String calculateNegotiationId(ServerHttpResponse httpServletRequest) {
return null;
}
@Override
public String calculateUserId(HttpServletRequest httpServletResponse) {
String userId = httpServletResponse.getHeader("x-consumer-username");
if(sessionDTO.getUserId() == null)
sessionDTO.setUserId(userId);
return userId;
}
private String handleInteractionId() {
if(sessionDTO.getTransactionId() == null)
sessionDTO.setTransactionId(UUID.randomUUID().toString());
return sessionDTO.getTransactionId();
}
private String handleInternalId() {
var currentSpan = tracer.currentSpan();
if (currentSpan != null && sessionDTO.getInternalId() == null)
sessionDTO.setInternalId(currentSpan.context().traceId());
return sessionDTO.getInternalId();
}
}

View File

@ -0,0 +1,20 @@
package com.millicom.microservice.service.service.numero.propiedades;
import java.util.Map;
public interface Propiedades {
Map<String, String> getMapHeader();
Map<String, String> getMapPathVars();
Map<String, String> getMapResponse();
String getOperacion();
String getSistema();
boolean isDevolverCabeceras();
}

View File

@ -0,0 +1,60 @@
package com.millicom.microservice.service.service.numero.propiedades;
import com.millicom.microservice.service.service.numero.propiedades.map.PropiedadesCabeceras;
import com.millicom.microservice.service.service.numero.propiedades.map.PropiedadesRespuesta;
import com.millicom.microservice.service.service.numero.propiedades.map.PropiedadesVariableRuta;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
public class PropiedadesImplementacion implements Propiedades {
@Autowired
private PropiedadesCabeceras propiedadesCabeceras;
@Autowired
private PropiedadesVariableRuta propiedadesVariableRuta;
@Autowired
private PropiedadesRespuesta propiedadesRespuesta;
@Value("${service.numerotemporal.operacion}")
private String operacion;
@Value("${service.numerotemporal.sistema}")
private String sistema;
@Value("${service.numerotemporal.devolver.cabeceras.del.legado}")
private boolean devolverCabeceras;
@Override
public Map<String, String> getMapHeader() {
return propiedadesCabeceras.getHeader();
}
@Override
public Map<String, String> getMapPathVars() {
return propiedadesVariableRuta.getVars();
}
@Override
public Map<String, String> getMapResponse() {
return propiedadesRespuesta.getErrors();
}
@Override
public String getOperacion() {
return operacion;
}
@Override
public String getSistema() {
return sistema;
}
@Override
public boolean isDevolverCabeceras() {
return devolverCabeceras;
}
}

View File

@ -0,0 +1,21 @@
package com.millicom.microservice.service.service.numero.propiedades.map;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Configuration
@PropertySource("classpath:application.properties")
@ConfigurationProperties("service.numerotemporal.legado")
@Getter
@Component
public class PropiedadesCabeceras {
private final Map<String, String> header = new HashMap<>();
}

View File

@ -0,0 +1,18 @@
package com.millicom.microservice.service.service.numero.propiedades.map;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Configuration
@ConfigurationProperties("response")
@Getter
@Component
public class PropiedadesRespuesta {
private final Map<String, String> errors = new HashMap<>();
}

View File

@ -0,0 +1,20 @@
package com.millicom.microservice.service.service.numero.propiedades.map;
import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Configuration
@PropertySource("classpath:application.properties")
@ConfigurationProperties("service.numerotemporal.path")
@Getter
@Component
public class PropiedadesVariableRuta {
private final Map<String, String> vars = new HashMap<>();
}

View File

@ -0,0 +1,14 @@
package com.millicom.microservice.service.service.numero.temporal;
import com.millicom.microservice.service.external.services.ConsultaRequest;
import com.millicom.microservice.service.external.services.personalizado.ConsultarResponse;
/**
* Interfaz que define operaciones relacionadas con individuos.
*/
public interface Consultar {
ConsultarResponse consultar(ConsultaRequest requestSoap);
}

View File

@ -0,0 +1,78 @@
package com.millicom.microservice.service.service.numero.temporal;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.millicom.microservice.service.adapters.Adapter;
import com.millicom.microservice.service.adapters.dto.common.OperationException;
import com.millicom.microservice.service.external.services.ConsultaRequest;
import com.millicom.microservice.service.external.services.personalizado.ConsultarResponse;
import com.millicom.microservice.service.service.messaging.ErrorMapper;
import com.millicom.microservice.service.service.numero.propiedades.Propiedades;
import com.readinessit.library.logging.application.services.LoggerService;
import com.readinessit.library.messaging.data.MessageResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import static com.millicom.microservice.service.external.services.common.Constants.MODULO;
@Service
public class ConsultarImplementacion implements Consultar {
private final Propiedades propiedades;
private final Adapter adapter;
private final ErrorMapper errorMapperImp;
@Value("${service.numerotemporal.operacion}")
private String operacion;
@Value("${service.numerotemporal.sistema}")
private String sistema;
@Autowired
public ConsultarImplementacion(Propiedades propiedades, Adapter adapter, ErrorMapper errorMapperImp) {
this.propiedades = propiedades;
this.adapter = adapter;
this.errorMapperImp = errorMapperImp;
}
/**
* Ejecuta una transacción.
*
* @param requestSoap La solicitud de transacción.
* @return La respuesta de la transacción ejecutada.
* @throws OperationException Si ocurre un error durante la ejecución de la transacción.
*/
@Override
public ConsultarResponse consultar(ConsultaRequest requestSoap) throws OperationException {
long tiempoInicio = System.currentTimeMillis();
MessageResponse respuestaServicio = enviarMensaje(requestSoap);
var errorStructure = errorMapperImp.validate(respuestaServicio);
if (errorStructure != null) {
throw new OperationException(errorStructure.getHttpStatus(), errorStructure);
}
LoggerService.logBusiness(MODULO, "Tiempo obtener consultar: " + (System.currentTimeMillis() - tiempoInicio) + " ms.", null);
if (respuestaServicio.getResponse() instanceof HashMap<?, ?>) {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.convertValue(respuestaServicio.getResponse(), ConsultarResponse.class);
}
return (ConsultarResponse) respuestaServicio.getResponse();
}
/**
* Envía un mensaje.
*
* @param pedido El pedido a enviar.
* @return La respuesta del mensaje enviado.
*/
private MessageResponse enviarMensaje(Object pedido) {
return adapter.sendMessage(this.getClass(), operacion, pedido, propiedades.getMapPathVars(), propiedades.getMapHeader(), sistema);
}
}

View File

@ -0,0 +1,106 @@
#DB
# spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect
#spring.jpa.show-sql=false
#spring.jpa.hibernate.ddl-auto=none
#spring.database.driverClassName=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/mstemplate
#spring.datasource.username=admin
#spring.datasource.password=admin
# LIQUIBASE settings
#logging.level.liquibase=ERROR
#spring.liquibase.change-log=classpath:/db/master.xml
#APP
server.port=${SERVER_PORT:8080}
#Rit Modules
modules.logging.message.enable-interceptors=${MODULES_LOGGING_MESSAGE_ENABLE_INTERCEPTORS:true}
modules.logging.message.enable=${MODULES_LOGGING_MESSAGE_ENABLE:true}
modules.logging.message.configuration=${MODULES_LOGGING_MESSAGE_CONFIGURATION:CONSOLE,EVENT}
modules.logging.application.enable=${MODULES_LOGGING_APPLICATION_ENABLE:true}
modules.logging.application.level=${MODULES_LOGGING_APPLICATION_LEVEL:DEBUG}
modules.logging.application.configuration=${MODULES_LOGGING_APPLICATION_CONFIGURATION:{'*':'CONSOLE,EVENT'}}
modules.common.vtconfig.enable=${MODULES_COMMON_VTCONFIG_ENABLE:true}
modules.common.vtconfig.use-cache=${MODULES_COMMON_VTCONFIG_USE_CACHE:true}
modules.common.i18n.errorMessage.enable=${MODULES_COMMON_I18N_ERRORMESSAGE_ENABLE:true}
modules.common.i18n.errorMessage.default.lang=${MODULES_COMMON_I18N_ERRORMESSAGE_DEFAULT_LANG:en-US}
modules.common.i18n.locale=${MODULES_COMMON_I18N_LOCALE:en-US,es-ES}
modules.common.i18n.default-lang=${MODULES_COMMON_I18N_DEFAULT_LANG:en-US}
#Management and Metrics
management.endpoints.web.exposure.include=${MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
management.prometheus.metrics.export.enabled=${MANAGEMENT_PROMETHEUS_METRICS_EXPORT_ENABLED:true}
management.endpoint.health.probes.enabled=${MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED:true}
management.metrics.tags.application=${spring.application.name}
spring.application.name=${SPRING_APPLICATION_NAME:numerotemporal-service-api}
spring.sleuth.otel.config.trace-id-ratio-based=${SPRING_SLEUTH_OTEL_CONFIG_TRACE_ID_RATIO_BASED:0}
spring.sleuth.otel.exporter.otlp.endpoint=${SPRING_SLEUTH_OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4317}
spring.sleuth.otel.log.exporter.enabled=${SPRING_SLEUTH_OTEL_LOG_EXPORTER_ENABLED:false}
spring.sleuth.async.enabled=${SPRING_SLEUTH_ASYNC_ENABLED:false}
spring.sleuth.propagation.type=${SPRING_SLEUTH_PROPAGATION_TYPE:b3}
spring.sleuth.baggage.remote-fields=${SPRING_SLEUTH_BAGGAGE_REMOTE_FIELDS:x-consumer-username}
event.processing.client.producer.enable=${EVENT_PROCESSING_CLIENT_PRODUCER_ENABLE:false}
event.processing.queue.engine=${EVENT_PROCESSING_QUEUE_ENGINE:KAFKA}
event.processing.kafka.address=${EVENT_PROCESSING_KAFKA_ADDRESS:kf-cluster-kafka-bootstrap.msg-prod.svc.cluster.local:9092}
event.processing.queue.business=${EVENT_PROCESSING_QUEUE_BUSINESS:event-tracing}
event.processing.queue.message=${EVENT_PROCESSING_QUEUE_MESSAGE:event-tracing}
event.processing.queue.application=${EVENT_PROCESSING_QUEUE_APPLICATION:event-tracing}
event.processing.logger.event.enable=${EVENT_PROCESSING_LOGGER_EVENT_ENABLE:true}
## Messaging
app.environment=${APP_ENVIRONMENT:PROD}
modules.messaging.baseurl.isProperty=${MODULES_MESSAGING_BASEURL_ISPROPERTY:true}
modules.logging.obfuscation.enabled=${MODULES_LOGGING_OBFUSCATION_ENABLED:true}
modules.logging.obfuscation.defaultReplaceType=${MODULES_LOGGING_OBFUSCATION_DEFAULTREPLACETYPE:-}
modules.logging.obfuscation.replaceType.number=${MODULES_LOGGING_OBFUSCATION_REPLACETYPE_NUMBER:000000}
modules.logging.obfuscation.replaceType.string=${MODULES_LOGGING_OBFUSCATION_REPLACETYPE_STRING:XXXXXX}
modules.logging.obfuscation.configurationList[0]=${MODULES_LOGGING_OBFUSCATION_CONFIGURATIONLIST[0]:GET,.*,$[0].name.common,string}
#Native options:
spring.native.remove-unused-autoconfig=${SPRING_NATIVE_REMOVE_UNUSED_AUTOCONFIG:true}
spring.native.remove-yaml-support=${SPRING_NATIVE_REMOVE_YAML_SUPPORT:true}
#VALOR DE OPERACION
service.numerotemporal.operacion=${SERVICE_NUMEROTEMPORAL_OPERACION:numerotemporal}
#VALOR DE SISTEMA
service.numerotemporal.sistema=${SERVICE_NUMEROTEMPORAL_SISTEMA:numerotemporal}
service.numerotemporal.metodo=${SERVICE_NUMEROTEMPORAL_METODO:POST}
#Messaging configuration for external services
modules.messaging.configuration.adapterDefinitions[0]=${MODULES_MESSAGING_CONFIGURATION_ADAPTERDEFINITIONS[0]:AD_COD_0001,com.millicom.microservice.service.service.numero.temporal.ConsultarImplementacion,${service.numerotemporal.operacion},${service.numerotemporal.metodo},,com.millicom.microservice.service.external.services.personalizado.ConsultarResponse,${service.numerotemporal.sistema}}
#Adapter endpoints
modules.messaging.configuration.adapterEndpoints[0]=${MODULES_MESSAGING_CONFIGURATION_ADAPTERENDPOINTS[0]:AE_COD_0001,AD_COD_0001,messaging.baseUrl.numerotemporal.orquestador,PROD,,,}
#LEGADO
messaging.baseUrl.numerotemporal.orquestador=${MESSAGING_BASEURL_NUMEROTEMPORAL_ORQUESTADOR:http://172.28.66.196:8143/api/v1/resourceValidation}
#CABECERAS QUE SE ENVIAN DEL ADAPTADOR AL LEGADO (N cabeceras)
service.numerotemporal.legado.header.content-type=${SERVICE_NUMEROTEMPORAL_LEGADO_HEADER_CONTENT_TYPE:application/json}
#PATCH que recibe el adaptador (N var)
#service.numerotemporal.path.vars.content-type=application/json
#BANDERA PARA DEVOLVER CABECERAS DEL LEGADO
service.numerotemporal.devolver.cabeceras.del.legado=${SERVICE_NUMEROTEMPORAL_DEVOLVER_CABECERAS_DEL_LEGADO:false}
#PATCH SERVICIO numerotemporal
service.numerotemporal.patch=${SERVICE_NUMEROTEMPORAL_PATCH:/api/v1/consultaNumeroTemporalV2}
service.numerotemporal.codigos.http.a.controlar=${SERVICE_NUMEROTEMPORAL_CODIGOS_HTTP_A_CONTROLAR:502}
response.errors.400=${RESPONSE_ERRORS_400_ERRORS[0]_MESSAGE:Cannot query field 'lifecycleStatus6' on type 'Products'. Did you mean 'lifecycleStatus', 'lifecycles' or 'lifecyclesList'? (line 6, column 11):\n statusPhone_status: lifecycleStatus6\n ^}
response.errors.405=${RESPONSE_ERRORS_405_ERRORS[0]_MESSAGE:Method Not Allowed}
response.errors.500=${RESPONSE_ERRORS_500_ERRORS[0]_MESSAGE:unknown_error}
response.errors.503=${RESPONSE_ERRORS_503_ERRORS[0]_MESSAGE:server that is down for maintenance or that is overloaded}
response.errors.502=${RESPONSE_ERRORS_502_ERRORS[0]_MESSAGE:No se pudo establecer conexion con el Servidor: ${messaging.baseUrl.numerotemporal.orquestador}}
response.errors.415=${RESPONSE_ERRORS_415_ERRORS[0]_MESSAGE:The request's Content-Type is not supported. Expected:application/json or application/vnd.api+json}
response.errors.default=${RESPONSE_ERRORS_DEFAULT_ERRORS[0]_MESSAGE:Error Interno del Adaptador}
#logging.level.org.springframework.ws.client.MessageTracing.sent=DEBUG
#logging.level.org.springframework.ws.server.MessageTracing.sent=DEBUG
#logging.level.org.springframework.ws.client.MessageTracing.received=TRACE
#logging.level.org.springframework.ws.server.MessageTracing.received=TRACE

View File

@ -0,0 +1,105 @@
#DB
# spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect
#spring.jpa.show-sql=false
#spring.jpa.hibernate.ddl-auto=none
#spring.database.driverClassName=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/mstemplate
#spring.datasource.username=admin
#spring.datasource.password=admin
# LIQUIBASE settings
#logging.level.liquibase=ERROR
#spring.liquibase.change-log=classpath:/db/master.xml
#APP
server.port=8142
#Rit Modules
modules.logging.message.enable-interceptors=true
modules.logging.message.enable=true
modules.logging.message.configuration=CONSOLE,EVENT
modules.logging.application.enable=true
modules.logging.application.level=DEBUG
modules.logging.application.configuration={'*':'CONSOLE,EVENT'}
modules.common.vtconfig.enable=true
modules.common.vtconfig.use-cache=true
modules.common.i18n.errorMessage.enable=true
modules.common.i18n.errorMessage.default.lang=en-US
modules.common.i18n.locale=en-US,es-ES
modules.common.i18n.default-lang=en-US
#Management and Metrics
management.endpoints.web.exposure.include=health,info,metrics,prometheus
management.prometheus.metrics.export.enabled = true
management.endpoint.health.probes.enabled=true
management.metrics.tags.application=${spring.application.name}
spring.application.name=numerotemporal-service-api
spring.sleuth.otel.config.trace-id-ratio-based=0
spring.sleuth.otel.exporter.otlp.endpoint=http://localhost:4317
spring.sleuth.otel.log.exporter.enabled=false
spring.sleuth.async.enabled=false
spring.sleuth.propagation.type=b3
spring.sleuth.baggage.remote-fields=x-consumer-username
event.processing.client.producer.enable=true
event.processing.queue.engine=KAFKA
event.processing.kafka.address=172.28.66.196:9092
event.processing.queue.business=event-tracing
event.processing.queue.message=event-tracing
event.processing.queue.application=event-tracing
event.processing.logger.event.enable=true
## Messaging
app.environment=PROD
modules.messaging.baseurl.isProperty=true
modules.logging.obfuscation.enabled=false
modules.logging.obfuscation.defaultReplaceType=-
modules.logging.obfuscation.replaceType.number=000000
modules.logging.obfuscation.replaceType.string=XXXXXX
modules.logging.obfuscation.configurationList[0]=GET,.*,$[0].name.common,string
#Native options:
spring.native.remove-unused-autoconfig=true
spring.native.remove-yaml-support=true
#VALOR DE OPERACION
service.numerotemporal.operacion=numerotemporal
#VALOR DE SISTEMA
service.numerotemporal.sistema=numerotemporal
service.numerotemporal.metodo=POST
#Messaging configuration for external services
modules.messaging.configuration.adapterDefinitions[0]=AD_COD_0001,com.millicom.microservice.service.service.numero.temporal.ConsultarImplementacion,${service.numerotemporal.operacion},${service.numerotemporal.metodo},,com.millicom.microservice.service.external.services.personalizado.ConsultarResponse,${service.numerotemporal.sistema}
#Adapter endpoints
modules.messaging.configuration.adapterEndpoints[0]=AE_COD_0001,AD_COD_0001,messaging.baseUrl.numerotemporal.orquestador,PROD,,,
#LEGADO
#messaging.baseUrl.numerotemporal.orquestador=http://numerotemporal-orchestrator-api:8080/api/v1/resourceValidation
messaging.baseUrl.numerotemporal.orquestador=http://172.28.66.196:8143/api/v1/resourceValidation
#CABECERAS QUE SE ENVIAN DEL ADAPTADOR AL LEGADO (N cabeceras)
service.numerotemporal.legado.header.content-type=application/json
#PATCH que recibe el adaptador (N var)
#service.numerotemporal.path.vars.content-type=application/json
#BANDERA PARA DEVOLVER CABECERAS DEL LEGADO
service.numerotemporal.devolver.cabeceras.del.legado=false
#PATCH SERVICIO numerotemporal
service.numerotemporal.patch=/api/v1/consultaNumeroTemporalV2
service.numerotemporal.codigos.http.a.controlar=502
response.errors.400=Cannot query field 'lifecycleStatus6' on type 'Products'. Did you mean 'lifecycleStatus', 'lifecycles' or 'lifecyclesList'? (line 6, column 11):\n statusPhone_status: lifecycleStatus6\n ^
response.errors.405=Method Not Allowed
response.errors.500=unknown_error
response.errors.503=server that is down for maintenance or that is overloaded
response.errors.502=No se pudo establecer conexion con el Servidor: ${messaging.baseUrl.numerotemporal.orquestador}
response.errors.415=The request's Content-Type is not supported. Expected:application/json or application/vnd.api+json
response.errors.default=Error Interno del Servicio
logging.level.org.springframework.ws.client.MessageTracing.sent=DEBUG
logging.level.org.springframework.ws.server.MessageTracing.sent=DEBUG
logging.level.org.springframework.ws.client.MessageTracing.received=TRACE
logging.level.org.springframework.ws.server.MessageTracing.received=TRACE

View File

@ -0,0 +1,105 @@
#DB
# spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect
#spring.jpa.show-sql=false
#spring.jpa.hibernate.ddl-auto=none
#spring.database.driverClassName=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/mstemplate
#spring.datasource.username=admin
#spring.datasource.password=admin
# LIQUIBASE settings
#logging.level.liquibase=ERROR
#spring.liquibase.change-log=classpath:/db/master.xml
#APP
server.port=${SERVER_PORT:8142}
#Rit Modules
modules.logging.message.enable-interceptors=${MODULES_LOGGING_MESSAGE_ENABLE_INTERCEPTORS:true}
modules.logging.message.enable=${MODULES_LOGGING_MESSAGE_ENABLE:true}
modules.logging.message.configuration=${MODULES_LOGGING_MESSAGE_CONFIGURATION:CONSOLE,EVENT}
modules.logging.application.enable=${MODULES_LOGGING_APPLICATION_ENABLE:true}
modules.logging.application.level=${MODULES_LOGGING_APPLICATION_LEVEL:DEBUG}
modules.logging.application.configuration=${MODULES_LOGGING_APPLICATION_CONFIGURATION:{'*':'CONSOLE,EVENT'}}
modules.common.vtconfig.enable=${MODULES_COMMON_VTCONFIG_ENABLE:true}
modules.common.vtconfig.use-cache=${MODULES_COMMON_VTCONFIG_USE_CACHE:true}
modules.common.i18n.errorMessage.enable=${MODULES_COMMON_I18N_ERRORMESSAGE_ENABLE:true}
modules.common.i18n.errorMessage.default.lang=${MODULES_COMMON_I18N_ERRORMESSAGE_DEFAULT_LANG:en-US}
modules.common.i18n.locale=${MODULES_COMMON_I18N_LOCALE:en-US,es-ES}
modules.common.i18n.default-lang=${MODULES_COMMON_I18N_DEFAULT_LANG:en-US}
#Management and Metrics
management.endpoints.web.exposure.include=${MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE:health,info,metrics,prometheus}
management.prometheus.metrics.export.enabled=${MANAGEMENT_PROMETHEUS_METRICS_EXPORT_ENABLED:true}
management.endpoint.health.probes.enabled=${MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED:true}
management.metrics.tags.application=${spring.application.name}
spring.application.name=${SPRING_APPLICATION_NAME:numerotemporal-service-api}
spring.sleuth.otel.config.trace-id-ratio-based=${SPRING_SLEUTH_OTEL_CONFIG_TRACE_ID_RATIO_BASED:0}
spring.sleuth.otel.exporter.otlp.endpoint=${SPRING_SLEUTH_OTEL_EXPORTER_OTLP_ENDPOINT:http://localhost:4317}
spring.sleuth.otel.log.exporter.enabled=${SPRING_SLEUTH_OTEL_LOG_EXPORTER_ENABLED:false}
spring.sleuth.async.enabled=${SPRING_SLEUTH_ASYNC_ENABLED:false}
spring.sleuth.propagation.type=${SPRING_SLEUTH_PROPAGATION_TYPE:b3}
spring.sleuth.baggage.remote-fields=${SPRING_SLEUTH_BAGGAGE_REMOTE_FIELDS:x-consumer-username}
event.processing.client.producer.enable=${EVENT_PROCESSING_CLIENT_PRODUCER_ENABLE:true}
event.processing.queue.engine=${EVENT_PROCESSING_QUEUE_ENGINE:KAFKA}
event.processing.kafka.address=${EVENT_PROCESSING_KAFKA_ADDRESS:172.28.66.196:9092}
event.processing.queue.business=${EVENT_PROCESSING_QUEUE_BUSINESS:event-tracing}
event.processing.queue.message=${EVENT_PROCESSING_QUEUE_MESSAGE:event-tracing}
event.processing.queue.application=${EVENT_PROCESSING_QUEUE_APPLICATION:event-tracing}
event.processing.logger.event.enable=${EVENT_PROCESSING_LOGGER_EVENT_ENABLE:true}
## Messaging
app.environment=${APP_ENVIRONMENT:PROD}
modules.messaging.baseurl.isProperty=${MODULES_MESSAGING_BASEURL_ISPROPERTY:true}
modules.logging.obfuscation.enabled=${MODULES_LOGGING_OBFUSCATION_ENABLED:false}
modules.logging.obfuscation.defaultReplaceType=${MODULES_LOGGING_OBFUSCATION_DEFAULTREPLACETYPE:-}
modules.logging.obfuscation.replaceType.number=${MODULES_LOGGING_OBFUSCATION_REPLACETYPE_NUMBER:000000}
modules.logging.obfuscation.replaceType.string=${MODULES_LOGGING_OBFUSCATION_REPLACETYPE_STRING:XXXXXX}
modules.logging.obfuscation.configurationList[0]=${MODULES_LOGGING_OBFUSCATION_CONFIGURATIONLIST[0]:GET,.*,$[0].name.common,string}
#Native options:
spring.native.remove-unused-autoconfig=${SPRING_NATIVE_REMOVE_UNUSED_AUTOCONFIG:true}
spring.native.remove-yaml-support=${SPRING_NATIVE_REMOVE_YAML_SUPPORT:true}
#VALOR DE OPERACION
service.numerotemporal.operacion=${SERVICE_NUMEROTEMPORAL_OPERACION:numerotemporal}
#VALOR DE SISTEMA
service.numerotemporal.sistema=${SERVICE_NUMEROTEMPORAL_SISTEMA:numerotemporal}
service.numerotemporal.metodo=${SERVICE_NUMEROTEMPORAL_METODO:POST}
#Messaging configuration for external services
modules.messaging.configuration.adapterDefinitions[0]=${MODULES_MESSAGING_CONFIGURATION_ADAPTERDEFINITIONS[0]:AD_COD_0001,com.millicom.microservice.service.service.numero.temporal.ConsultarImplementacion,${service.numerotemporal.operacion},${service.numerotemporal.metodo},,com.millicom.microservice.service.external.services.personalizado.ConsultarResponse,${service.numerotemporal.sistema}}
#Adapter endpoints
modules.messaging.configuration.adapterEndpoints[0]=${MODULES_MESSAGING_CONFIGURATION_ADAPTERENDPOINTS[0]:AE_COD_0001,AD_COD_0001,messaging.baseUrl.numerotemporal.orquestador,PROD,,,}
#LEGADO
#messaging.baseUrl.numerotemporal.orquestador=http://numerotemporal-orchestrator-api:8080/api/v1/resourceValidation
messaging.baseUrl.numerotemporal.orquestador=${MESSAGING_BASEURL_NUMEROTEMPORAL_ORQUESTADOR:http://172.28.66.196:8143/api/v1/resourceValidation}
#CABECERAS QUE SE ENVIAN DEL ADAPTADOR AL LEGADO (N cabeceras)
service.numerotemporal.legado.header.content-type=${SERVICE_NUMEROTEMPORAL_LEGADO_HEADER_CONTENT_TYPE:application/json}
#PATCH que recibe el adaptador (N var)
#service.numerotemporal.path.vars.content-type=application/json
#BANDERA PARA DEVOLVER CABECERAS DEL LEGADO
service.numerotemporal.devolver.cabeceras.del.legado=${SERVICE_NUMEROTEMPORAL_DEVOLVER_CABECERAS_DEL_LEGADO:false}
#PATCH SERVICIO numerotemporal
service.numerotemporal.patch=${SERVICE_NUMEROTEMPORAL_PATCH:/api/v1/consultaNumeroTemporalV2}
service.numerotemporal.codigos.http.a.controlar=${SERVICE_NUMEROTEMPORAL_CODIGOS_HTTP_A_CONTROLAR:502}
response.errors.400=${RESPONSE_ERRORS_400:Cannot query field 'lifecycleStatus6' on type 'Products'. Did you mean 'lifecycleStatus', 'lifecycles' or 'lifecyclesList'? (line 6, column 11):\n statusPhone_status: lifecycleStatus6\n ^}
response.errors.405=${RESPONSE_ERRORS_405:Method Not Allowed}
response.errors.500=${RESPONSE_ERRORS_500:unknown_error}
response.errors.503=${RESPONSE_ERRORS_503:server that is down for maintenance or that is overloaded}
response.errors.502=${RESPONSE_ERRORS_502:No se pudo establecer conexion con el Servidor: ${messaging.baseUrl.numerotemporal.orquestador}}
response.errors.415=${RESPONSE_ERRORS_415:The request's Content-Type is not supported. Expected:application/json or application/vnd.api+json}
response.errors.default=${RESPONSE_ERRORS_DEFAULT:Error Interno del Servicio}
#logging.level.org.springframework.ws.client.MessageTracing.sent=${LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WS_CLIENT_MESSAGETRACING_SENT:DEBUG}
#logging.level.org.springframework.ws.server.MessageTracing.sent=${LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WS_SERVER_MESSAGETRACING_SENT:DEBUG}
#logging.level.org.springframework.ws.client.MessageTracing.received=${LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WS_CLIENT_MESSAGETRACING_RECEIVED:TRACE}
#logging.level.org.springframework.ws.server.MessageTracing.received=${LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_WS_SERVER_MESSAGETRACING_RECEIVED:TRACE}

View File

@ -0,0 +1,9 @@
,--. ,--. ,--. ,--.
,--,--, ,--.,--.,--,--,--.,---. ,--.--. ,---. ,-' '-. ,---. ,--,--,--. ,---. ,---. ,--.--.,--,--.| |,-----. ,---. ,---. ,--.--.,--. ,--.`--' ,---. ,---. ,-----.,--,--. ,---. `--'
| \| || || | .-. :| .--'| .-. |'-. .-'| .-. :| || .-. | .-. || .--' ,-. || |'-----'( .-'| .-. :| .--' \ `' / ,--.| .--'| .-. :'-----' ,-. || .-. |,--.
| || |' '' '| | | \ --.| | ' '-' ' | | \ --.| | | || '-' ' '-' '| | \ '-' || | .-' `) --.| | \ / | |\ `--.\ --. \ '-' || '-' '| |
`--''--' `----' `--`--`--'`----'`--' `---' `--' `----'`--`--`--'| |-' `---' `--' `--`--'`--' `----' `----'`--' `--' `--' `---' `----' `--`--'| |-' `--'
`--' `--'
${application.title} ${application.version}
:: Spring Boot${spring-boot.formatted-version} :: ${Ansi.DEFAULT}

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20220817180800-02" author="DanielMatos" runOnChange="true">
<createView viewName="pipeline_view" replaceIfExists="true">
SELECT tmp.PIPELINE_ID,
tmp.execution_code,
tmp.execution_index,
tmp.execution_condition,
act_def.fqn AS pre_run_fqn,
act_def2.fqn AS exec_fqn,
act_def3.fqn AS post_run_fqn
FROM
(SELECT pipe_exec.execution_code,
pipe_exec.execution_index,
pipe_exec.execution_condition,
pipe_def.PIPELINE_ID,
pipe_def.PRE_RUN_ACTION_ID,
pipe_def.EXECUTION_ACTION_ID,
pipe_def.POST_RUN_ACTION_ID
FROM oc_execution_pipeline pipe_exec,
oc_pipeline_definition pipe_def
WHERE 1 = 1
AND pipe_exec.pipeline_id = pipe_def.pipeline_id
ORDER BY pipe_exec.execution_code,
pipe_exec.execution_index
) tmp
LEFT OUTER JOIN OC_ACTION_DEFINITION act_def
ON tmp.PRE_RUN_ACTION_ID = act_def.ACTION_ID
LEFT OUTER JOIN OC_ACTION_DEFINITION act_def2
ON tmp.EXECUTION_ACTION_ID = act_def2.ACTION_ID
LEFT OUTER JOIN OC_ACTION_DEFINITION act_def3
ON tmp.POST_RUN_ACTION_ID = act_def3.ACTION_ID
order by tmp.execution_code, tmp.execution_index;
</createView>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20222208174600-01" author="PedroSilva" runOnChange="true">
<delete tableName="oc_action_definition"/>
<loadData tableName="oc_action_definition"
file="db/data/OC_ACTION_DEFINITION.csv" separator=";">
<column name="action_id" type="STRING"/>
<column name="fqn" type="STRING"/>
</loadData>
</changeSet>
<changeSet id="20222208174600-02" author="PedroSilva" runOnChange="true">
<delete tableName="OC_EXECUTION_PIPELINE"/>
<loadData tableName="OC_EXECUTION_PIPELINE"
file="db/data/OC_EXECUTION_PIPELINE.csv" separator=";">
<column name="execution_id" type="STRING"/>
<column name="execution_code" type="STRING"/>
<column name="execution_condition" type="STRING"/>
<column name="execution_index" type="NUMERIC"/>
<column name="pipeline_id" type="STRING"/>
<column name="status" type="BOOLEAN"/>
</loadData>
</changeSet>
<changeSet id="20222208174600-03" author="PedroSilva" runOnChange="true">
<delete tableName="OC_PIPELINE_DEFINITION"/>
<loadData tableName="OC_PIPELINE_DEFINITION"
file="db/data/OC_PIPELINE_DEFINITION.csv" separator=";">
<column name="pipeline_id" type="STRING"/>
<column name="execution_action_id" type="STRING"/>
<column name="pipeline_name" type="STRING"/>
<column name="post_run_action_id" type="STRING"/>
<column name="pre_run_action_id" type="STRING"/>
<column name="status" type="BOOLEAN"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20220825154700-01" author="PedroSilva" runOnChange="true">
<delete tableName="OC_ADAPTER_DEFINITION"/>
<loadData tableName="OC_ADAPTER_DEFINITION"
file="db/data/OC_ADAPTER_DEFINITION.csv" separator=";">
<column name="adapter_id" type="STRING"/>
<column name="interface_name" type="STRING"/>
<column name="interface_operation" type="STRING"/>
<column name="interface_protocol" type="STRING"/>
<column name="request_fqn" type="STRING"/>
<column name="response_fqn" type="STRING"/>
<column name="system" type="STRING"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20220825155100-01" author="PedroSilva" runOnChange="true">
<delete tableName="oc_adapter_endpoint"/>
<loadData tableName="oc_adapter_endpoint"
file="db/data/OC_ADAPTER_ENDPOINT.csv" separator=";">
<column name="endpoint_id" type="STRING"/>
<column name="adapter_id" type="STRING"/>
<column name="base_url" type="STRING"/>
<column name="environment" type="STRING"/>
<column name="operation" type="STRING"/>
<column name="user_name" type="STRING"/>
<column name="user_password" type="STRING"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20220826171400-01" author="PedroSilva" runOnChange="true">
<delete tableName="error_message"/>
<loadData tableName="error_message"
file="db/data/ERROR_MESSAGE.csv" separator=";">
<column name="id" type="NUMERIC"/>
<column name="country_code" type="STRING"/>
<column name="error_code" type="STRING"/>
<column name="message" type="STRING"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<changeSet id="20220817160909-01" author="DanielMatos" runOnChange="true">
<delete tableName="VT_CONFIG">
<where>ENTITY_TYPE = 'dba_errorcode_table'</where>
</delete>
<loadData tableName="VT_CONFIG"
file="db/data/VT_CONFIG_DBA_ERRORCODE_TABLE.csv" separator=";">
<column name="id" type="STRING"/>
<column name="entity_type" type="STRING"/>
<column name="entity_key" type="STRING"/>
<column name="entity_key_value" type="STRING"/>
<column name="cached" type="BOOLEAN"/>
<column name="payload" type="STRING"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,163 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd">
<changeSet author="DanielMatos (generated)" id="1660214053729-1">
<createTable tableName="application_log">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="application_logPK"/>
</column>
<column name="external_id" type="VARCHAR(255)"/>
<column name="internal_id" type="VARCHAR(255)"/>
<column name="transaction_id" type="VARCHAR(255)"/>
<column name="user_id" type="VARCHAR(255)"/>
<column name="description" type="VARCHAR(255)"/>
<column name="execution_duration" type="BIGINT"/>
<column name="log_information" type="TEXT"/>
<column name="log_level" type="VARCHAR(255)"/>
<column name="log_time" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="module" type="VARCHAR(255)"/>
<column name="type" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-2">
<createTable tableName="common_sync_control">
<column name="key_type" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="common_sync_controlPK"/>
</column>
<column name="action_name" type="VARCHAR(255)"/>
<column name="instance_id" type="VARCHAR(255)"/>
<column name="locked_on" type="TIMESTAMP WITHOUT TIME ZONE"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-3">
<createTable tableName="error_message">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="error_messagePK"/>
</column>
<column name="country_code" type="VARCHAR(255)"/>
<column name="error_code" type="VARCHAR(255)"/>
<column name="message" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-4">
<createTable tableName="message_log">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="message_logPK"/>
</column>
<column name="external_id" type="VARCHAR(255)"/>
<column name="internal_id" type="VARCHAR(255)"/>
<column name="transaction_id" type="VARCHAR(255)"/>
<column name="user_id" type="VARCHAR(255)"/>
<column name="created_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="http_method" type="VARCHAR(255)"/>
<column name="operation" type="VARCHAR(512)"/>
<column name="received_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="request" type="TEXT"/>
<column name="request_headers" type="TEXT"/>
<column name="response" type="TEXT"/>
<column name="response_headers" type="TEXT"/>
<column name="response_status" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="sent_date" type="TIMESTAMP WITHOUT TIME ZONE"/>
<column name="type" type="VARCHAR(255)"/>
<column name="url" type="VARCHAR(2048)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-5">
<createTable tableName="oc_action_definition">
<column name="action_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_action_definitionPK"/>
</column>
<column name="fqn" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-6">
<createTable tableName="oc_adapter_definition">
<column name="adapter_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_adapter_definitionPK"/>
</column>
<column name="interface_name" type="VARCHAR(255)"/>
<column name="interface_operation" type="VARCHAR(255)"/>
<column name="interface_protocol" type="VARCHAR(255)"/>
<column name="request_fqn" type="VARCHAR(255)"/>
<column name="response_fqn" type="VARCHAR(255)"/>
<column name="system" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-7">
<createTable tableName="oc_adapter_endpoint">
<column name="endpoint_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_adapter_endpointPK"/>
</column>
<column name="adapter_id" type="VARCHAR(255)"/>
<column name="base_url" type="VARCHAR(255)"/>
<column name="environment" type="VARCHAR(255)"/>
<column name="operation" type="VARCHAR(255)"/>
<column name="use_discovery" type="BOOLEAN"/>
<column name="user_name" type="VARCHAR(255)"/>
<column name="user_password" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-8">
<createTable tableName="oc_execution_pipeline">
<column name="execution_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_execution_pipelinePK"/>
</column>
<column name="execution_code" type="VARCHAR(255)"/>
<column name="execution_condition" type="VARCHAR(255)"/>
<column name="execution_index" type="BIGINT"/>
<column name="pipeline_id" type="VARCHAR(255)"/>
<column name="status" type="BOOLEAN">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-9">
<createTable tableName="oc_pipeline_definition">
<column name="pipeline_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_pipeline_definitionPK"/>
</column>
<column name="execution_action_id" type="VARCHAR(255)"/>
<column name="pipeline_name" type="VARCHAR(255)"/>
<column name="post_run_action_id" type="VARCHAR(255)"/>
<column name="pre_run_action_id" type="VARCHAR(255)"/>
<column name="status" type="BOOLEAN">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-10">
<createTable tableName="oc_services">
<column name="service_id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="oc_servicesPK"/>
</column>
<column name="execution_code" type="VARCHAR(255)"/>
<column name="operation" type="VARCHAR(255)"/>
<column name="service_name" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="DanielMatos (generated)" id="1660214053729-11">
<createTable tableName="vt_config">
<column name="id" type="VARCHAR(255)">
<constraints nullable="false" primaryKey="true" primaryKeyName="vt_configPK"/>
</column>
<column name="cached" type="BOOLEAN">
<constraints nullable="false"/>
</column>
<column name="entity_key" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="entity_key_value" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="entity_type" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
<column name="payload" type="VARCHAR(4096)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,13 @@
ID;COUNTRY_CODE;ERROR_CODE;MESSAGE
1;en-US;MT_ERR_GEN_0000;An Exception has occured.
2;en-US;MT_ERR_GEN_0001;An Exception has occured, detail : (%s).
3;en-US;MT_ERR_GEN_0002;Missing required field: %s.%s
4;en-US;MT_ERR_GEN_0003;Missing required field: %s.%s, this field must have one of these values %s
5;en-US;MT_ERR_GEN_0004;The requested path: (%s) does not exist.
6;es-ES;MT_ERR_GEN_0000;Hubo una excepción.
7;es-ES;MT_ERR_GEN_0001;Hubo una excepción, detalles : (%s).
8;es-ES;MT_ERR_GEN_0002;Falta el campo obligatorio: %s.%s
9;es-ES;MT_ERR_GEN_0003;Falta el campo obligatorio: %s.%s, este campo debe tener uno de estos valores %s
10;es-ES;MT_ERR_GEN_0004;La ruta de solicitud: (%s) no existe.
1 ID COUNTRY_CODE ERROR_CODE MESSAGE
2 1 en-US MT_ERR_GEN_0000 An Exception has occured.
3 2 en-US MT_ERR_GEN_0001 An Exception has occured, detail : (%s).
4 3 en-US MT_ERR_GEN_0002 Missing required field: %s.%s
5 4 en-US MT_ERR_GEN_0003 Missing required field: %s.%s, this field must have one of these values %s
6 5 en-US MT_ERR_GEN_0004 The requested path: (%s) does not exist.
7 6 es-ES MT_ERR_GEN_0000 Hubo una excepción.
8 7 es-ES MT_ERR_GEN_0001 Hubo una excepción, detalles : (%s).
9 8 es-ES MT_ERR_GEN_0002 Falta el campo obligatorio: %s.%s
10 9 es-ES MT_ERR_GEN_0003 Falta el campo obligatorio: %s.%s, este campo debe tener uno de estos valores %s
11 10 es-ES MT_ERR_GEN_0004 La ruta de solicitud: (%s) no existe.

View File

@ -0,0 +1 @@
ACTION_ID;FQN
1 ACTION_ID FQN

View File

@ -0,0 +1 @@
ADAPTER_ID;INTERFACE_NAME;INTERFACE_OPERATION;INTERFACE_PROTOCOL;REQUEST_FQN;RESPONSE_FQN;SYSTEM
1 ADAPTER_ID INTERFACE_NAME INTERFACE_OPERATION INTERFACE_PROTOCOL REQUEST_FQN RESPONSE_FQN SYSTEM

View File

@ -0,0 +1 @@
ENDPOINT_ID;ADAPTER_ID;BASE_URL;ENVIRONMENT;OPERATION;USER_NAME;USER_PASSWORD
1 ENDPOINT_ID ADAPTER_ID BASE_URL ENVIRONMENT OPERATION USER_NAME USER_PASSWORD

View File

@ -0,0 +1 @@
EXECUTION_ID;EXECUTION_CODE;EXECUTION_CONDITION;EXECUTION_INDEX;PIPELINE_ID;STATUS
1 EXECUTION_ID EXECUTION_CODE EXECUTION_CONDITION EXECUTION_INDEX PIPELINE_ID STATUS

View File

@ -0,0 +1 @@
PIPELINE_ID;EXECUTION_ACTION_ID;PIPELINE_NAME;POST_RUN_ACTION_ID;PRE_RUN_ACTION_ID;STATUS
1 PIPELINE_ID EXECUTION_ACTION_ID PIPELINE_NAME POST_RUN_ACTION_ID PRE_RUN_ACTION_ID STATUS

View File

@ -0,0 +1 @@
ID;CACHED;ENTITY_KEY;ENTITY_KEY_VALUE;ENTITY_TYPE;PAYLOAD
1 ID CACHED ENTITY_KEY ENTITY_KEY_VALUE ENTITY_TYPE PAYLOAD

View File

@ -0,0 +1,15 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd">
<!-- update structure -->
<include file="db/changelog/structure/20220811103406_entity_update.xml" relativeToChangelogFile="false" />
<include file="db/changelog/data/20220817180800_pipeline_view.xml" relativeToChangelogFile="false" />
<!-- update data -->
<include file="db/changelog/data/20221128165609_vt_config_dba_errorcode_table.xml" relativeToChangelogFile="false" />
<include file="db/changelog/data/20220822174600_pipeline_configuration.xml" relativeToChangelogFile="false" />
<include file="db/changelog/data/20220825154700_oc_adapter_definition.xml" relativeToChangelogFile="false" />
<include file="db/changelog/data/20220825155100_oc_adapter_endpoint.xml" relativeToChangelogFile="false" />
<include file="db/changelog/data/20220826171400_error_message.xml" relativeToChangelogFile="false" />
</databaseChangeLog>

View File

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.--><xs:schema version="1.0" targetNamespace="http://services.tigo.com.bo/" xmlns:tns="http://services.tigo.com.bo/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Consultar" type="tns:Consultar"/>
<xs:element name="ConsultarResponse" type="tns:ConsultarResponse"/>
<xs:element name="ParameterType">
<xs:complexType>
<xs:sequence>
<xs:element name="parameterName" type="xs:string"/>
<xs:element name="parameterValue" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Consultar">
<xs:sequence>
<xs:element name="consultaRequest" type="tns:ConsultaRequest" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultaRequest">
<xs:sequence>
<xs:element name="bodyRequest" type="tns:RequestBody"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RequestBody">
<xs:sequence>
<xs:element name="msisdnList" type="tns:MsisdnListType"/>
<xs:element name="additionalParameters" type="tns:AdditionalParameters" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MsisdnListType">
<xs:sequence>
<xs:element name="numbers" type="tns:Numbers" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Numbers">
<xs:sequence>
<xs:element name="temporaryNumber" type="xs:string" minOccurs="0"/>
<xs:element name="portNumber" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AdditionalParameters">
<xs:sequence>
<xs:element name="parametersList" type="tns:Parameters" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Parameters">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0"/>
<xs:element name="value" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultarResponse">
<xs:sequence>
<xs:element name="return" type="tns:ConsultaResponse" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultaResponse">
<xs:sequence>
<xs:element name="headerResponse" type="tns:ResponseHeader"/>
<xs:element name="bodyResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="msisdnList" type="tns:MsisdnInformationType" minOccurs="0"/>
<xs:element name="transactionStatus " type="xs:string"/>
<xs:element name="additionalResults" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element ref="tns:ParameterType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ResponseHeader">
<xs:sequence>
<xs:element name="code" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MsisdnInformationType">
<xs:sequence>
<xs:element name="msisdnInfo" type="tns:ResponseBody" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ResponseBody">
<xs:sequence>
<xs:element name="code" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="temporaryNumber" type="xs:string" minOccurs="0"/>
<xs:element name="portInNumber" type="xs:string" minOccurs="0"/>
<xs:element name="iccid" type="xs:string" minOccurs="0"/>
<xs:element name="dateAssociation" type="xs:dateTime" minOccurs="0"/>
<xs:element name="dateEnabling" type="xs:dateTime" minOccurs="0"/>
<xs:element name="state" type="xs:string" minOccurs="0"/>
<xs:element name="modality" type="xs:string" minOccurs="0"/>
<xs:element name="commercialPlan" type="xs:string" minOccurs="0"/>
<xs:element name="idPlan" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.--><!--Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.--><definitions targetNamespace="http://services.tigo.com.bo/" name="ConsultarNumeroTemporal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://services.tigo.com.bo/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:import namespace="http://services.tigo.com.bo/" schemaLocation="ConsultarNumeroTemporal.xsd"/>
</xsd:schema>
</types>
<message name="Consultar">
<part name="parameters" element="tns:Consultar"/>
</message>
<message name="ConsultarResponse">
<part name="parameters" element="tns:ConsultarResponse"/>
</message>
<portType name="ConsultarNumeroTemporal">
<operation name="Consultar">
<input message="tns:Consultar"/>
<output message="tns:ConsultarResponse"/>
</operation>
</portType>
<binding name="ConsultarNumeroTemporalPortBinding" type="tns:ConsultarNumeroTemporal">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="Consultar">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ConsultarNumeroTemporal">
<port name="ConsultarNumeroTemporalPort" binding="tns:ConsultarNumeroTemporalPortBinding">
<soap:address location="http://172.28.7.198:7005/ConsultarNumeroTemporal/ConsultarNumeroTemporal"/>
</port>
</service>
</definitions>

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://services.tigo.com.bo/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
name="ConsultarNumeroTemporal"
targetNamespace="http://services.tigo.com.bo/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://services.tigo.com.bo/"
targetNamespace="http://services.tigo.com.bo/"
version="1.0">
<xs:element name="Consultar"
type="tns:Consultar"/>
<xs:element name="ConsultarResponse"
type="tns:ConsultarResponse"/>
<xs:element name="ParameterType">
<xs:complexType>
<xs:sequence>
<xs:element name="parameterName"
type="xs:string"/>
<xs:element name="parameterValue"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Consultar">
<xs:sequence>
<xs:element minOccurs="0"
name="consultaRequest"
type="tns:ConsultaRequest"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultaRequest">
<xs:sequence>
<xs:element name="bodyRequest"
type="tns:RequestBody"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="RequestBody">
<xs:sequence>
<xs:element name="msisdnList"
type="tns:MsisdnListType"/>
<xs:element minOccurs="0"
name="additionalParameters"
type="tns:AdditionalParameters"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MsisdnListType">
<xs:sequence>
<xs:element maxOccurs="unbounded"
name="numbers"
type="tns:Numbers"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Numbers">
<xs:sequence>
<xs:element minOccurs="0"
name="temporaryNumber"
type="xs:string"/>
<xs:element minOccurs="0"
name="portNumber"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AdditionalParameters">
<xs:sequence>
<xs:element maxOccurs="unbounded"
name="parametersList"
type="tns:Parameters"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Parameters">
<xs:sequence>
<xs:element minOccurs="0"
name="name"
type="xs:string"/>
<xs:element minOccurs="0"
name="value"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultarResponse">
<xs:sequence>
<xs:element minOccurs="0"
name="return"
type="tns:ConsultaResponse"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ConsultaResponse">
<xs:sequence>
<xs:element name="headerResponse"
type="tns:ResponseHeader"/>
<xs:element name="bodyResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0"
name="msisdnList"
type="tns:MsisdnInformationType"/>
<xs:element name="transactionStatus"
type="xs:string"/>
<xs:element minOccurs="0"
name="additionalResults">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded"
name="ParameterType">
<xs:complexType>
<xs:sequence>
<xs:element name="parameterName"
type="xs:string"/>
<xs:element name="parameterValue"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ResponseHeader">
<xs:sequence>
<xs:element name="code"
type="xs:string"/>
<xs:element name="description"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MsisdnInformationType">
<xs:sequence>
<xs:element maxOccurs="unbounded"
name="msisdnInfo"
type="tns:ResponseBody"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ResponseBody">
<xs:sequence>
<xs:element name="code"
type="xs:string"/>
<xs:element name="description"
type="xs:string"/>
<xs:element minOccurs="0"
name="temporaryNumber"
type="xs:string"/>
<xs:element minOccurs="0"
name="portInNumber"
type="xs:string"/>
<xs:element minOccurs="0"
name="iccid"
type="xs:string"/>
<xs:element minOccurs="0"
name="dateAssociation"
type="xs:dateTime"/>
<xs:element minOccurs="0"
name="dateEnabling"
type="xs:dateTime"/>
<xs:element minOccurs="0"
name="state"
type="xs:string"/>
<xs:element minOccurs="0"
name="modality"
type="xs:string"/>
<xs:element minOccurs="0"
name="commercialPlan"
type="xs:string"/>
<xs:element minOccurs="0"
name="idPlan"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="ConsultarResponse">
<wsdl:part element="tns:ConsultarResponse"
name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:message name="Consultar">
<wsdl:part element="tns:Consultar"
name="parameters"> </wsdl:part>
</wsdl:message>
<wsdl:portType name="ConsultarNumeroTemporal">
<wsdl:operation name="Consultar">
<wsdl:input message="tns:Consultar"
name="Consultar"> </wsdl:input>
<wsdl:output message="tns:ConsultarResponse"
name="ConsultarResponse"> </wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ConsultarNumeroTemporalPortBinding"
type="tns:ConsultarNumeroTemporal">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Consultar">
<soap:operation soapAction=""
style="document"/>
<wsdl:input name="Consultar">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="ConsultarResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConsultarNumeroTemporal">
<wsdl:port binding="tns:ConsultarNumeroTemporalPortBinding"
name="ConsultarNumeroTemporalPort">
<soap:address location="LOCALHOST"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,12 @@
package com.millicom.microservice.service;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MsTemplateTestApplication {
@Test
void contextLoads() {
}
}

View File

@ -0,0 +1,62 @@
package com.millicom.microservice.service.helper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.github.tomakehurst.wiremock.WireMockServer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StreamUtils;
import org.springframework.web.util.UriComponentsBuilder;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Map;
public class BaseTestAPI {
@Value("${configs.MOCK_PORT}")
public int DEFAULT_PORT;
protected WireMockServer externalSystemsMock;
@Autowired
protected ObjectMapper objectMapper;
public ObjectMapper getObjectMapper() {
return objectMapper;
}
@BeforeEach
protected void preSetup() throws Exception {
//Initialize Mock
if (externalSystemsMock == null) {
externalSystemsMock = new WireMockServer(DEFAULT_PORT);
}
externalSystemsMock.start();
JavaTimeModule module = new JavaTimeModule();
objectMapper.registerModule(module);
}
@AfterEach
protected void afterTest() {
externalSystemsMock.stop();
}
public String resourceToString(org.springframework.core.io.Resource resource) throws IOException {
return StreamUtils.copyToString(resource.getInputStream(), StandardCharsets.UTF_8);
}
public String replaceDynamicParams(String endpoint, Map<String, String> dynamicParams) {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString("");
builder.path(endpoint);
if (dynamicParams != null && dynamicParams.size() > 0) {
endpoint = builder.build(false).expand(dynamicParams).toUriString();
}
return endpoint;
}
}

View File

@ -0,0 +1,58 @@
package com.millicom.microservice.service.mock;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.MappingBuilder;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.matching.StringValuePattern;
import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.*;
public class ExternalSystemsMock {
public static WireMockServer openPort(WireMockServer server) throws InterruptedException {
return server;
}
public static WireMockServer closePort(WireMockServer server) {
server.stop();
return server;
}
public static void externalSystemsResponse(WireMockServer mockServer, String protocol, String operation, String endpoint, String response, int httpStatus, Map<String,
StringValuePattern> params) {
String header = protocol == "SOAP" ? "text/xml" : "application/json";
MappingBuilder mappingBuilder = switch (operation) {
case "POST" -> post(urlPathMatching(endpoint));
case "GET" -> get(urlPathMatching(endpoint));
case "PATCH" -> patch(urlPathMatching(endpoint));
case "PUT" -> put(urlPathMatching(endpoint));
case "DELETE" -> delete(urlPathMatching(endpoint));
default -> get(urlPathMatching(endpoint));
};
if (params != null) mappingBuilder.withQueryParams(params);
if(endpoint.endsWith("/slowresponse"))
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ResponseDefinitionBuilder responseDefinitionBuilder = aResponse()
.withStatus(httpStatus)
.withHeader("Content-Type", header);
if (response != null) responseDefinitionBuilder.withBody(response);
mappingBuilder
.willReturn(responseDefinitionBuilder);
mockServer.stubFor(mappingBuilder);
}
}

View File

@ -0,0 +1,181 @@
package com.millicom.microservice.service.mock;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.millicom.microservice.service.service.common.GenerateErrorServiceImp;
import com.millicom.microservice.service.service.messaging.ErrorMapper;
import com.readinessit.library.logging.application.services.LoggerService;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureMockMvc
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class MsTemplateResourceTest extends com.millicom.microservice.service.helper.BaseTestAPI {
@Autowired
LoggerService loggerService;
@Autowired
private ObjectMapper objectMapper;
@Autowired
private MockMvc mockMvc;
@Autowired
private ErrorMapper errorMapper;
@Autowired
private GenerateErrorServiceImp generateErrorServiceImp;
@Value("classpath:mockresponses/errorResponse.json")
private org.springframework.core.io.Resource errorResponse;
@Value("classpath:mockresponses/successResponse.json")
private org.springframework.core.io.Resource successResponse;
@Value("classpath:mockresponses/requestOk.json")
private org.springframework.core.io.Resource requestOk;
@Value("classpath:mockresponses/requestFail.json")
private org.springframework.core.io.Resource requestFail;
@Value("${service.createorder.patch}")
private String patchService;
/*
@Test
@Order(1)
void testSucessfull() throws Exception {
ExternalSystemsMock.externalSystemsResponse(externalSystemsMock, "REST", "POST", "/api/v1/createOrder",
resourceToString(successResponse), 200, isNull());
MvcResult requestResult = mockMvc.perform(post(patchService).content(resourceToString(requestOk)).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().is2xxSuccessful()).andReturn();
assertEquals(200, requestResult.getResponse().getStatus());
}
@Test
@Order(2)
void testbadRequest() throws Exception {
MvcResult requestResult = mockMvc.perform(post(patchService).content(anyString()).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isBadRequest()).andReturn();
assertEquals(400, requestResult.getResponse().getStatus());
}
@Test
@Order(3)
void testUnsuported() throws Exception {
MvcResult requestResult = mockMvc.perform(post(patchService).content(anyString()).contentType(MediaType.APPLICATION_XML)
.accept(MediaType.APPLICATION_XML_VALUE))
.andExpect(status().isUnsupportedMediaType()).andReturn();
assertEquals(415, requestResult.getResponse().getStatus());
}
@Test
@Order(4)
void testValidacionFallida() throws Exception {
MvcResult requestResult = mockMvc.perform(post(patchService).content(resourceToString(requestFail)).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isBadRequest()).andReturn();
assertEquals(400, requestResult.getResponse().getStatus());
}
@Test
@Order(5)
void testUnathorized() throws Exception {
Thread.sleep(2000);
ExternalSystemsMock.externalSystemsResponse(externalSystemsMock, "REST", "POST", "/api/v1/createOrder",
anyString(), 401, isNull());
MvcResult requestResult = mockMvc.perform(post(patchService).content(resourceToString(requestOk)).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isUnauthorized()).andReturn();
assertEquals(401, requestResult.getResponse().getStatus());
}
@Test
@Order(6)
void testFailServer() throws Exception {
Thread.sleep(2000);
ExternalSystemsMock.externalSystemsResponse(externalSystemsMock, "REST", "POST", "/api/v1/createOrder",
resourceToString(errorResponse), 400, isNull());
MvcResult requestResult = mockMvc.perform(post(patchService).content(resourceToString(requestOk)).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isBadRequest()).andReturn();
assertEquals(400, requestResult.getResponse().getStatus());
ErrorResponse response = objectMapper.readValue(requestResult.getResponse().getContentAsString(), ErrorResponse.class);
}
@Test
@Order(7)
void validateErrorMapper(){
ErrorStructure errorStructure=errorMapper.validate(null);
assertEquals(errorStructure.getHttpStatus(), HttpStatus.BAD_GATEWAY);
MessageResponse response= new MessageResponse();
response.setResponse(new ObjetoNoSerializable());
String json= errorMapper.obtenerJsonDeMessageResponse(response);
assertNull(json);
}
@Test
@Order(8)
void validateGenerateErrorServiceImp () throws IOException {
ErrorStructure errorStructure=generateErrorServiceImp.generarErrorNuevo(HttpStatus.CHECKPOINT,null);
assertEquals(errorStructure.getHttpStatus(), HttpStatus.INTERNAL_SERVER_ERROR);
assertEquals(errorStructure.getErrors().getFirst().getMessage(),"Error Interno del Adaptador");
ErrorResponse errorResponse1= generateErrorServiceImp.obtenerResponse("200","");
assertNull(errorResponse1.getErrors());
//List<Error> listFull= generateErrorServiceImp.obtenerResponse("200",resourceToString(errorResponse));
// assertEquals(listFull.getFirst().getMessage(),"");
PortabilidadAplicacion.main(new String[]{});
// Verificar si el servicio de registro se utiliza correctamente
//verify(loggerService);
}
@Test
@Order(1)
void testFailConexion() throws Exception {
ExternalSystemsMock.externalSystemsResponse(externalSystemsMock, "REST", "POST", "/api/v1/createOrder",
resourceToString(successResponse), 502, isNull());
MvcResult requestResult = mockMvc.perform(post(patchService).content(resourceToString(requestOk)).contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().is5xxServerError()).andReturn();
assertEquals(502, requestResult.getResponse().getStatus());
}
*/
}

View File

@ -0,0 +1,4 @@
package com.millicom.microservice.service.mock;
public class ObjetoNoSerializable {
}

View File

@ -0,0 +1,178 @@
#Rit Modules
#APP
server.port=9081
modules.logging.message.enable-interceptors=true
modules.logging.message.enable=true
modules.logging.message.configuration=CONSOLE,EVENT
modules.logging.application.enable=true
modules.logging.application.level=DEBUG
modules.logging.application.configuration={'*':'CONSOLE,EVENT'}
modules.common.vtconfig.enable=true
modules.common.vtconfig.use-cache=true
modules.common.i18n.errorMessage.enable=true
modules.common.i18n.errorMessage.default.lang=en-US
modules.common.i18n.locale=en-US,es-ES
modules.common.i18n.default-lang=en-US
#Management and Metrics
#PRUEBAS UNITARIAS
#management.endpoint.health.group.liveness.include= livenessState,livenessProbe
#management.endpoint.health.group.readiness.include= readinessState,readinessProbe
management.endpoints.web.exposure.include=health,info,metrics,prometheus
management.health.livenessState.enabled= true
management.health.readinessState.enabled= true
#management.metrics.export.prometheus.enabled=true
management.metrics.tags.application=${spring.application.name}
spring.application.name=ms-template
spring.sleuth.otel.config.trace-id-ratio-based=0
spring.sleuth.otel.exporter.otlp.endpoint=http://localhost:4317
spring.sleuth.otel.log.exporter.enabled=false
spring.sleuth.async.enabled=false
spring.sleuth.propagation.type=b3
spring.sleuth.baggage.remote-fields=x-consumer-username
event.processing.client.producer.enable=false
event.processing.queue.engine=KAFKA
event.processing.kafka.address=localhost:9092
event.processing.queue.business=event-tracing
event.processing.queue.message=event-tracing
event.processing.queue.application=event-tracing
event.processing.logger.event.enable=true
#Tiempo de keep alive por defecto
rest-client.defaultKeepAliveTime: 60000
#Tiempo que una conexion puede estar idle
rest-client.idleConnectionWaitTime: 30000
#Maximo de conexiones por ruta de conexion
rest-client.maxRouteConnections: 100
#Maximo de conexiones entre todas las rutas
rest-client.maxTotalConnections: 900
#Tiempo de espera mientras se establece la conexion
rest-client.connectionTimeout: 1000
#Tiempo de espera para obtener una conexion del pool
rest-client.requestTimeout: 900
#Tiempo de espera de respuesta (data)
rest-client.socketTimeout: 900
configs.MOCK_PORT=9080
## Messaging
app.environment=PROD
modules.messaging.baseurl.isProperty=true
messaging.baseUrl.getCountryName=http://localhost:${configs.MOCK_PORT}
#VALOR DE OPERACION
service.createorder.operacion=createorder
#VALOR DE SISTEMA
service.createorder.sistema=createorder
service.createorder.metodo=POST
#Messaging configuration for external services
modules.messaging.configuration.adapterDefinitions[0]=AD_COD_0002,com.millicom.microservice.service.adapters.controlador.createorder.CreateOrderRecurso,${service.createorder.operacion},${service.createorder.metodo},,java.util.ArrayList,${service.createorder.sistema}
#Adapter endpoints
modules.messaging.configuration.adapterEndpoints[0]=AE_COD_0002,AD_COD_0002,messaging.baseUrl.createorder.orquestador,PROD,,,
#LEGADO
#messaging.baseUrl.createorder.graphql=https://csr-staging.digitalback.tigo.net.bo:8180/graphql
#MOCKUP
messaging.baseUrl.createorder.orquestador=http://127.0.0.1:${configs.MOCK_PORT}/api/v1/createOrder
modules.logging.obfuscation.enabled=true
modules.logging.obfuscation.defaultReplaceType=-
modules.logging.obfuscation.replaceType.number=000000
modules.logging.obfuscation.replaceType.string=XXXXXX
modules.logging.obfuscation.configurationList[0]=GET,.*,$[0].name.common,string
#Native options:
spring.native.remove-unused-autoconfig=true
spring.native.remove-yaml-support=true
#CABECERAS QUE SE ENVIAN DEL ADAPTADOR AL LEGADO (N cabeceras)
service.createorder.legado.header.content-type=application/json
#PATCH que recibe el adaptador (N var)
#service.createorder.path.vars.content-type=application/json
#BANDERA PARA DEVOLVER CABECERAS DEL LEGADO
service.createorder.devolver.cabeceras.del.legado=false
#PATCH SERVICIO createorder
service.createorder.patch=/api/v1/createorder
service.createorder.ofertas.creacion=PO_Tigo_Pre_Pago_3;PO_NumberPortIn
service.createorder.ofertas.cambio.plan=PO_Change_Plan;PO_Tigo_Prepago_Tarifa_Baja
#VALIDACIONES
service.createorder.expresion.regular.oferta=productOfferingId: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.oferta=PO_\\w+
service.createorder.expresion.regular.customer.account=customerAccountId: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.customer.account=^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
service.createorder.expresion.regular.reference.number=referenceNumber: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.reference.number=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.channel=channel: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.channel=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.sales.person=salespersonId: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.sales.person=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.created=createdAt: \\\\\\s*\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.created=^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$
service.createorder.expresion.regular.icc=CH_ICC\\\\"\\s*,\\\\s*n\\s*value\\s*:\\s*\\\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.icc=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.port.number.resource=CH_PortInNumberResource\\\\"\\s*,\\\\s*n\\s*value\\s*:\\s*\\\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.port.number.resource=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.donor.id=CH_DonorId\\\\"\\s*,\\\\s*n\\s*value\\s*:\\s*\\\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.donor.id=^[a-zA-Z0-9_-]+$
service.createorder.expresion.regular.nuevo.plan=CH_New_Plan_Offer_ID\\\\"\\s*,\\\\s*n\\s*value\\s*:\\s*\\\\"(.*?)\\\\"
service.createorder.expresion.regular.validar.nuevo.plan=^[a-zA-Z0-9_-]+$
service.createorder.codigos.http.a.controlar=502
response.errors.400.errors[0].message=Cannot query field 'lifecycleStatus6' on type 'Products'. Did you mean 'lifecycleStatus', 'lifecycles' or 'lifecyclesList'? (line 6, column 11):\n statusPhone_status: lifecycleStatus6\n ^
response.errors.400.errors[0].locations[0].line=2
response.errors.400.errors[0].locations[0].column=3
response.errors.405.errors[0].message=Method Not Allowed
response.errors.405.errors[0].locations[0].line=2
response.errors.405.errors[0].locations[0].column=3
response.errors.500.errors[0].message=unknown_error
response.errors.500.errors[0].locations[0].line=1
response.errors.500.errors[0].locations[0].column=2
response.errors.503.errors[0].message=server that is down for maintenance or that is overloaded
response.errors.503.errors[0].locations[0].line=1
response.errors.503.errors[0].locations[0].column=2
response.errors.502.errors[0].message=No se pudo establecer conexion con el Servidor: ${messaging.baseUrl.createorder.orquestador}
response.errors.502.errors[0].locations[0].line=1
response.errors.502.errors[0].locations[0].column=2
response.errors.415.errors[0].message=The request's Content-Type is not supported. Expected:application/json or application/vnd.api+json
response.errors.415.errors[0].locations[0].line=1
response.errors.415.errors[0].locations[0].column=2
response.errors.default.errors[0].message=Error Interno del Adaptador
response.errors.default.errors[0].locations[0].line=1
response.errors.default.errors[0].locations[0].column=2

Some files were not shown because too many files have changed in this diff Show More