Skip to content

Commit

Permalink
Merge branch 'develop' into OP-1200-Wards-Inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
mwithi committed Nov 18, 2024
2 parents d602725 + ff3ee06 commit 0e2722b
Show file tree
Hide file tree
Showing 396 changed files with 17,705 additions and 7,748 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ logs
/rsc/
.idea/
.vscode/
*.iml
*.iml
/.env
777 changes: 399 additions & 378 deletions .ide-settings/eclipse/OpenHospital-Java-CodeStyle-Formatter.xml

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions .ide-settings/eclipse/OpenHospital.importorder
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#Organize Import Order
#Fri Jul 31 13:21:30 EDT 2020
5=
4=com
3=org
#Wed Mar 13 13:21:30 EDT 2024
6=
5=com
4=org
3=jakarta
2=javax
1=java
0=\#
28 changes: 26 additions & 2 deletions .ide-settings/idea/OpenHospital-code-style-configuration.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<code_scheme name="Open Hospital profile" version="173">
<code_scheme name="Open Hospital profile" version="174">
<option name="RIGHT_MARGIN" value="160" />
<option name="FORMATTER_TAGS_ENABLED" value="false" />
<JavaCodeStyleSettings>
<option name="SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
Expand All @@ -14,6 +16,8 @@
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="jakarta" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
Expand All @@ -23,22 +27,38 @@
<package name="" withSubpackages="true" static="false" />
</value>
</option>
<option name="ALIGN_MULTILINE_RECORDS" value="false" />
<option name="ALIGN_TYPES_IN_MULTI_CATCH" value="false" />
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
<option name="JD_ADD_BLANK_AFTER_DESCRIPTION" value="false" />
<option name="JD_P_AT_EMPTY_LINES" value="false" />
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
</JavaCodeStyleSettings>
<editorconfig>
<option name="ENABLED" value="false" />
</editorconfig>
<codeStyleSettings language="JAVA">
<option name="RIGHT_MARGIN" value="160" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_BETWEEN_PACKAGE_DECLARATION_AND_HEADER" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
<option name="BLANK_LINES_AFTER_CLASS_HEADER" value="1" />
<option name="BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER" value="1" />
<option name="INDENT_CASE_FROM_SWITCH" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
<option name="ALIGN_MULTILINE_FOR" value="false" />
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="RESOURCE_LIST_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
Expand All @@ -47,10 +67,14 @@
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="WRAP_COMMENTS" value="true" />
<option name="ASSERT_STATEMENT_COLON_ON_NEXT_LINE" value="true" />
<option name="VARIABLE_ANNOTATION_WRAP" value="2" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
117 changes: 0 additions & 117 deletions .mvn/wrapper/MavenWrapperDownloader.java

This file was deleted.

Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
20 changes: 10 additions & 10 deletions Dockerfile-ohdb
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM mariadb:10.6.11

ENV MYSQL_DATABASE=oh
ENV MYSQL_ROOT_PASSWORD=root
ENV MYSQL_USER=isf
ENV MYSQL_PASSWORD=isf123
ARG OH_DB_LANG=en

ENV MARIADB_DATABASE=oh
ENV MARIADB_ROOT_PASSWORD=root
ENV MARIADB_USER=isf
ENV MARIADB_PASSWORD=isf123

