diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b66228c7..9ec19d859 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,18 +1,18 @@ version: 2.1 orbs: - node: circleci/node@1.1.6 + docker: circleci/docker@2.1.1 executors: - openjdk_executor: - docker: - - image: circleci/openjdk:11.0.8-jdk - environment: - _JAVA_OPTIONS: "-Xmx3g" - GRADLE_OPTS: "-Dorg.gradle.daemon=false" + openjdk_executor: + docker: + - image: cimg/openjdk:17.0.3 + environment: + _JAVA_OPTIONS: "-Xmx3g" + GRADLE_OPTS: "-Dorg.gradle.daemon=false" jobs: build_and_test: executor: - name: node/default + name: docker/docker working_directory: /home/circleci/mms steps: - checkout @@ -23,7 +23,7 @@ jobs: name: "Create and start all services from the docker-compose configuration" command: | cp example/src/main/resources/application.properties.example ./example/src/main/resources/application.properties - docker-compose up -d + docker-compose up --build -d docker run --network container:mms curlimages/curl --retry 8 --retry-delay 10 --retry-max-time 90 --retry-connrefused http://mms:8080/healthcheck - run: diff --git a/Dockerfile b/Dockerfile index 861eeb446..e027f83cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM openjdk:11-jdk-slim +FROM openjdk:17.0.2-slim as build COPY . /mms WORKDIR /mms -RUN ./gradlew --no-daemon bootJar +RUN ./gradlew --no-daemon bootJar --warning-mode all RUN find . -type f -name example-*.jar -not -iname '*javadoc*' -not -iname '*sources*' -exec cp '{}' '/app.jar' ';' ENV JDK_JAVA_OPTIONS "-XX:MaxRAMPercentage=90.0" diff --git a/README.rst b/README.rst index 8397f2ae4..446e42f2a 100644 --- a/README.rst +++ b/README.rst @@ -29,10 +29,10 @@ Docker We suggest using Docker to set up PostgreSQL and Elasticsearch. Installation instructions are found here: `Docker documentation `_ -Java SE Development Kit 11 +Java SE Development Kit 17 ^^^^^^^^^^^^^^^^^^^^^^^^^^ -Installation instructions: `JDK-11 download `_ +Installation instructions: `JDK-17 download `_ Postgresql ^^^^^^^^^^ diff --git a/build.gradle b/build.gradle index 2a58cb3eb..6dc76ae86 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ description = 'Model Management System Reference Implementation' ext { commonDependencies = [ 'swagger-annotations' : 'io.swagger.core.v3:swagger-annotations:2.1.2', - 'hibernate-core' : 'org.hibernate:hibernate-core:5.4.14.Final', + 'hibernate-core' : 'org.hibernate:hibernate-core:5.6.0.Final', 'servlet-api' : 'javax.servlet:javax.servlet-api:4.0.1', 'slf4j-api' : 'org.slf4j:slf4j-api:1.7.30', 'spring-boot' : "org.springframework.boot:spring-boot:$springBootVersion", diff --git a/docker-compose.yml b/docker-compose.yml index 625d7bd68..2c15227ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,7 +19,7 @@ services: - 9300:9300 minio: - image: minio/minio:latest + image: minio/minio:RELEASE.2022-05-26T05-48-41Z.hotfix.15f13935a environment: - "MINIO_ACCESS_KEY=admintest" - "MINIO_SECRET_KEY=admintest" diff --git a/elastic/src/main/java/org/openmbee/mms/elastic/services/SearchConfiguration.java b/elastic/src/main/java/org/openmbee/mms/elastic/services/SearchConfiguration.java index 3319c1174..860a0b165 100644 --- a/elastic/src/main/java/org/openmbee/mms/elastic/services/SearchConfiguration.java +++ b/elastic/src/main/java/org/openmbee/mms/elastic/services/SearchConfiguration.java @@ -54,7 +54,11 @@ public BoolQueryBuilder addQueryForField(BoolQueryBuilder query, String field, O } break; case MATCH: - query.must(QueryBuilders.matchQuery(field, value)); + if (value instanceof List) { + query.must(QueryBuilders.matchQuery(field, ((List)value).get(0))); + } else { + query.must(QueryBuilders.matchQuery(field, value)); + } break; default: break; diff --git a/example/example.gradle b/example/example.gradle index 87b646db8..bc279fa9e 100644 --- a/example/example.gradle +++ b/example/example.gradle @@ -45,4 +45,7 @@ configurations { it.outgoing.artifact(bootJar) } } +bootJar { + duplicatesStrategy = DuplicatesStrategy.INCLUDE +} ext['elasticsearch.version'] = "$elasticVersion" diff --git a/example/search.postman_collection.json b/example/search.postman_collection.json index 80fd5efe7..5ae64dc4d 100644 --- a/example/search.postman_collection.json +++ b/example/search.postman_collection.json @@ -1,8 +1,9 @@ { "info": { - "_postman_id": "1ca92623-8c37-47d1-8d35-5684f4a0cdb8", + "_postman_id": "34257752-6305-4dae-b6d8-b71fa98b9963", "name": "search", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "7302261" }, "item": [ { @@ -11,7 +12,6 @@ { "listen": "test", "script": { - "id": "217210a9-1489-4057-b89f-bc0b44111569", "exec": [ "", "pm.test(\"Status code is 200\", function () {", @@ -67,7 +67,6 @@ { "listen": "test", "script": { - "id": "10fb6974-d6a5-4c9f-a4d8-1fc0c6739c33", "exec": [ "pm.test(\"response has org s\", function () {", " var jsonData = pm.response.json();", @@ -109,7 +108,6 @@ { "listen": "test", "script": { - "id": "db56bdc2-e7bb-49af-9a7e-93359c7c1fd5", "exec": [ "pm.test(\"response has project ss\", function () {", " var jsonData = pm.response.json();", @@ -151,7 +149,6 @@ { "listen": "test", "script": { - "id": "f23976f1-afb8-495f-892a-dcbcc7360665", "exec": [ "pm.test(\"response has elements\", function () {", " var jsonData = pm.response.json();", @@ -199,7 +196,6 @@ { "listen": "test", "script": { - "id": "4ea3441a-8a0f-421a-ba27-67ac1351775d", "exec": [ "pm.test(\"response has 1 element\", function () {", " var jsonData = pm.response.json();", @@ -241,7 +237,6 @@ { "listen": "test", "script": { - "id": "4ea3441a-8a0f-421a-ba27-67ac1351775d", "exec": [ "pm.test(\"response has 2 elements\", function () {", " var jsonData = pm.response.json();", @@ -288,7 +283,6 @@ { "listen": "test", "script": { - "id": "c59583b1-35e6-4c27-8aaf-b9dbc98c1b13", "exec": [ "pm.test(\"response has 1 elements\", function () {", " var jsonData = pm.response.json();", @@ -337,7 +331,6 @@ { "listen": "test", "script": { - "id": "4ea3441a-8a0f-421a-ba27-67ac1351775d", "exec": [ "pm.test(\"response has 0 elements\", function () {", " var jsonData = pm.response.json();", @@ -372,6 +365,47 @@ } }, "response": [] + }, + { + "name": "search for name a", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"response has 1 element\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.elements.length).to.eql(1);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{host}}/projects/ss/refs/master/search?name=a", + "host": [ + "{{host}}" + ], + "path": [ + "projects", + "ss", + "refs", + "master", + "search" + ], + "query": [ + { + "key": "name", + "value": "a" + } + ] + } + }, + "response": [] } ], "auth": { @@ -388,7 +422,6 @@ { "listen": "prerequest", "script": { - "id": "a38d93e6-1de5-4875-8f80-a5a6cec3dcd4", "type": "text/javascript", "exec": [ "" @@ -398,13 +431,11 @@ { "listen": "test", "script": { - "id": "0866a69c-ea90-48f6-bedf-269b559b40d8", "type": "text/javascript", "exec": [ "" ] } } - ], - "protocolProfileBehavior": {} + ] } \ No newline at end of file diff --git a/example/src/main/java/org/openmbee/mms/example/config/ExampleSecurityConfig.java b/example/src/main/java/org/openmbee/mms/example/config/ExampleSecurityConfig.java index c0cd41795..ac7f771a1 100644 --- a/example/src/main/java/org/openmbee/mms/example/config/ExampleSecurityConfig.java +++ b/example/src/main/java/org/openmbee/mms/example/config/ExampleSecurityConfig.java @@ -29,8 +29,7 @@ @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableTransactionManagement @EnableAsync -public class ExampleSecurityConfig extends WebSecurityConfigurerAdapter implements - WebMvcConfigurer { +public class ExampleSecurityConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer { @Autowired AuthSecurityConfig authSecurityConfig; diff --git a/example/src/main/resources/application-test.properties b/example/src/main/resources/application-test.properties index 8ef8e22f6..2a9b572e1 100644 --- a/example/src/main/resources/application-test.properties +++ b/example/src/main/resources/application-test.properties @@ -31,7 +31,7 @@ spring.datasource.username=mmsuser spring.datasource.password=test1234 spring.datasource.driver-class-name=org.postgresql.Driver #spring.datasource.driver-class-name=com.mysql.jdbc.Driver -spring.datasource.initialization-mode=always +spring.sql.init.mode=always # The SQL dialect makes Hibernate generate better SQL for the chosen database spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL10Dialect @@ -44,6 +44,8 @@ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true spring.jpa.open-in-view=false spring.main.allow-bean-definition-overriding=true +spring.main.allow-circular-references=true +spring.mvc.pathmatch.matching-strategy=ant_path_matcher #Configuration for Elasticsearch elasticsearch.host=elasticsearch diff --git a/example/src/main/resources/application.properties.example b/example/src/main/resources/application.properties.example index 234fcd9ce..339250a5f 100644 --- a/example/src/main/resources/application.properties.example +++ b/example/src/main/resources/application.properties.example @@ -44,6 +44,8 @@ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true spring.jpa.open-in-view=false spring.main.allow-bean-definition-overriding=true +spring.main.allow-circular-references=true +spring.mvc.pathmatch.matching-strategy=ant_path_matcher #Configuration for Elasticsearch elasticsearch.host=localhost diff --git a/gradle.properties b/gradle.properties index 6e7ed6e40..8be66ab85 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ -version=4.0.7 +version=4.0.8 group=org.openmbee.mms -springBootVersion=2.2.6.RELEASE -springFrameworkVersion=5.2.5.RELEASE -springSecurityVersion=5.3.1.RELEASE -springDataVersion=2.2.6.RELEASE -jacksonVersion=2.10.3 -elasticVersion=7.8.1 +springBootVersion=2.6.7 +springFrameworkVersion=5.3.20 +springSecurityVersion=5.7.0 +springDataVersion=2.7.0 +jacksonVersion=2.13.3 +elasticVersion=7.8.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2..41d9927a4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a254..aa991fcea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists