diff --git a/bff-recruiting-hsa.iml b/bff-recruiting-hsa.iml
new file mode 100644
index 0000000..150cbd7
--- /dev/null
+++ b/bff-recruiting-hsa.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bff-recruiting-hsa/.gitignore b/bff-recruiting-hsa/.gitignore
new file mode 100644
index 0000000..b63da45
--- /dev/null
+++ b/bff-recruiting-hsa/.gitignore
@@ -0,0 +1,42 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/bff-recruiting-hsa/build.gradle b/bff-recruiting-hsa/build.gradle
new file mode 100644
index 0000000..a707830
--- /dev/null
+++ b/bff-recruiting-hsa/build.gradle
@@ -0,0 +1,55 @@
+plugins {
+ id 'java'
+ id 'org.springframework.boot' version '2.7.0'
+ id 'io.spring.dependency-management' version '1.1.4'
+}
+
+java {
+ sourceCompatibility = '11'
+}
+
+group = 'accenture.challenge.recruiting.bff'
+version = '1.0.0-SNAPSHOT'
+
+repositories {
+ mavenCentral()
+}
+
+configurations {
+ compileOnly {
+ extendsFrom annotationProcessor
+ }
+}
+
+ext {
+ set('springCloudVersion', "2021.0.3")
+}
+
+dependencies {
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.boot:spring-boot-starter-aop'
+ implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
+ compileOnly 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+ implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
+ implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
+ implementation group: 'javax.json.bind', name: 'javax.json.bind-api', version: '1.0'
+
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
+}
+
+dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
+ }
+}
+
+test {
+ useJUnitPlatform()
+ exclude '**/Application/.*'
+ exclude '**/domains/**'
+ exclude '**/exceptions/**'
+ exclude '**/controllers/ExceptionHandlerController.*'
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.jar b/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..249e583
Binary files /dev/null and b/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.properties b/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..cb63cb6
--- /dev/null
+++ b/bff-recruiting-hsa/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Dec 14 10:41:27 CLST 2023
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/bff-recruiting-hsa/gradlew b/bff-recruiting-hsa/gradlew
new file mode 100755
index 0000000..1b6c787
--- /dev/null
+++ b/bff-recruiting-hsa/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed 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.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+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
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/bff-recruiting-hsa/gradlew.bat b/bff-recruiting-hsa/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/bff-recruiting-hsa/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem 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, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/bff-recruiting-hsa/settings.gradle b/bff-recruiting-hsa/settings.gradle
new file mode 100644
index 0000000..a74a0f2
--- /dev/null
+++ b/bff-recruiting-hsa/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'bff-recruiting-hsa'
+
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/Application.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/Application.java
new file mode 100644
index 0000000..3ac4d43
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/Application.java
@@ -0,0 +1,17 @@
+package accenture.challenge.recruiting.bff;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@EnableSwagger2
+@EnableFeignClients
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujo.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujo.java
new file mode 100644
index 0000000..3c17dbb
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujo.java
@@ -0,0 +1,11 @@
+package accenture.challenge.recruiting.bff.aspects;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})
+public @interface MarcaFlujo {
+}
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujoAop.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujoAop.java
new file mode 100644
index 0000000..b7d0bb8
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/aspects/MarcaFlujoAop.java
@@ -0,0 +1,20 @@
+package accenture.challenge.recruiting.bff.aspects;
+
+import lombok.extern.log4j.Log4j2;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+@Aspect
+@Log4j2
+@Component
+public class MarcaFlujoAop {
+
+ @After("@annotation(marcaFlujo)")
+ public void imprimirLogEstandar(final JoinPoint joinPoint, MarcaFlujo marcaFlujo) {
+ // hacer log transaccional
+ log.info("Lista categorias top 5 aop ".concat(joinPoint.toString()));
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/clients/CategoryClient.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/clients/CategoryClient.java
new file mode 100644
index 0000000..2d11492
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/clients/CategoryClient.java
@@ -0,0 +1,16 @@
+package accenture.challenge.recruiting.bff.clients;
+
+import accenture.challenge.recruiting.bff.domains.CategoryThree;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(name = "Category-MS-Client",
+ url = "${api.categoria.base}",
+ path = "${api.categoria.path.obtener}")
+public interface CategoryClient {
+
+ @GetMapping
+ CategoryThree getCategoriesOrderReelevanceAndLimit(@RequestParam("cantidad") Integer cantidad);
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/PropertiesConfig.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/PropertiesConfig.java
new file mode 100644
index 0000000..15cedc5
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/PropertiesConfig.java
@@ -0,0 +1,21 @@
+package accenture.challenge.recruiting.bff.configs.properties;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.PropertySources;
+
+@Configuration
+@PropertySources({
+ @PropertySource("classpath:application.properties")
+})
+public class PropertiesConfig {
+
+ @Bean
+ @ConfigurationProperties(prefix = "swagger")
+ public SwaggerProperties swaggerProperties() {
+ return new SwaggerProperties();
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/SwaggerProperties.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/SwaggerProperties.java
new file mode 100644
index 0000000..e001f68
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/properties/SwaggerProperties.java
@@ -0,0 +1,41 @@
+package accenture.challenge.recruiting.bff.configs.properties;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Delegate;
+
+@Getter
+@Setter
+public class SwaggerProperties {
+
+ @Delegate
+ private SwaggerUiEnabled ui;
+
+ @Delegate
+ private SwaggerInfo info;
+
+ @Getter
+ @Setter
+ private static class SwaggerUiEnabled {
+ private boolean enabled;
+ }
+
+ @Getter
+ @Setter
+ private static class SwaggerInfo {
+ private String name;
+ private String description;
+ private String version;
+ private SwaggerInfoContact contact;
+ }
+
+ @Getter
+ @Setter
+ @NoArgsConstructor
+ public static class SwaggerInfoContact {
+ private String name;
+ private String mail;
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/swagger/SpringfoxConfig.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/swagger/SpringfoxConfig.java
new file mode 100644
index 0000000..c11ae2c
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/configs/swagger/SpringfoxConfig.java
@@ -0,0 +1,57 @@
+package accenture.challenge.recruiting.bff.configs.swagger;
+
+import accenture.challenge.recruiting.bff.configs.properties.SwaggerProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+
+import static java.util.List.of;
+import static springfox.documentation.builders.PathSelectors.any;
+import static springfox.documentation.builders.RequestHandlerSelectors.withClassAnnotation;
+
+@Configuration
+public class SpringfoxConfig {
+
+ @Autowired
+ private SwaggerProperties swaggerProperties;
+
+ /**
+ * Basic Swagger configuration
+ *
+ * @return {@link Docket} Swagger configuration
+ */
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(withClassAnnotation(RestController.class))
+ .paths(any())
+ .build()
+ .apiInfo(getApiInfo())
+ .enable(swaggerProperties.isEnabled())
+ .useDefaultResponseMessages(false);
+ }
+
+ /**
+ * Sets the API information for Swagger UI
+ *
+ * @return {@link ApiInfo} API Information
+ */
+ private ApiInfo getApiInfo() {
+ return new ApiInfo(
+ swaggerProperties.getName(),
+ swaggerProperties.getDescription(),
+ swaggerProperties.getVersion(),
+ null,
+ new Contact(swaggerProperties.getContact().getName(), null, swaggerProperties.getContact().getMail()),
+ null,
+ null,
+ of()
+ );
+ }
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/CategoryController.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/CategoryController.java
new file mode 100644
index 0000000..e50742d
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/CategoryController.java
@@ -0,0 +1,41 @@
+package accenture.challenge.recruiting.bff.controllers;
+
+import accenture.challenge.recruiting.bff.aspects.MarcaFlujo;
+import accenture.challenge.recruiting.bff.dtos.CategoryDto;
+import accenture.challenge.recruiting.bff.services.ICategory;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api(value = "BFF punto de acceso para cliente movile")
+@RestController
+@RequestMapping(value = "/categories")
+@RequiredArgsConstructor
+public class CategoryController {
+
+ private final ICategory iCategory;
+
+ @ApiOperation(
+ value = "Obtiene top 5 categorias ordenadas por reelevancia",
+ notes = "Obtiene top 5 categorias ordenadas por reelevancia",
+ produces = "ResponseEntity>")
+ @ApiResponses({
+ @ApiResponse(code = 500, message = "Error General"),
+ @ApiResponse(code = 200, message = "Obtiene resultado")
+ })
+ @MarcaFlujo
+ @GetMapping("/top-5")
+ public ResponseEntity> getCategoriesOrderRelevance() {
+ var categoriesOrderrelevance = iCategory.getCategoriesOrderRelevanceAsc();
+ return ResponseEntity.ok(categoriesOrderrelevance);
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/ExceptionHandlerController.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/ExceptionHandlerController.java
new file mode 100644
index 0000000..a104c51
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/controllers/ExceptionHandlerController.java
@@ -0,0 +1,36 @@
+package accenture.challenge.recruiting.bff.controllers;
+
+import accenture.challenge.recruiting.bff.exceptions.GenericException;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+import java.util.function.BiFunction;
+
+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
+
+@Log4j2
+@ControllerAdvice(basePackages={"accenture.challenge.recruiting.bff.controllers"})
+public class ExceptionHandlerController {
+
+ private static final BiFunction builderError = (title, message) ->
+ new Error(String.format("%s - %s", title, message));
+
+ @ExceptionHandler(Exception.class)
+ ResponseEntity handleException(Exception ex) {
+ log.error(ex.getMessage());
+ return new ResponseEntity<>(
+ builderError.apply("Error Interno", "Ah salido algo mal favor intentar mas tarde"),
+ INTERNAL_SERVER_ERROR);
+ }
+
+ @ExceptionHandler(GenericException.class)
+ ResponseEntity handleGenericException(GenericException ex) {
+ log.error(ex.getMessage());
+ return new ResponseEntity<>(
+ builderError.apply("Error Generico", ex.getMessage()),
+ INTERNAL_SERVER_ERROR);
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryBase.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryBase.java
new file mode 100644
index 0000000..ae0c60e
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryBase.java
@@ -0,0 +1,28 @@
+package accenture.challenge.recruiting.bff.domains;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Setter
+@Getter
+@ToString
+@NoArgsConstructor
+@JsonInclude(NON_NULL)
+public class CategoryBase implements Serializable {
+
+ private String id;
+ private String name;
+ private Integer relevance;
+ private String iconImageUrl;
+ private String largeImageUrl;
+ private String mediumImageUrl;
+ private String smallImageUrl;
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryThree.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryThree.java
new file mode 100644
index 0000000..a3fb3a3
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/domains/CategoryThree.java
@@ -0,0 +1,50 @@
+package accenture.challenge.recruiting.bff.domains;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.List;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Setter
+@Getter
+@ToString
+@NoArgsConstructor
+@JsonInclude(NON_NULL)
+public class CategoryThree extends CategoryBase implements Serializable {
+
+ private List subcategories;
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_1 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_2 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_3 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/dtos/CategoryDto.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/dtos/CategoryDto.java
new file mode 100644
index 0000000..386a823
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/dtos/CategoryDto.java
@@ -0,0 +1,21 @@
+package accenture.challenge.recruiting.bff.dtos;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+@Getter
+@Setter
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
+public class CategoryDto {
+
+ private String id;
+ private String name;
+ private Integer relevance;
+ private String iconImageUrl;
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/exceptions/GenericException.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/exceptions/GenericException.java
new file mode 100644
index 0000000..ebe1fbc
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/exceptions/GenericException.java
@@ -0,0 +1,13 @@
+package accenture.challenge.recruiting.bff.exceptions;
+
+public class GenericException extends RuntimeException {
+
+ public GenericException(String error) {
+ super(error);
+ }
+
+ public GenericException(String error, Throwable ex) {
+ super(error, ex);
+ }
+
+}
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/ICategory.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/ICategory.java
new file mode 100644
index 0000000..edd397a
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/ICategory.java
@@ -0,0 +1,11 @@
+package accenture.challenge.recruiting.bff.services;
+
+import accenture.challenge.recruiting.bff.dtos.CategoryDto;
+
+import java.util.List;
+
+public interface ICategory {
+
+ List getCategoriesOrderRelevanceAsc();
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/impl/SCategory.java b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/impl/SCategory.java
new file mode 100644
index 0000000..ffc498f
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/java/accenture/challenge/recruiting/bff/services/impl/SCategory.java
@@ -0,0 +1,66 @@
+package accenture.challenge.recruiting.bff.services.impl;
+
+import accenture.challenge.recruiting.bff.clients.CategoryClient;
+import accenture.challenge.recruiting.bff.domains.CategoryThree;
+import accenture.challenge.recruiting.bff.dtos.CategoryDto;
+import accenture.challenge.recruiting.bff.exceptions.GenericException;
+import accenture.challenge.recruiting.bff.services.ICategory;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Log4j2
+@Service
+@RequiredArgsConstructor
+public class SCategory implements ICategory {
+
+ private static final Function> buildCategories = categoryThree ->
+ categoryThree.getSubcategories().get(0).getSubcategories().stream()
+ .map(category -> CategoryDto.builder()
+ .id(category.getId())
+ .name(category.getName())
+ .relevance(category.getRelevance())
+ .iconImageUrl(category.getIconImageUrl())
+ .build())
+ .collect(Collectors.toList());
+
+
+ private final CategoryClient categoryClient;
+
+ /**
+ * Obtiene categorias.
+ * @return 'CategoryThree'
+ */
+ private CategoryThree getCategoriesOrderRelevanceTop5() {
+ log.info("INICIO - getCategoriesOrderRelevanceTop5");
+ var categories = categoryClient.getCategoriesOrderReelevanceAndLimit(5);
+ log.info("FIN - getCategoriesOrderRelevanceTop5 () -> " + categories);
+ return categories;
+ }
+
+ /**
+ * - Obtiene categorias
+ * - Ordena de manera natural por reelevancia
+ * - Limita tamaño de arreglo 5
+ *
+ * @return 'CategoryThree con las categorias ordenadas por reelevancia'
+ */
+ @Override
+ public List getCategoriesOrderRelevanceAsc() {
+ log.info("INICIO - getCategoriesOrderRelevanceAsc");
+ try {
+ var categories = getCategoriesOrderRelevanceTop5();
+ var response = buildCategories.apply(categories);
+ log.info("FIN - getCategoriesOrderRelevanceAsc () -> " + response);
+ return response;
+ } catch(Exception ex) {
+ log.error("ERROR - getCategoriesOrderRelevanceAsc () -> " + ex.getMessage());
+ throw new GenericException("Error al obtener categorias", ex);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/main/resources/application.properties b/bff-recruiting-hsa/src/main/resources/application.properties
new file mode 100644
index 0000000..dde0a67
--- /dev/null
+++ b/bff-recruiting-hsa/src/main/resources/application.properties
@@ -0,0 +1,28 @@
+########################################################################
+## This file holds all the properties specific for this application
+########################################################################
+spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
+
+## Swagger configuration
+swagger.ui.enabled=true
+swagger.info.name=BFF Category
+swagger.info.description=API que controla las operaciones sobre categoria
+swagger.info.version=1.0.0-SNAPSHOT
+swagger.info.contact.name=Iván Sandoval
+swagger.info.contact.mail=imsq.93@gmail.com
+
+# Empty para desactivar boton try it out
+springdoc.swagger-ui.enabled=true
+springdoc.swagger-ui.supported-submit-methods=false
+
+## Feign configuration
+feign.client.config.default.connectTimeout=10000
+feign.client.config.default.readTimeout=10000
+feign.client.config.default.loggerLevel=basic
+
+## Server configuration
+server.port=8081
+
+## Rest
+api.categoria.base=http://localhost:8080
+api.categoria.path.obtener=/challenge/categories
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/controllers/CategoryControllerTest.java b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/controllers/CategoryControllerTest.java
new file mode 100644
index 0000000..0a43cef
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/controllers/CategoryControllerTest.java
@@ -0,0 +1,36 @@
+package accenture.challenge.recruiting.bff.controllers;
+
+import accenture.challenge.recruiting.bff.exceptions.GenericException;
+import accenture.challenge.recruiting.bff.services.ICategory;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static accenture.challenge.recruiting.bff.fixtures.ServicesFixture.getCategories;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.when;
+
+@SpringBootTest
+public class CategoryControllerTest {
+
+ @InjectMocks
+ private CategoryController categoryController;
+ @Mock
+ private ICategory iCategory;
+
+ @Test
+ public void getCategoriesOrderRelevance_ok() throws Exception {
+ when(iCategory.getCategoriesOrderRelevanceAsc()).thenReturn(getCategories());
+ var response = categoryController.getCategoriesOrderRelevance();
+ assertNotNull(response);
+ }
+
+ @Test
+ public void getCategoriesOrderRelevance_generic() throws Exception {
+ when(iCategory.getCategoriesOrderRelevanceAsc()).thenThrow(new GenericException("test"));
+ assertThrows(GenericException.class, () -> categoryController.getCategoriesOrderRelevance());
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/CategoryClientFixture.java b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/CategoryClientFixture.java
new file mode 100644
index 0000000..ef45c5e
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/CategoryClientFixture.java
@@ -0,0 +1,18 @@
+package accenture.challenge.recruiting.bff.fixtures;
+
+import accenture.challenge.recruiting.bff.domains.CategoryThree;
+
+public class CategoryClientFixture {
+
+ private static CategoryThree categoryThree;
+
+ static {
+ categoryThree = Fixture.readFileFromResources("categoryClient/getCategoryThree.json",
+ CategoryThree.class, false);
+ }
+
+ public static CategoryThree getCategoryThree() {
+ return categoryThree;
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/Fixture.java b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/Fixture.java
new file mode 100644
index 0000000..d0ac94a
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/Fixture.java
@@ -0,0 +1,47 @@
+package accenture.challenge.recruiting.bff.fixtures;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import feign.FeignException;
+import feign.Request;
+import org.apache.commons.io.IOUtils;
+
+import java.io.FileInputStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+
+import static com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance;
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+public final class Fixture {
+
+ private static final String PATH = "src/test/resources/json/";
+
+ public static T readFileFromResources(String fileName, Class clase, boolean esLista) {
+ try {
+ FileInputStream fis = new FileInputStream(PATH + fileName);
+ var jsonText = IOUtils.toString(fis, UTF_8.name());
+ ObjectMapper objectMapper = new ObjectMapper();
+ if(esLista) {
+ return objectMapper.readValue(jsonText, defaultInstance().constructCollectionType(List.class, clase));
+ }
+ return objectMapper.readValue(jsonText, clase);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static FeignException.FeignClientException getMockFeignClientException(int status, String mensaje, String body) {
+ return new FeignException.FeignClientException(status, mensaje, getMockRequest(),
+ body.getBytes(StandardCharsets.UTF_8), null);
+ }
+
+ public static Request getMockRequest() {
+ return Request.create(Request.HttpMethod.GET, "http://test.url",
+ new HashMap<>(), Request.Body.create(new byte[0], Charset.defaultCharset()), null);
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/ServicesFixture.java b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/ServicesFixture.java
new file mode 100644
index 0000000..33e5482
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/fixtures/ServicesFixture.java
@@ -0,0 +1,22 @@
+package accenture.challenge.recruiting.bff.fixtures;
+
+import accenture.challenge.recruiting.bff.dtos.CategoryDto;
+
+import java.util.List;
+
+import static accenture.challenge.recruiting.bff.fixtures.Fixture.readFileFromResources;
+
+public class ServicesFixture {
+
+ private static List categories;
+
+ static {
+ categories = (List) readFileFromResources("services/getCategories.json",
+ CategoryDto.class, true);
+ }
+
+ public static List getCategories() {
+ return categories;
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/services/SCategoryTest.java b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/services/SCategoryTest.java
new file mode 100644
index 0000000..d2a6513
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/java/accenture/challenge/recruiting/bff/services/SCategoryTest.java
@@ -0,0 +1,40 @@
+package accenture.challenge.recruiting.bff.services;
+
+import accenture.challenge.recruiting.bff.clients.CategoryClient;
+import accenture.challenge.recruiting.bff.exceptions.GenericException;
+import accenture.challenge.recruiting.bff.services.impl.SCategory;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static accenture.challenge.recruiting.bff.fixtures.CategoryClientFixture.getCategoryThree;
+import static accenture.challenge.recruiting.bff.fixtures.Fixture.getMockFeignClientException;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+@SpringBootTest
+public class SCategoryTest {
+
+ @InjectMocks
+ private SCategory sCategory;
+ @Mock
+ private CategoryClient categoryClient;
+
+ @Test
+ public void getCategoriesOrderRelevanceAsc_ok() throws Exception {
+ when(categoryClient.getCategoriesOrderReelevanceAndLimit(any())).thenReturn(getCategoryThree());
+ var response = sCategory.getCategoriesOrderRelevanceAsc();
+ assertNotNull(response);
+ }
+
+ @Test
+ public void getCategoriesOrderRelevanceAsc_ex() throws Exception {
+ when(categoryClient.getCategoriesOrderReelevanceAndLimit(any()))
+ .thenThrow(getMockFeignClientException(503, "Servicio no disponible", "Error servicio no disponible"));
+ assertThrows(GenericException.class, () -> sCategory.getCategoriesOrderRelevanceAsc());
+ }
+
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/resources/json/categoryClient/getCategoryThree.json b/bff-recruiting-hsa/src/test/resources/json/categoryClient/getCategoryThree.json
new file mode 100644
index 0000000..26317f2
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/resources/json/categoryClient/getCategoryThree.json
@@ -0,0 +1,134 @@
+{
+ "id": "ROOT",
+ "name": "LEGACY_NAVIGATION",
+ "subcategories": [
+ {
+ "id": "MOB",
+ "name": "MOBILE_MARKET",
+ "subcategories": [
+ {
+ "id": "video-games",
+ "name": "Video Games",
+ "relevance": 150,
+ "subcategories": [
+ {
+ "id": "nintendo",
+ "name": "Nintendo",
+ "subcategories": [
+ {
+ "id": "switch",
+ "name": "Switch",
+ "relevance": 422
+ }
+ ],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "sports",
+ "name": "Sports",
+ "relevance": 1,
+ "subcategories": [
+ {
+ "id": "bike",
+ "name": "Bike",
+ "relevance": 350,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "electronics",
+ "name": "Electronics",
+ "subcategories": [
+ {
+ "id": "tv",
+ "name": "TV",
+ "subcategories": [
+ {
+ "id": "4k",
+ "name": "4K",
+ "relevance": 700
+ }
+ ],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "outdoor",
+ "name": "Outdoor",
+ "relevance": 3,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "food",
+ "name": "Food",
+ "relevance": 4,
+ "subcategories": [
+ {
+ "id": "hamburger",
+ "name": "Hamburger",
+ "relevance": 350,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "books",
+ "name": "Books",
+ "relevance": 2,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "travel",
+ "name": "Travel",
+ "relevance": 5,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "health",
+ "name": "Health",
+ "relevance": 6,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "toys",
+ "name": "Toys",
+ "relevance": 99,
+ "subcategories": [
+ {
+ "id": "puzzles",
+ "name": "Puzzles",
+ "relevance": 100,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/bff-recruiting-hsa/src/test/resources/json/services/getCategories.json b/bff-recruiting-hsa/src/test/resources/json/services/getCategories.json
new file mode 100644
index 0000000..a87f4b5
--- /dev/null
+++ b/bff-recruiting-hsa/src/test/resources/json/services/getCategories.json
@@ -0,0 +1,32 @@
+[
+ {
+ "id": "sports",
+ "name": "Sports",
+ "relevance": 1,
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "books",
+ "name": "Books",
+ "relevance": 2,
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "outdoor",
+ "name": "Outdoor",
+ "relevance": 3,
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "food",
+ "name": "Food",
+ "relevance": 4,
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "travel",
+ "name": "Travel",
+ "relevance": 5,
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+]
\ No newline at end of file
diff --git a/ms-categorias.iml b/ms-categorias.iml
new file mode 100644
index 0000000..db28539
--- /dev/null
+++ b/ms-categorias.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ms-categorias/.gitignore b/ms-categorias/.gitignore
new file mode 100644
index 0000000..b63da45
--- /dev/null
+++ b/ms-categorias/.gitignore
@@ -0,0 +1,42 @@
+.gradle
+build/
+!gradle/wrapper/gradle-wrapper.jar
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+out/
+!**/src/main/**/out/
+!**/src/test/**/out/
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+bin/
+!**/src/main/**/bin/
+!**/src/test/**/bin/
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/ms-categorias/build.gradle b/ms-categorias/build.gradle
new file mode 100644
index 0000000..c6a2e3c
--- /dev/null
+++ b/ms-categorias/build.gradle
@@ -0,0 +1,55 @@
+plugins {
+ id 'java'
+ id 'org.springframework.boot' version '2.7.0'
+ id 'io.spring.dependency-management' version '1.1.4'
+}
+
+java {
+ sourceCompatibility = '11'
+}
+
+group = 'accenture.challenge.recruiting.ms'
+version = '1.0.0-SNAPSHOT'
+
+repositories {
+ mavenCentral()
+}
+
+configurations {
+ compileOnly {
+ extendsFrom annotationProcessor
+ }
+}
+
+ext {
+ set('springCloudVersion', "2021.0.3")
+}
+
+dependencies {
+ implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
+ compileOnly 'org.projectlombok:lombok'
+ annotationProcessor 'org.projectlombok:lombok'
+ implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
+ implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
+ implementation group: 'javax.json.bind', name: 'javax.json.bind-api', version: '1.0'
+
+ testImplementation 'org.springframework.boot:spring-boot-starter-test'
+ testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
+ testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
+}
+
+dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
+ }
+}
+
+test {
+ useJUnitPlatform()
+ exclude '**/Application/.*'
+ exclude '**/domains/**'
+ exclude '**/exceptions/**'
+ exclude '**/configs/**'
+ exclude '**/controllers/ExceptionHandlerController.*'
+}
\ No newline at end of file
diff --git a/ms-categorias/gradle/wrapper/gradle-wrapper.jar b/ms-categorias/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..249e583
Binary files /dev/null and b/ms-categorias/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/ms-categorias/gradle/wrapper/gradle-wrapper.properties b/ms-categorias/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..d2741ce
--- /dev/null
+++ b/ms-categorias/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Thu Dec 14 10:42:51 CLST 2023
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/ms-categorias/gradlew b/ms-categorias/gradlew
new file mode 100755
index 0000000..1b6c787
--- /dev/null
+++ b/ms-categorias/gradlew
@@ -0,0 +1,234 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed 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.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
+
+APP_NAME="Gradle"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+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
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/ms-categorias/gradlew.bat b/ms-categorias/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/ms-categorias/gradlew.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem 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, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/ms-categorias/settings.gradle b/ms-categorias/settings.gradle
new file mode 100644
index 0000000..00aec76
--- /dev/null
+++ b/ms-categorias/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'ms-categorias'
+
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/Application.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/Application.java
new file mode 100644
index 0000000..0656b4c
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/Application.java
@@ -0,0 +1,17 @@
+package accenture.challenge.recruiting.ms;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@EnableSwagger2
+@EnableFeignClients
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/clients/CategoryClient.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/clients/CategoryClient.java
new file mode 100644
index 0000000..439ff04
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/clients/CategoryClient.java
@@ -0,0 +1,15 @@
+package accenture.challenge.recruiting.ms.clients;
+
+import accenture.challenge.recruiting.ms.domains.CategoryThree;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@FeignClient(name = "Category-Api-Client",
+ url = "${api.categorias.base}",
+ path = "${api.categoria.path.obtener}")
+public interface CategoryClient {
+
+ @GetMapping()
+ CategoryThree getCategoryThree();
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/PropertiesConfig.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/PropertiesConfig.java
new file mode 100644
index 0000000..60582d8
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/PropertiesConfig.java
@@ -0,0 +1,21 @@
+package accenture.challenge.recruiting.ms.configs.properties;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.PropertySources;
+
+@Configuration
+@PropertySources({
+ @PropertySource("classpath:application.properties")
+})
+public class PropertiesConfig {
+
+ @Bean
+ @ConfigurationProperties(prefix = "swagger")
+ public SwaggerProperties swaggerProperties() {
+ return new SwaggerProperties();
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/SwaggerProperties.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/SwaggerProperties.java
new file mode 100644
index 0000000..10fe5c7
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/properties/SwaggerProperties.java
@@ -0,0 +1,41 @@
+package accenture.challenge.recruiting.ms.configs.properties;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Delegate;
+
+@Getter
+@Setter
+public class SwaggerProperties {
+
+ @Delegate
+ private SwaggerUiEnabled ui;
+
+ @Delegate
+ private SwaggerInfo info;
+
+ @Getter
+ @Setter
+ private static class SwaggerUiEnabled {
+ private boolean enabled;
+ }
+
+ @Getter
+ @Setter
+ private static class SwaggerInfo {
+ private String name;
+ private String description;
+ private String version;
+ private SwaggerInfoContact contact;
+ }
+
+ @Getter
+ @Setter
+ @NoArgsConstructor
+ public static class SwaggerInfoContact {
+ private String name;
+ private String mail;
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/swagger/SpringfoxConfig.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/swagger/SpringfoxConfig.java
new file mode 100644
index 0000000..e0bb96e
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/configs/swagger/SpringfoxConfig.java
@@ -0,0 +1,57 @@
+package accenture.challenge.recruiting.ms.configs.swagger;
+
+import accenture.challenge.recruiting.ms.configs.properties.SwaggerProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.Contact;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+
+import static java.util.List.of;
+import static springfox.documentation.builders.PathSelectors.any;
+import static springfox.documentation.builders.RequestHandlerSelectors.withClassAnnotation;
+
+@Configuration
+public class SpringfoxConfig {
+
+ @Autowired
+ private SwaggerProperties swaggerProperties;
+
+ /**
+ * Basic Swagger configuration
+ *
+ * @return {@link Docket} Swagger configuration
+ */
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .select()
+ .apis(withClassAnnotation(RestController.class))
+ .paths(any())
+ .build()
+ .apiInfo(getApiInfo())
+ .enable(swaggerProperties.isEnabled())
+ .useDefaultResponseMessages(false);
+ }
+
+ /**
+ * Sets the API information for Swagger UI
+ *
+ * @return {@link ApiInfo} API Information
+ */
+ private ApiInfo getApiInfo() {
+ return new ApiInfo(
+ swaggerProperties.getName(),
+ swaggerProperties.getDescription(),
+ swaggerProperties.getVersion(),
+ null,
+ new Contact(swaggerProperties.getContact().getName(), null, swaggerProperties.getContact().getMail()),
+ null,
+ null,
+ of()
+ );
+ }
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/CategoryController.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/CategoryController.java
new file mode 100644
index 0000000..257a106
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/CategoryController.java
@@ -0,0 +1,39 @@
+package accenture.challenge.recruiting.ms.controllers;
+
+import accenture.challenge.recruiting.ms.domains.CategoryThree;
+import accenture.challenge.recruiting.ms.services.ICategory;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(value = "Controlador encargado de las operacion de categorias")
+@RestController
+@RequestMapping(value = "/challenge/categories")
+@RequiredArgsConstructor
+public class CategoryController {
+
+ private final ICategory iCategory;
+
+ @ApiOperation(
+ value = "Obtiene categorias ordenadas por reelevancia",
+ notes = "Obtiene categorias ordenadas por reelevancia",
+ produces = "ResponseEntity")
+ @ApiResponses({
+ @ApiResponse(code = 500, message = "Error General"),
+ @ApiResponse(code = 200, message = "Obtiene resultado")
+ })
+ @GetMapping
+ public ResponseEntity getCategoriesOrderRelevance(
+ @RequestParam(required = false) Integer cantidad) {
+ var categoriesOrderrelevance = iCategory.getCategoriesOrderRelevanceAsc(cantidad);
+ return ResponseEntity.ok(categoriesOrderrelevance);
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/ExceptionHandlerController.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/ExceptionHandlerController.java
new file mode 100644
index 0000000..aa05fc1
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/controllers/ExceptionHandlerController.java
@@ -0,0 +1,36 @@
+package accenture.challenge.recruiting.ms.controllers;
+
+import accenture.challenge.recruiting.ms.exceptions.GenericException;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+import java.util.function.BiFunction;
+
+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
+
+@Log4j2
+@ControllerAdvice(basePackages={"accenture.challenge.recruiting.ms.controllers"})
+public class ExceptionHandlerController {
+
+ private static final BiFunction builderError = (title, message) ->
+ new Error(String.format("%s - %s", title, message));
+
+ @ExceptionHandler(Exception.class)
+ ResponseEntity handleException(Exception ex) {
+ log.error(ex.getMessage());
+ return new ResponseEntity<>(
+ builderError.apply("Error Interno", "Ah salido algo mal favor intentar mas tarde"),
+ INTERNAL_SERVER_ERROR);
+ }
+
+ @ExceptionHandler(GenericException.class)
+ ResponseEntity handleGenericException(GenericException ex) {
+ log.error(ex.getMessage());
+ return new ResponseEntity<>(
+ builderError.apply("Error Generico", ex.getMessage()),
+ INTERNAL_SERVER_ERROR);
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryBase.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryBase.java
new file mode 100644
index 0000000..12934bc
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryBase.java
@@ -0,0 +1,30 @@
+package accenture.challenge.recruiting.ms.domains;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import java.io.Serializable;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Setter
+@Getter
+@ToString
+@NoArgsConstructor
+@JsonInclude(NON_NULL)
+public class CategoryBase implements Serializable {
+
+ private String id;
+ private String name;
+ private Integer relevance;
+ private String iconImageUrl;
+ private String largeImageUrl;
+ private String mediumImageUrl;
+ private String smallImageUrl;
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryThree.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryThree.java
new file mode 100644
index 0000000..7e52d06
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/domains/CategoryThree.java
@@ -0,0 +1,52 @@
+package accenture.challenge.recruiting.ms.domains;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+@Setter
+@Getter
+@ToString
+@NoArgsConstructor
+@JsonInclude(NON_NULL)
+public class CategoryThree extends CategoryBase implements Serializable {
+
+ private List subcategories;
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_1 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_2 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+ @Setter
+ @Getter
+ @ToString
+ @NoArgsConstructor
+ @JsonInclude(NON_NULL)
+ public static class SubCategoryBase_3 extends CategoryBase implements Serializable {
+ private List subcategories;
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/exceptions/GenericException.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/exceptions/GenericException.java
new file mode 100644
index 0000000..c9e3341
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/exceptions/GenericException.java
@@ -0,0 +1,13 @@
+package accenture.challenge.recruiting.ms.exceptions;
+
+public class GenericException extends RuntimeException {
+
+ public GenericException(String error) {
+ super(error);
+ }
+
+ public GenericException(String error, Throwable ex) {
+ super(error, ex);
+ }
+
+}
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/ICategory.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/ICategory.java
new file mode 100644
index 0000000..9f75eb5
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/ICategory.java
@@ -0,0 +1,9 @@
+package accenture.challenge.recruiting.ms.services;
+
+import accenture.challenge.recruiting.ms.domains.CategoryThree;
+
+public interface ICategory {
+
+ CategoryThree getCategoriesOrderRelevanceAsc(Integer cantidad);
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/impl/SCategory.java b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/impl/SCategory.java
new file mode 100644
index 0000000..2ceaff3
--- /dev/null
+++ b/ms-categorias/src/main/java/accenture/challenge/recruiting/ms/services/impl/SCategory.java
@@ -0,0 +1,74 @@
+package accenture.challenge.recruiting.ms.services.impl;
+
+import accenture.challenge.recruiting.ms.clients.CategoryClient;
+import accenture.challenge.recruiting.ms.domains.CategoryThree;
+import accenture.challenge.recruiting.ms.exceptions.GenericException;
+import accenture.challenge.recruiting.ms.services.ICategory;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.stereotype.Service;
+
+import java.util.Comparator;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+
+import static java.util.Objects.nonNull;
+import static java.util.Objects.requireNonNullElse;
+
+@Log4j2
+@Service
+@RequiredArgsConstructor
+public class SCategory implements ICategory {
+
+ private static final Consumer orderCategoryByRelevanceAsc = categorythree ->
+ categorythree.getSubcategories()
+ .forEach(category -> category.setSubcategories(
+ category.getSubcategories().stream()
+ .filter(cate -> nonNull(cate.getRelevance()))
+ .sorted(Comparator.comparing(CategoryThree.SubCategoryBase_2:: getRelevance))
+ .collect(Collectors.toList())));
+
+ private static final BiConsumer limitSizeList = (categorythree, cantidad) ->
+ categorythree.getSubcategories()
+ .forEach(category -> category.setSubcategories(
+ category.getSubcategories().stream()
+ .limit(requireNonNullElse(cantidad, category.getSubcategories().size()))
+ .collect(Collectors.toList())));
+
+ private final CategoryClient categoryClient;
+
+ /**
+ * Obtiene categorias.
+ * @return 'CategoryThree'
+ */
+ private CategoryThree getCategoryThree() {
+ log.info("INICIO - getCategoryThree");
+ var categorythree = categoryClient.getCategoryThree();
+ log.info("FIN - getCategoryThree () -> " + categorythree);
+ return categorythree;
+ }
+
+ /**
+ * - Obtiene categorias
+ * - Ordena de manera natural por reelevancia
+ * - Limita tamaño de arreglo segun cantidad solicitada
+ *
+ * @return 'CategoryThree con las categorias ordenadas por reelevancia'
+ */
+ @Override
+ public CategoryThree getCategoriesOrderRelevanceAsc(Integer cantidad) {
+ log.info("INICIO - getCategoriesOrderRelevanceAsc");
+ try {
+ var categorythree = getCategoryThree();
+ orderCategoryByRelevanceAsc.accept(categorythree);
+ limitSizeList.accept(categorythree, cantidad);
+ log.info("FIN - getCategoriesOrderRelevanceAsc () -> " + categorythree);
+ return categorythree;
+ } catch(Exception ex) {
+ log.error("ERROR - getCategoriesOrderRelevanceAsc () -> " + ex.getMessage());
+ throw new GenericException("Error al obtener categorias", ex);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/main/resources/application.properties b/ms-categorias/src/main/resources/application.properties
new file mode 100644
index 0000000..59d3f27
--- /dev/null
+++ b/ms-categorias/src/main/resources/application.properties
@@ -0,0 +1,28 @@
+########################################################################
+## This file holds all the properties specific for this application
+########################################################################
+spring.mvc.pathmatch.matching-strategy = ANT_PATH_MATCHER
+
+## Swagger configuration
+swagger.ui.enabled=true
+swagger.info.name=MS Category
+swagger.info.description=API que controla las operaciones sobre categoria
+swagger.info.version=1.0.0-SNAPSHOT
+swagger.info.contact.name=Iván Sandoval
+swagger.info.contact.mail=imsq.93@gmail.com
+
+# Empty para desactivar boton try it out
+springdoc.swagger-ui.enabled=true
+springdoc.swagger-ui.supported-submit-methods=false
+
+## Feign configuration
+feign.client.config.default.connectTimeout=10000
+feign.client.config.default.readTimeout=10000
+feign.client.config.default.loggerLevel=basic
+
+## Server configuration
+server.port=8080
+
+## Rest
+api.categorias.base=https://cs-hsa-api-categories-rest.herokuapp.com
+api.categoria.path.obtener=/categories
\ No newline at end of file
diff --git a/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/controllers/CategoryControllerTest.java b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/controllers/CategoryControllerTest.java
new file mode 100644
index 0000000..4c0e398
--- /dev/null
+++ b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/controllers/CategoryControllerTest.java
@@ -0,0 +1,45 @@
+package accenture.challenge.recruiting.ms.controllers;
+
+import accenture.challenge.recruiting.ms.exceptions.GenericException;
+import accenture.challenge.recruiting.ms.services.ICategory;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import static accenture.challenge.recruiting.ms.fixtures.CategoryApiFixture.getcategories;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+@SpringBootTest
+public class CategoryControllerTest {
+
+ @InjectMocks
+ private CategoryController categoryController;
+ @Mock
+ private ICategory iCategory;
+
+ @Test
+ public void getCategoriesOrderRelevance_ok() throws Exception {
+ when(iCategory.getCategoriesOrderRelevanceAsc(any())).thenReturn(getcategories());
+ var response = categoryController.getCategoriesOrderRelevance(1);
+ assertNotNull(response);
+ }
+
+ @Test
+ public void getCategoriesOrderRelevance_exception() throws Exception {
+ when(iCategory.getCategoriesOrderRelevanceAsc(any()))
+ .thenThrow(new IllegalArgumentException("test"));
+ assertThrows(Exception.class, () -> categoryController.getCategoriesOrderRelevance(1));
+ }
+
+ @Test
+ public void getCategoriesOrderRelevance_generic() throws Exception {
+ when(iCategory.getCategoriesOrderRelevanceAsc(any()))
+ .thenThrow(new GenericException("test"));
+ assertThrows(GenericException.class, () -> categoryController.getCategoriesOrderRelevance(1));
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/CategoryApiFixture.java b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/CategoryApiFixture.java
new file mode 100644
index 0000000..5209369
--- /dev/null
+++ b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/CategoryApiFixture.java
@@ -0,0 +1,19 @@
+package accenture.challenge.recruiting.ms.fixtures;
+
+import accenture.challenge.recruiting.ms.domains.CategoryThree;
+
+import static accenture.challenge.recruiting.ms.fixtures.Fixture.readFileFromResources;
+
+public class CategoryApiFixture {
+
+ private static CategoryThree categories;
+
+ static {
+ categories = readFileFromResources("categoryApi/getCategories.json", CategoryThree.class);
+ }
+
+ public static CategoryThree getcategories() {
+ return categories;
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/Fixture.java b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/Fixture.java
new file mode 100644
index 0000000..4cfdc82
--- /dev/null
+++ b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/fixtures/Fixture.java
@@ -0,0 +1,40 @@
+package accenture.challenge.recruiting.ms.fixtures;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import feign.FeignException;
+import feign.Request;
+import org.apache.commons.io.IOUtils;
+
+import java.io.FileInputStream;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+public final class Fixture {
+
+ private static final String PATH = "src/test/resources/json/";
+
+ public static T readFileFromResources(String fileName, Class clase) {
+ try {
+ FileInputStream fis = new FileInputStream(PATH + fileName);
+ var jsonText = IOUtils.toString(fis, UTF_8.name());
+ ObjectMapper objectMapper = new ObjectMapper();
+ return objectMapper.readValue(jsonText, clase);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public static FeignException.FeignClientException.FeignClientException getMockFeignClientException(int status, String mensaje, String body) {
+ return new FeignException.FeignClientException(status, mensaje, getMockRequest(),
+ body.getBytes(StandardCharsets.UTF_8), null);
+ }
+
+ public static Request getMockRequest() {
+ return Request.create(Request.HttpMethod.GET, "http://test.url",
+ new HashMap<>(), Request.Body.create(new byte[0], Charset.defaultCharset()), null);
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/services/SCategoryTest.java b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/services/SCategoryTest.java
new file mode 100644
index 0000000..b7c07c7
--- /dev/null
+++ b/ms-categorias/src/test/java/accenture/challenge/recruiting/ms/services/SCategoryTest.java
@@ -0,0 +1,42 @@
+package accenture.challenge.recruiting.ms.services;
+
+import accenture.challenge.recruiting.ms.clients.CategoryClient;
+import accenture.challenge.recruiting.ms.exceptions.GenericException;
+import accenture.challenge.recruiting.ms.fixtures.Fixture;
+import accenture.challenge.recruiting.ms.services.impl.SCategory;
+import feign.FeignException;
+import org.junit.jupiter.api.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.HttpStatus;
+
+import static accenture.challenge.recruiting.ms.fixtures.CategoryApiFixture.getcategories;
+import static accenture.challenge.recruiting.ms.fixtures.Fixture.getMockFeignClientException;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.mockito.Mockito.when;
+
+@SpringBootTest
+public class SCategoryTest {
+
+ @InjectMocks
+ private SCategory sCategory;
+ @Mock
+ private CategoryClient categoryClient;
+
+ @Test
+ public void getCategoriesOrderRelevanceAsc_ok() throws Exception {
+ when(categoryClient.getCategoryThree()).thenReturn(getcategories());
+ var response = sCategory.getCategoriesOrderRelevanceAsc(1);
+ assertNotNull(response);
+ }
+
+ @Test
+ public void getCategoriesOrderRelevanceAsc_ex() throws Exception {
+ when(categoryClient.getCategoryThree())
+ .thenThrow(getMockFeignClientException(503, "Servicio no disponible", "Error servicio no disponible"));
+ assertThrows(GenericException.class, () -> sCategory.getCategoriesOrderRelevanceAsc(1));
+ }
+
+}
\ No newline at end of file
diff --git a/ms-categorias/src/test/resources/json/categoryApi/getCategories.json b/ms-categorias/src/test/resources/json/categoryApi/getCategories.json
new file mode 100644
index 0000000..26317f2
--- /dev/null
+++ b/ms-categorias/src/test/resources/json/categoryApi/getCategories.json
@@ -0,0 +1,134 @@
+{
+ "id": "ROOT",
+ "name": "LEGACY_NAVIGATION",
+ "subcategories": [
+ {
+ "id": "MOB",
+ "name": "MOBILE_MARKET",
+ "subcategories": [
+ {
+ "id": "video-games",
+ "name": "Video Games",
+ "relevance": 150,
+ "subcategories": [
+ {
+ "id": "nintendo",
+ "name": "Nintendo",
+ "subcategories": [
+ {
+ "id": "switch",
+ "name": "Switch",
+ "relevance": 422
+ }
+ ],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "sports",
+ "name": "Sports",
+ "relevance": 1,
+ "subcategories": [
+ {
+ "id": "bike",
+ "name": "Bike",
+ "relevance": 350,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "electronics",
+ "name": "Electronics",
+ "subcategories": [
+ {
+ "id": "tv",
+ "name": "TV",
+ "subcategories": [
+ {
+ "id": "4k",
+ "name": "4K",
+ "relevance": 700
+ }
+ ],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "outdoor",
+ "name": "Outdoor",
+ "relevance": 3,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "food",
+ "name": "Food",
+ "relevance": 4,
+ "subcategories": [
+ {
+ "id": "hamburger",
+ "name": "Hamburger",
+ "relevance": 350,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "books",
+ "name": "Books",
+ "relevance": 2,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "travel",
+ "name": "Travel",
+ "relevance": 5,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "health",
+ "name": "Health",
+ "relevance": 6,
+ "subcategories": [],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ },
+ {
+ "id": "toys",
+ "name": "Toys",
+ "relevance": 99,
+ "subcategories": [
+ {
+ "id": "puzzles",
+ "name": "Puzzles",
+ "relevance": 100,
+ "subcategories": [],
+ "largeImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "mediumImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg",
+ "smallImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ],
+ "iconImageUrl": "https://i4.visitchile.com/img/GalleryContent/8822/slider/Torres_del_Paine.jpg"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file