diff --git a/docker/build-scripts/gs-generate-pg-dump.bat b/docker/build-scripts/gs-generate-pg-dump.bat index 2247a935e..88a0c4140 100644 --- a/docker/build-scripts/gs-generate-pg-dump.bat +++ b/docker/build-scripts/gs-generate-pg-dump.bat @@ -23,7 +23,7 @@ REM run DUMP script type DumpDatabase.sql | docker exec -i dev-postgres su postgres REM kill 'em -docker-compose -p pg-dump -f create-database.yml down --rmi local -v +docker compose -p pg-dump -f create-database.yml down --rmi local -v REM return back to original dir popd diff --git a/docker/build-scripts/gs-generate-pg-dump.sh b/docker/build-scripts/gs-generate-pg-dump.sh index 463115df8..0e7282935 100755 --- a/docker/build-scripts/gs-generate-pg-dump.sh +++ b/docker/build-scripts/gs-generate-pg-dump.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash docker network create ars-int @@ -12,7 +12,8 @@ docker compose -p pg-dump -f create-database.yml build --no-cache docker compose -p pg-dump -f create-database.yml up -d # store IP of host in order to use it for db import later on -ip4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) +ip4=$(/sbin/ip -o -4 addr list | awk '!/ lo / {print $4; exit}' | cut -d/ -f1) +echo "Connecting to PG_LOAD_SERVER: $ip4" # 2. run application component (inside separate component as well) - this is the component that is being built # this will actually initialize the database, without running the component diff --git a/framework/build.gradle b/framework/build.gradle index d8d9d62f1..04cfd59c5 100644 --- a/framework/build.gradle +++ b/framework/build.gradle @@ -274,7 +274,7 @@ test { systemProperty 'moqui.runtime', '../runtime' systemProperty 'moqui.conf', 'conf/MoquiDevConf.xml' systemProperty 'moqui.init.static', 'true' - systemProperty 'moqui.log.directory', projectDir.absolutePath + '/../runtime/' + logDir + systemProperty 'moqui.log.directory', projectDir.absolutePath + '/runtime/' + logDir classpath += files(sourceSets.main.output.classesDirs); classpath += files(projectDir.absolutePath) // filter out classpath entries that don't exist (gradle adds a bunch of these), or ElasticSearch JarHell will blow up diff --git a/framework/src/main/groovy/org/moqui/impl/entity/EntityDbMeta.groovy b/framework/src/main/groovy/org/moqui/impl/entity/EntityDbMeta.groovy index b5e1a6191..f84377027 100644 --- a/framework/src/main/groovy/org/moqui/impl/entity/EntityDbMeta.groovy +++ b/framework/src/main/groovy/org/moqui/impl/entity/EntityDbMeta.groovy @@ -469,10 +469,13 @@ class EntityDbMeta { boolean tableExists(EntityDefinition ed) { def performDbCheck = ed.isMultipleInstanceEntity + Boolean exists = entityTablesExist.get(ed.getFullEntityName()) + // if table exists in `entityTableExist` + if (exists && performDbCheck) return true + // check in database for special entities if (performDbCheck) return tableExistsInternal(ed) - Boolean exists = entityTablesExist.get(ed.getFullEntityName()) if (exists != null) return exists.booleanValue() return tableExistsInternal(ed) diff --git a/framework/src/main/groovy/org/moqui/impl/entity/EntityFacadeImpl.groovy b/framework/src/main/groovy/org/moqui/impl/entity/EntityFacadeImpl.groovy index 81ee0daff..8d97186c6 100644 --- a/framework/src/main/groovy/org/moqui/impl/entity/EntityFacadeImpl.groovy +++ b/framework/src/main/groovy/org/moqui/impl/entity/EntityFacadeImpl.groovy @@ -856,12 +856,18 @@ class EntityFacadeImpl implements EntityFacade { this.setDynamicRelationships(entityNode, entitySuffix) } - // support for handling entities with set `table_name` + // support for handling entities with set `table-name` + // if `table-name` is not set, use {internal entity name} + {suffix} def tableNameSet = entityNode.attribute("table-name") if (tableNameSet){ - tableNameSet = "${tableNameSet}_${EntityJavaUtil.camelCaseToUnderscored(entitySuffix)}".toString() - entityNode.attributes.replace("table-name", tableNameSet) + tableNameSet = "${tableNameSet}_${entitySuffix.toLowerCase()}".toString() + } else { + def internalEntityName = entityNode.attribute("entity-name") + tableNameSet = "${EntityJavaUtil.camelCaseToUnderscored(internalEntityName)}_${entitySuffix.toLowerCase()}".toString() } + // set table-name + entityNode.attributes.replace("table-name", tableNameSet) + // log logger.debug("Loading special entity ${specialEntityName}.") } diff --git a/framework/src/main/resources/log4j2.xml b/framework/src/main/resources/log4j2.xml deleted file mode 100644 index b1cade5a1..000000000 --- a/framework/src/main/resources/log4j2.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - moqui_logs - ../runtime/log - info - info - info - - true - info - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/framework/src/test/groovy/UtilsTests.groovy b/framework/src/test/groovy/UtilsTests.groovy index 8de17a0f9..3421e6235 100644 --- a/framework/src/test/groovy/UtilsTests.groovy +++ b/framework/src/test/groovy/UtilsTests.groovy @@ -10,6 +10,7 @@ import org.moqui.impl.ViUtilities import org.moqui.impl.context.ExecutionContextFactoryImpl import org.moqui.impl.entity.EntityConditionFactoryImpl import org.moqui.impl.entity.EntityDefinition +import org.moqui.impl.entity.EntityJavaUtil import org.moqui.impl.entity.condition.ConditionField import org.moqui.util.CollectionUtilities import org.moqui.util.MNode @@ -47,6 +48,19 @@ class UtilsTests extends Specification { 1 == 1 } + def test_camelCase_conversion() { + when: + + // IT IS NOT FEASIBLE TO TRANSFORM `camelCaseToUnderscored` method to cover specifically + // cases of ClosureItem tables, this functionality has been moved aside + // def str1 = EntityJavaUtil.camelCaseToUnderscored('cl_i_out_entsoe_report_01__CZ12345678') + def str2 = EntityJavaUtil.camelCaseToUnderscored('entsoe_report_01_C_12345678') + + then: + // str1 == 'CL_I_OUT_ENTSOE_REPORT_01__CZ12345678' + str2 == 'ENTSOE_REPORT_01__C_12345678' + } + def test_comma_splitting() { when: