Loading .gitlab-ci.yml +8 −20 Original line number Diff line number Diff line Loading @@ -54,10 +54,8 @@ variables: ELASTIC_ADDRESSES: docker OAUTH_SERVER: http://docker:8081 PROPERTY_USER_API: http://docker:8082 ELASTICSEARCH_IMAGE_NAME: registry.gitlab.com/redmic-project/elastic/elasticsearch/master ELASTICSEARCH_IMAGE_TAG: latest SCHEMA_ES_IMAGE_NAME: registry.gitlab.com/redmic-project/elastic/schema-es/master SCHEMA_ES_IMAGE_TAG: latest ELASTICSEARCH_IMAGE_NAME: docker.elastic.co/elasticsearch/elasticsearch ELASTICSEARCH_IMAGE_TAG: 6.6.2 ES_BOOTSTRAP_MEMORY_LOCK: 'true' OLD_ELASTIC_ADMIN_PASS: changeme ELASTIC_ADMIN_PASS: elastic_admin_pass Loading @@ -65,13 +63,12 @@ variables: ELASTIC_USER_PASS: elastic_user_pass ELASTIC_USER_ROLE: redmic_user ES_JAVA_OPTS: '-Xms512m -Xmx512m -Djava.security.policy=file:///usr/share/elasticsearch/config/grovy-classes_whitelist.policy' ES_CLUSTER_NAME: elasticsearch_dev ES_CLUSTER_NAME: es_dev ES_NODE_NAME: node-1 ES_DISCOVERY_ZEN_MINIMUM_MASTER_NODES: 1 ES_DISCOVERY_ZEN_PING_UNICAST_HOSTS: es-1 ES_XPACK_SECURITY_ENABLED: 'true' ELASTIC_HOSTS: es-1 ELASTIC_SCHEMA_VERSION: '0.1' ES_DISCOVERY_ZEN_PING_UNICAST_HOSTS: es6-1 ES_XPACK_SECURITY_ENABLED: 'false' ELASTIC_HOSTS: es6-1 GITLAB_REGISTRY_HOST: registry.gitlab.com CI_DEPLOY_USER: ci_deploy_user CI_DEPLOY_PASSWORD: ci_deploy_password Loading Loading @@ -167,7 +164,7 @@ variables: -U ${POSTGRES_USER} \ -c "ALTER ROLE ${SPRING_DATASOURCE_USERNAME} WITH PASSWORD '${SPRING_DATASOURCE_PASSWORD}'" - > docker run -d --rm --name es-1 \ docker run -d --rm --name es6-1 \ -p 9300:9300 \ -p 9200:9200 \ --network test \ Loading @@ -194,18 +191,9 @@ variables: echo "Waiting for elasticsearch server, remaining attempts... Last output:"; echo $RESPONSE; done - > docker login ${GITLAB_REGISTRY_HOST} -u ${CI_DEPLOY_USER} -p ${CI_DEPLOY_PASSWORD}; docker run --rm --name schema-es \ --network test \ -e ELASTIC_USER \ -e ELASTIC_USER_PASS \ -e ELASTIC_HOSTS \ -e ELASTIC_SCHEMA_VERSION \ ${SCHEMA_ES_IMAGE_NAME}:${SCHEMA_ES_IMAGE_TAG} after_script: - rm -rf .m2/repository/es - docker stop user oauth postgres es-1 - docker stop user oauth postgres es6-1 .docker-build: variables: Loading deploy/docker-compose.tmpl.yml +4 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ services: OAUTH_CLIENT_SECRET: AWS_ACCESS_KEY: AWS_SECRET_KEY: ELASTIC_XPACKSECURITYUSER: ELASTIC_CLUSTERNAME: ELASTIC_USER: ELASTIC_PASSWORD: JAVA_OPTS: -XX:MaxRAMFraction=2 networks: elastic-net: Loading Loading @@ -55,7 +57,7 @@ services: networks: elastic-net: name: ${ELASTIC_NET_NAME:-elastic-net} name: ${ELASTIC_NET_NAME:-elastic6-net} driver: ${ELASTIC_NET_DRIVER:-overlay} external: true Loading pom.xml +31 −24 Original line number Diff line number Diff line Loading @@ -6,36 +6,37 @@ <parent> <groupId>es.redmic</groupId> <artifactId>server-parent</artifactId> <version>0.1.0</version> <version>0.3.0</version> <relativePath /> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>api</artifactId> <packaging>jar</packaging> <version>0.11.0</version> <version>0.11.0-feature-refactoring</version> <name>API</name> <description>RESTful web services</description> <properties> <!-- REDMIC --> <redmic.db.version>0.6.1-legacy-0.6</redmic.db.version> <redmic.elasticsearch.version>0.6.1-legacy-0.6</redmic.elasticsearch.version> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.utils.version>0.6.0</redmic.utils.version> <redmic.models.version>0.6.1-legacy-0.6</redmic.models.version> <redmic.db.version>0.7.0-feature-refactoring</redmic.db.version> <redmic.elasticsearch.version>0.8.0-feature-refactoring</redmic.elasticsearch.version> <redmic.exceptions.version>0.10.0</redmic.exceptions.version> <redmic.utils.version>0.10.0-feature-changeJtsVersion</redmic.utils.version> <redmic.models.version>0.12.0-feature-refactoring</redmic.models.version> <redmic.mediastorage.version>0.7.0</redmic.mediastorage.version> <redmic.sitemapgen4j.version>0.6.0</redmic.sitemapgen4j.version> <redmic.test-utils.version>0.6.0</redmic.test-utils.version> <redmic.test-utils.version>0.10.0-feature-refactoring</redmic.test-utils.version> <!-- OTHERS --> <orika-core.version>1.4.6</orika-core.version> <commons-fileupload>1.3.2</commons-fileupload> <powermock.version>1.7.3</powermock.version> <jackson-datatype-jts.version>1.0-2.7</jackson-datatype-jts.version> <orika-core.version>1.5.4</orika-core.version> <commons-fileupload>1.4</commons-fileupload> <powermock.version>2.0.9</powermock.version> <!-- Plugins --> <asciidoctor.maven.plugin.version>1.5.6</asciidoctor.maven.plugin.version> <asciidoctor.maven.plugin.version>2.1.0</asciidoctor.maven.plugin.version> </properties> <dependencies> Loading Loading @@ -109,6 +110,13 @@ <!-- Otros --> <dependency> <groupId>com.graphhopper.external</groupId> <artifactId>jackson-datatype-jts</artifactId> <version>${jackson-datatype-jts.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>ma.glasnost.orika</groupId> <artifactId>orika-core</artifactId> Loading @@ -126,23 +134,27 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-easymock</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> <!--test de documentación --> Loading @@ -158,23 +170,18 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <executable>true</executable> <finalName>api</finalName> <outputDirectory>dist</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <reuseForks>false</reuseForks> <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> <includes> <include>**/Test*.java</include> <include>**/*Test.java</include> Loading src/main/java/es/redmic/ApiApplication.java +2 −9 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import es.redmic.api.common.converter.QueryDTOMessageConverter; import es.redmic.api.config.GenerateJsonSchemaScanBean; import es.redmic.api.config.OrikaScanBean; import es.redmic.api.config.ResourceBundleMessageSource; import es.redmic.databaselib.common.repository.BaseRepositoryImpl; import es.redmic.db.config.EntityManagerWrapper; Loading Loading @@ -81,12 +80,6 @@ public class ApiApplication { return new EntityManagerWrapper(); } @PostConstruct @Bean public OrikaScanBean orikaScanBean() { return new OrikaScanBean(); } @PostConstruct @Bean public GenerateJsonSchemaScanBean generateSchemaScanBean() { Loading src/main/java/es/redmic/api/administrative/controller/ActivityController.java +23 −6 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; Loading Loading @@ -60,7 +62,7 @@ public class ActivityController super(service, serviceES); } @RequestMapping(value = "${contoller.mapping.ANCESTORS}/_search", method = RequestMethod.POST) @PostMapping(value = "${contoller.mapping.ANCESTORS}/_search") @ResponseBody public SuperDTO _getAncestors(@PathVariable("path") String path, HttpServletResponse response, @Valid @RequestBody DataQueryDTO queryDTO, BindingResult bindingResult) { Loading @@ -70,7 +72,7 @@ public class ActivityController String[] ancestorIds = HierarchicalUtils.getAncestorsIds(path); MgetDTO mgetDto = new MgetDTO(Arrays.asList(ancestorIds)); if (queryDTO.getReturnFields() != null && queryDTO.getReturnFields().size() > 0) { if (queryDTO.getReturnFields() != null && !queryDTO.getReturnFields().isEmpty()) { mgetDto.setFields(queryDTO.getReturnFields()); if (!mgetDto.getFields().contains("path")) { Loading @@ -81,4 +83,19 @@ public class ActivityController JSONCollectionDTO result = activityBaseESService.mget(mgetDto); return new ElasticSearchDTO(result, result.getTotal()); } @GetMapping(value = "/resources") @ResponseBody public SuperDTO _search(@RequestParam(required = false, value = "fields") String[] fields, @RequestParam(required = false, value = "text") String text, @RequestParam(required = false, value = "from") Integer from, @RequestParam(required = false, value = "size") Integer size) { DataQueryDTO queryDTO = objectMapper.convertValue( ESService.createSimpleQueryDTOFromTextQueryParams(fields, text, from, size), DataQueryDTO.class); processQuery(queryDTO); JSONCollectionDTO result = ESService.find(queryDTO); return new ElasticSearchDTO(result, result.getTotal()); } } Loading
.gitlab-ci.yml +8 −20 Original line number Diff line number Diff line Loading @@ -54,10 +54,8 @@ variables: ELASTIC_ADDRESSES: docker OAUTH_SERVER: http://docker:8081 PROPERTY_USER_API: http://docker:8082 ELASTICSEARCH_IMAGE_NAME: registry.gitlab.com/redmic-project/elastic/elasticsearch/master ELASTICSEARCH_IMAGE_TAG: latest SCHEMA_ES_IMAGE_NAME: registry.gitlab.com/redmic-project/elastic/schema-es/master SCHEMA_ES_IMAGE_TAG: latest ELASTICSEARCH_IMAGE_NAME: docker.elastic.co/elasticsearch/elasticsearch ELASTICSEARCH_IMAGE_TAG: 6.6.2 ES_BOOTSTRAP_MEMORY_LOCK: 'true' OLD_ELASTIC_ADMIN_PASS: changeme ELASTIC_ADMIN_PASS: elastic_admin_pass Loading @@ -65,13 +63,12 @@ variables: ELASTIC_USER_PASS: elastic_user_pass ELASTIC_USER_ROLE: redmic_user ES_JAVA_OPTS: '-Xms512m -Xmx512m -Djava.security.policy=file:///usr/share/elasticsearch/config/grovy-classes_whitelist.policy' ES_CLUSTER_NAME: elasticsearch_dev ES_CLUSTER_NAME: es_dev ES_NODE_NAME: node-1 ES_DISCOVERY_ZEN_MINIMUM_MASTER_NODES: 1 ES_DISCOVERY_ZEN_PING_UNICAST_HOSTS: es-1 ES_XPACK_SECURITY_ENABLED: 'true' ELASTIC_HOSTS: es-1 ELASTIC_SCHEMA_VERSION: '0.1' ES_DISCOVERY_ZEN_PING_UNICAST_HOSTS: es6-1 ES_XPACK_SECURITY_ENABLED: 'false' ELASTIC_HOSTS: es6-1 GITLAB_REGISTRY_HOST: registry.gitlab.com CI_DEPLOY_USER: ci_deploy_user CI_DEPLOY_PASSWORD: ci_deploy_password Loading Loading @@ -167,7 +164,7 @@ variables: -U ${POSTGRES_USER} \ -c "ALTER ROLE ${SPRING_DATASOURCE_USERNAME} WITH PASSWORD '${SPRING_DATASOURCE_PASSWORD}'" - > docker run -d --rm --name es-1 \ docker run -d --rm --name es6-1 \ -p 9300:9300 \ -p 9200:9200 \ --network test \ Loading @@ -194,18 +191,9 @@ variables: echo "Waiting for elasticsearch server, remaining attempts... Last output:"; echo $RESPONSE; done - > docker login ${GITLAB_REGISTRY_HOST} -u ${CI_DEPLOY_USER} -p ${CI_DEPLOY_PASSWORD}; docker run --rm --name schema-es \ --network test \ -e ELASTIC_USER \ -e ELASTIC_USER_PASS \ -e ELASTIC_HOSTS \ -e ELASTIC_SCHEMA_VERSION \ ${SCHEMA_ES_IMAGE_NAME}:${SCHEMA_ES_IMAGE_TAG} after_script: - rm -rf .m2/repository/es - docker stop user oauth postgres es-1 - docker stop user oauth postgres es6-1 .docker-build: variables: Loading
deploy/docker-compose.tmpl.yml +4 −2 Original line number Diff line number Diff line Loading @@ -21,7 +21,9 @@ services: OAUTH_CLIENT_SECRET: AWS_ACCESS_KEY: AWS_SECRET_KEY: ELASTIC_XPACKSECURITYUSER: ELASTIC_CLUSTERNAME: ELASTIC_USER: ELASTIC_PASSWORD: JAVA_OPTS: -XX:MaxRAMFraction=2 networks: elastic-net: Loading Loading @@ -55,7 +57,7 @@ services: networks: elastic-net: name: ${ELASTIC_NET_NAME:-elastic-net} name: ${ELASTIC_NET_NAME:-elastic6-net} driver: ${ELASTIC_NET_DRIVER:-overlay} external: true Loading
pom.xml +31 −24 Original line number Diff line number Diff line Loading @@ -6,36 +6,37 @@ <parent> <groupId>es.redmic</groupId> <artifactId>server-parent</artifactId> <version>0.1.0</version> <version>0.3.0</version> <relativePath /> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>api</artifactId> <packaging>jar</packaging> <version>0.11.0</version> <version>0.11.0-feature-refactoring</version> <name>API</name> <description>RESTful web services</description> <properties> <!-- REDMIC --> <redmic.db.version>0.6.1-legacy-0.6</redmic.db.version> <redmic.elasticsearch.version>0.6.1-legacy-0.6</redmic.elasticsearch.version> <redmic.exceptions.version>0.6.0</redmic.exceptions.version> <redmic.utils.version>0.6.0</redmic.utils.version> <redmic.models.version>0.6.1-legacy-0.6</redmic.models.version> <redmic.db.version>0.7.0-feature-refactoring</redmic.db.version> <redmic.elasticsearch.version>0.8.0-feature-refactoring</redmic.elasticsearch.version> <redmic.exceptions.version>0.10.0</redmic.exceptions.version> <redmic.utils.version>0.10.0-feature-changeJtsVersion</redmic.utils.version> <redmic.models.version>0.12.0-feature-refactoring</redmic.models.version> <redmic.mediastorage.version>0.7.0</redmic.mediastorage.version> <redmic.sitemapgen4j.version>0.6.0</redmic.sitemapgen4j.version> <redmic.test-utils.version>0.6.0</redmic.test-utils.version> <redmic.test-utils.version>0.10.0-feature-refactoring</redmic.test-utils.version> <!-- OTHERS --> <orika-core.version>1.4.6</orika-core.version> <commons-fileupload>1.3.2</commons-fileupload> <powermock.version>1.7.3</powermock.version> <jackson-datatype-jts.version>1.0-2.7</jackson-datatype-jts.version> <orika-core.version>1.5.4</orika-core.version> <commons-fileupload>1.4</commons-fileupload> <powermock.version>2.0.9</powermock.version> <!-- Plugins --> <asciidoctor.maven.plugin.version>1.5.6</asciidoctor.maven.plugin.version> <asciidoctor.maven.plugin.version>2.1.0</asciidoctor.maven.plugin.version> </properties> <dependencies> Loading Loading @@ -109,6 +110,13 @@ <!-- Otros --> <dependency> <groupId>com.graphhopper.external</groupId> <artifactId>jackson-datatype-jts</artifactId> <version>${jackson-datatype-jts.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>ma.glasnost.orika</groupId> <artifactId>orika-core</artifactId> Loading @@ -126,23 +134,27 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-easymock</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>${powermock.version}</version> <scope>test</scope> </dependency> <!--test de documentación --> Loading @@ -158,23 +170,18 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <executable>true</executable> <finalName>api</finalName> <outputDirectory>dist</outputDirectory> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <reuseForks>false</reuseForks> <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> <includes> <include>**/Test*.java</include> <include>**/*Test.java</include> Loading
src/main/java/es/redmic/ApiApplication.java +2 −9 Original line number Diff line number Diff line Loading @@ -46,7 +46,6 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import es.redmic.api.common.converter.QueryDTOMessageConverter; import es.redmic.api.config.GenerateJsonSchemaScanBean; import es.redmic.api.config.OrikaScanBean; import es.redmic.api.config.ResourceBundleMessageSource; import es.redmic.databaselib.common.repository.BaseRepositoryImpl; import es.redmic.db.config.EntityManagerWrapper; Loading Loading @@ -81,12 +80,6 @@ public class ApiApplication { return new EntityManagerWrapper(); } @PostConstruct @Bean public OrikaScanBean orikaScanBean() { return new OrikaScanBean(); } @PostConstruct @Bean public GenerateJsonSchemaScanBean generateSchemaScanBean() { Loading
src/main/java/es/redmic/api/administrative/controller/ActivityController.java +23 −6 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; Loading Loading @@ -60,7 +62,7 @@ public class ActivityController super(service, serviceES); } @RequestMapping(value = "${contoller.mapping.ANCESTORS}/_search", method = RequestMethod.POST) @PostMapping(value = "${contoller.mapping.ANCESTORS}/_search") @ResponseBody public SuperDTO _getAncestors(@PathVariable("path") String path, HttpServletResponse response, @Valid @RequestBody DataQueryDTO queryDTO, BindingResult bindingResult) { Loading @@ -70,7 +72,7 @@ public class ActivityController String[] ancestorIds = HierarchicalUtils.getAncestorsIds(path); MgetDTO mgetDto = new MgetDTO(Arrays.asList(ancestorIds)); if (queryDTO.getReturnFields() != null && queryDTO.getReturnFields().size() > 0) { if (queryDTO.getReturnFields() != null && !queryDTO.getReturnFields().isEmpty()) { mgetDto.setFields(queryDTO.getReturnFields()); if (!mgetDto.getFields().contains("path")) { Loading @@ -81,4 +83,19 @@ public class ActivityController JSONCollectionDTO result = activityBaseESService.mget(mgetDto); return new ElasticSearchDTO(result, result.getTotal()); } @GetMapping(value = "/resources") @ResponseBody public SuperDTO _search(@RequestParam(required = false, value = "fields") String[] fields, @RequestParam(required = false, value = "text") String text, @RequestParam(required = false, value = "from") Integer from, @RequestParam(required = false, value = "size") Integer size) { DataQueryDTO queryDTO = objectMapper.convertValue( ESService.createSimpleQueryDTOFromTextQueryParams(fields, text, from, size), DataQueryDTO.class); processQuery(queryDTO); JSONCollectionDTO result = ESService.find(queryDTO); return new ElasticSearchDTO(result, result.getTotal()); } }