diff --git a/README.md b/README.md index 0b46c7b580497558412505ca12353726cf09a22b..8d4f754d84bede792097af32919155c1c8182d62 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,12 @@ The purpose of Naming is to handle Naming of ESS wide physical and logical devic Naming backend is a web application implemented as a REST style web service backed by a relational database. The web service is implemented as a Spring Boot application and the database is available as PostgreSQL. -Background and motivation, application and database design, and more, is available through content in docs folder. +See `docs` and sub folders to learn how ESS Naming Convention is implemented in Naming backend +* what an ESS name is and how to think about it (to better understand how to work with it) +* concept & terminology +* application & database, architecture & design +* flow of code +* user & developer perspectives ### Environment @@ -14,7 +19,7 @@ Tools * Java 17 (openjdk) * Maven 3.8+ (e.g. 3.8.5) * PostgreSQL (9.6 client lib) -* Docker (docker, docker-compose) +* Docker (docker engine 18.06.0+, docker compose, compose file version 3.7) * Git Dependencies @@ -71,11 +76,15 @@ Thereafter a number of http requests (GET) and curl commands (POST, PUT, PATCH, * See `src/test/resources` and sub folders for database scripts. This includes scripts for database schema, migration and example content. * If no prior database is available, see integration tests for examples on how to populate database. E.g. tests may be debugged and database content may be examined at any debug point. It's possible to backup database at such debug point and later restore it outside test. In such way, database may be set to state of choice. + ``` + postgres: + volumes: + - ./src/test/resources/db/data/dump-discs_names_namesit.sql:/docker-entrypoint-initdb.d/dump-discs_names_namesit.sql + ``` +* `application.properties` available in both ´src/main/resources´ and `src/test/resources`. Key difference is that in-memory database is used in test. + #### Recommentation -* See `docs` and sub folders to learn how ESS Naming Convention is implemented in Naming backend - * what an ESS name is and how to think about it (to better understand how to work with it) - * concept & terminology - * application architecture - * flow of code -* Have local docker-compose file for database alone if there is need to backup or restore database +* Have local docker-compose files + * for application and database together that may contain local configuration + * for database alone if there is need to backup or restore database diff --git a/docs/about/naming_architecture_code.odt b/docs/about/naming_architecture_code.odt index 345f0fde2d01b36f7974c9ee269c400b52440293..c86e810ba3a9effb355542c85546cd5bd869d1a7 100644 Binary files a/docs/about/naming_architecture_code.odt and b/docs/about/naming_architecture_code.odt differ diff --git a/docs/about/naming_architecture_code.pdf b/docs/about/naming_architecture_code.pdf index 2db2b12b00b82a45f2d022afa3defd0654543dec..f9c2b73596749c9c0208cf4f6ec247e97a792ccc 100644 Binary files a/docs/about/naming_architecture_code.pdf and b/docs/about/naming_architecture_code.pdf differ diff --git a/docs/about/naming_rest_api_brief_introduction.odt b/docs/about/naming_rest_api_brief_introduction.odt index 8014a1ab04303501283203a15e0da9312e35075e..62346894edc53eaeefb43fa4aecbf94dadff6f34 100644 Binary files a/docs/about/naming_rest_api_brief_introduction.odt and b/docs/about/naming_rest_api_brief_introduction.odt differ diff --git a/docs/about/naming_rest_api_brief_introduction.pdf b/docs/about/naming_rest_api_brief_introduction.pdf index 990d84570ecb9335f01e948a4941887ceb0e0cfd..2bdbb35f38202f3653e9877c8522daf0aae70e78 100644 Binary files a/docs/about/naming_rest_api_brief_introduction.pdf and b/docs/about/naming_rest_api_brief_introduction.pdf differ diff --git a/docs/about/naming_rest_api_excel_guide.odt b/docs/about/naming_rest_api_excel_guide.odt index d525c7598815ee96991cd01b223531bc3f7b9755..f08b8278d6f7a15e93b493bb15bd989f6e664878 100644 Binary files a/docs/about/naming_rest_api_excel_guide.odt and b/docs/about/naming_rest_api_excel_guide.odt differ diff --git a/docs/about/naming_rest_api_excel_guide.pdf b/docs/about/naming_rest_api_excel_guide.pdf index de14d3db2a40cc2aa7bd37cbd9c65207696e751f..ff4d75d11f6ca37c9900085ee57b00cde9d90335 100644 Binary files a/docs/about/naming_rest_api_excel_guide.pdf and b/docs/about/naming_rest_api_excel_guide.pdf differ diff --git a/pom.xml b/pom.xml index 612761c31b590bf291019b1046a4dcbd42ec08b1..3dbd1502a980e64e724ce9a9c7b8182b52ea6cf8 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,11 @@ <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers</artifactId> diff --git a/src/main/java/org/openepics/names/rest/api/v1/INames.java b/src/main/java/org/openepics/names/rest/api/v1/INames.java index 9fae34417541458d3c0c381a436024e05a12a992..99f43f27bf6c455e9c129482258b9f139082ea9d 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/INames.java +++ b/src/main/java/org/openepics/names/rest/api/v1/INames.java @@ -662,7 +662,10 @@ public interface INames { */ @Operation( summary = "Return if name exists (exact match)", - description = "Return if name exists (exact match)." + description = """ + Return if name exists (exact match). + Response is true if name exists, false otherwise. + """ ) @ApiResponses(value = { @ApiResponse( diff --git a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java index cec024e9ecf672c748952ec861775eb95075eb9a..62914b8e09a76537bdfd4442f747ecfb753d2b0d 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java +++ b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java @@ -722,7 +722,7 @@ public interface IStructures { summary = "Return if mnemonic path exists in structure (exact match)", description = """ Return if mnemonic path exists in structure (exact match). - Returned object has three fields (message, details, response). + Response is true if mnemonic path exists, false otherwise. """ ) @ApiResponses(value = { diff --git a/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf b/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf index 990d84570ecb9335f01e948a4941887ceb0e0cfd..2bdbb35f38202f3653e9877c8522daf0aae70e78 100644 Binary files a/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf and b/src/main/resources/static/pdfs/naming_rest_api_brief_introduction.pdf differ diff --git a/src/main/resources/static/pdfs/naming_rest_api_excel_guide.pdf b/src/main/resources/static/pdfs/naming_rest_api_excel_guide.pdf index de14d3db2a40cc2aa7bd37cbd9c65207696e751f..ff4d75d11f6ca37c9900085ee57b00cde9d90335 100644 Binary files a/src/main/resources/static/pdfs/naming_rest_api_excel_guide.pdf and b/src/main/resources/static/pdfs/naming_rest_api_excel_guide.pdf differ diff --git a/src/test/java/org/openepics/names/NamingApplicationTests.java b/src/test/java/org/openepics/names/NamingApplicationTests.java index 41db8057b9ddc666d58e735bbce547915571a582..a678143ef6815eb685c9a20cba23e79f8ecb3a41 100644 --- a/src/test/java/org/openepics/names/NamingApplicationTests.java +++ b/src/test/java/org/openepics/names/NamingApplicationTests.java @@ -24,8 +24,8 @@ import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class NamingApplicationTests { - @Test - void contextLoads() { - } + @Test + void contextLoads() { + } } diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties new file mode 100644 index 0000000000000000000000000000000000000000..7ef268cd5f6e39ba2b8d57bc62677d8c0d9d2214 --- /dev/null +++ b/src/test/resources/application.properties @@ -0,0 +1,58 @@ +# ------------------------------------------------------------------------------ +# Naming +# ------------------------------------------------------------------------------ + +# server +# port +server.port=8083 + +# logging +naming.logging.stacktrace.length=10 +logging.level.org.openepics.names=INFO +logging.level.org.springframework.web=INFO +spring.http.log-request-details=true + +# spring +# profiles +# config +# datasource +# jpa +spring.profiles.active=@spring.profiles.active@ + +spring.config.import=optional:file:.env[.properties] + +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1 +spring.datasource.username=sa +spring.datasource.password=sa + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.jpa.hibernate.ddl-auto=none +spring.jpa.hibernate.show-sql=true + +# open api, swagger ui +# doc +app.version=0.0.1-SNAPSHOT +openapi.externaldocs.description=ESS Naming Convention +openapi.externaldocs.url=https://chess.esss.lu.se/enovia/link/ESS-0000757/21308.51166.45568.45993/valid +openapi.info.contact.email=Icsscontrolsystemsupport@ess.eu +openapi.info.contact.name=Support +openapi.info.contact.url=https://jira.esss.lu.se/projects/NT/issues +openapi.info.description=\ + Perform Naming tasks Create Read Update Delete + Approve Cancel Reject \n\n \ + Here are some useful links \n \ + - [Naming](https://confluence.esss.lu.se/display/SW/Naming+Tool%2C+Cable+DB%2C+CCDB%2C+IOC+Factory%2C+RBAC) in ICS Software toolchain \n \ + - [Introduction to Naming REST API](/pdfs/naming_rest_api_brief_introduction.pdf) + [Cheat Sheet](/pdfs/naming_rest_api_cheat_sheet.pdf) \n \ + - [How to use](/pdfs/naming_rest_api_excel_guide.pdf) Excel templates for [names](/templates/NameElementCommand.xlsx) + [structures](/templates/StructureElementCommand.xlsx) \n\n \ + Note \n \ + - Observe which fields to use for operations client to server. \n \ + - Obsolete values are not shown unless history is requested. \n \ + - Regular expressions are not supported for searches. Regex-like behavior is available with _ underscore, 0 or 1 occurrences of any character, % percent, any number of any character. +openapi.info.license.name=Copyright (C) 2022 European Spallation Source ERIC. +openapi.info.title=Naming REST API + + +# ------------------------------------------------------------------------------ +# Note +# ------------------------------------------------------------------------------ +# use of in-memory database