COPY sql/step_01_create_structure.sql /docker-entrypoint-initdb.d/
COPY sql/step_02_dump_menu.sql /docker-entrypoint-initdb.d/
COPY sql/step_03_dump_default_data_en.sql /docker-entrypoint-initdb.d/
COPY sql/step_03_dump_default_data_${OH_DB_LANG}.sql /docker-entrypoint-initdb.d/
#COPY sql/step_04_all_following_steps.sql /docker-entrypoint-initdb.d/
COPY sql/step_05_update_menu_i18n.sql /docker-entrypoint-initdb.d/
COPY sql/step_06_opd_extended.sql /docker-entrypoint-initdb.d/
Expand All @@ -24,8 +26,6 @@ COPY sql/step_7* /docker-entrypoint-initdb.d/
COPY sql/step_8* /docker-entrypoint-initdb.d/
COPY sql/step_9* /docker-entrypoint-initdb.d/
COPY sql/step_a1* /docker-entrypoint-initdb.d/
COPY sql/data_en/* data_en/
#COPY sql/data_es/* data_es/
#COPY sql/data_it/* data_it/
#COPY sql/data_pt/* data_pt/
#COPY sql/data_fr/* data_fr/
COPY sql/step_03_dump_vaccine_data_${OH_DB_LANG}.sql /docker-entrypoint-initdb.d/step_z100_dump_vaccine_data_${OH_DB_LANG}.sql
COPY sql/step_03_dump_dicomtype_data_${OH_DB_LANG}.sql /docker-entrypoint-initdb.d/step_z101_dump_dicomtype_data_${OH_DB_LANG}.sql
COPY sql/data_${OH_DB_LANG}/* data_${OH_DB_LANG}/
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,44 @@ To run the tests simply issue:

Note: tests are run against an in-memory database (H2).

To run tests against a MariaDB instance:
To run tests against a MariaDB instance, see [How to run DB with Docker](#how-to-run-db-with-docker)

you can change [`src/test/resources/resources/database.properties`][database.prop]
Then you can change [`src/test/resources/resources/database.properties`][database.prop]

From:

jdbc.class=org.h2.Driver
jdbc.url=jdbc:h2:mem:myDb;MODE=MySQL;IGNORECASE=TRUE;DB_CLOSE_DELAY=-1

...
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.hbm2ddl.auto=update
jdbc.username=root
jdbc.password=root

To:
To: (use .env variables):

jdbc.url=jdbc:mysql://localhost:[OH_MARIADB_PORT]/[OH_MARIADB_DATABASE]
jdbc.username=[OH_MARIADB_USER]
jdbc.password=[OH_MARIADB_PASSWORD]


jdbc.url=jdbc:mysql://localhost:3306/oh
jdbc.username=isf
jdbc.password=isf123
## How to run DB with Docker

Then, run the Docker container in the root folder with:
Copy `dotenv` into `.env` and set parameters as needed, otherwise defaults will be used:

OH_MARIADB_DATABASE=oh
OH_MARIADB_ROOT_PASSWORD=root
OH_MARIADB_USER=isf
OH_MARIADB_PASSWORD=isf123
OH_MARIADB_PORT=3306
OH_DB_LANG=en # refer to sql/data_xx/ folders

Clean previous builds:

# clean previous builds
docker compose rm --stop --volumes --force

# build and run a mariadb instance at localhost:3306
Build and run a mariadb instance at `localhost:[OH_MARIADB_PORT]`:

docker-compose up


Expand Down
27 changes: 17 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
version: '3'
services:
database:
build:
context: ./
dockerfile: Dockerfile-ohdb
image: oh-core_database:latest
ports:
- "3306:3306"
command: mysqld --sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" --lower_case_table_names=1
version: '3'
services:
database:
build:
context: ./
dockerfile: Dockerfile-ohdb
args:
OH_DB_LANG: ${OH_DB_LANG}
image: oh-core_database:latest
ports:
- "${OH_MARIADB_PORT}:3306"
command: mysqld --sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" --lower_case_table_names=1 --explicit_defaults_for_timestamp=OFF
environment:
MARIADB_DATABASE: ${OH_MARIADB_DATABASE}
MARIADB_ROOT_PASSWORD: ${OH_MARIADB_ROOT_PASSWORD}
MARIADB_USER: ${OH_MARIADB_USER}
MARIADB_PASSWORD: ${OH_MARIADB_PASSWORD}
6 changes: 6 additions & 0 deletions dotenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
OH_MARIADB_DATABASE=oh
OH_MARIADB_ROOT_PASSWORD=root
OH_MARIADB_USER=isf
OH_MARIADB_PASSWORD=isf123
OH_MARIADB_PORT=3306
OH_DB_LANG=en
Loading

0 comments on commit 0e2722b

Please sign in to comment.