Skip to content

Commit

Permalink
Merge branch '2023.06.x'
Browse files Browse the repository at this point in the history
* 2023.06.x:
  MCR-2647 update database configuration (#935)
  enable docker builds for version 2023.06 in github workflow
  Bump ckeditor-wordcount-plugin from 1.17.6 to 1.17.12 in /mir-module
  MCR-3010 Duplicate warnings about old absolute include mechanism congest logs  (#936)
  MIR-1241 Response mir facets should be dynamic (#901)
  Sort pom (#937)
  MCR-2647 fix db config
  updates LICENSE.txt due to plugin updates
  MIR-1231 Expect dates in ISO8601 to be in ISO8601 basic format.
  MIR-1257 sort 'register PI' menu entries
  MIR-1226 rework subject editor (#885)
  MIR-1248 check if @valueURI contains # - is a classification accordingly
  MIR-1251 add support for arbitrary classification facets w/o the need for specialized SOLR fields
  MIR-1254 optionally allow HTML content in validateion messages
  MIR-1231 Expect dates in ISO8601 to be in ISO8601 basic format. Allow to depict intervalls in that format too. No timezones are supported.
  MIR-1250 Set q.alt parameter on /find request handler (#914)
  MCR-2647 update to hibernate 6.3 and H2 2.2 (#907)
  MCR-2966 move Saxon ready stylesheets to /xslt
  • Loading branch information
yagee-de committed Dec 21, 2023
2 parents dd5cbe6 + d1e3383 commit 983bad4
Show file tree
Hide file tree
Showing 123 changed files with 18,706 additions and 4,088 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ jobs:
export FIREFOX_BIN=$(which firefox-esr)
export SELENIUM_BROWSER=firefox
mvn -B -P!standard-with-extra-repos -Djetty clean install
mvn -B -P!standard-with-extra-repos -U -Djetty clean install
mvn -P!standard-with-extra-repos -B javadoc:javadoc
- name: Login to Docker Hub
if: contains('refs/heads/2022.06.x refs/heads/main', github.ref) && github.event_name=='push' && success()
if: contains('refs/heads/2022.06.x refs/heads/2023.06.x refs/heads/main', github.ref) && github.event_name=='push' && success()
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the mir Docker images and push them
if: contains('refs/heads/2022.06.x refs/heads/main', github.ref) && github.event_name=='push' && success()
if: contains('refs/heads/2022.06.x refs/heads/2023.06.x refs/heads/main', github.ref) && github.event_name=='push' && success()
run: |
docker build . --file Dockerfile --tag mycoreorg/mir:${GITHUB_REF_NAME}
docker build mir-webapp/src/main/solr/ --file mir-webapp/src/main/solr/Dockerfile --tag mycoreorg/mir-solr:${GITHUB_REF_NAME}
Expand Down
8 changes: 4 additions & 4 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
75 changes: 61 additions & 14 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,56 @@ function downloadDriver {
fi
}

function migrateC3P0toHikari {
# check if c3p0 is used (if any c3p0-* file present)
if ls "${MCR_CONFIG_DIR}lib/c3p0-"*.jar 1> /dev/null 2>&1; then
echo "Migrate from c3p0 to HikariCP"
# delete old c3p0 drivers
rm "${MCR_CONFIG_DIR}lib/c3p0-"*.jar
rm "${MCR_CONFIG_DIR}lib/mchange-commons-java-"*.jar
rm "${MCR_CONFIG_DIR}lib/hibernate-c3p0-"*.jar

# delete old database drivers
rm "${MCR_CONFIG_DIR}lib/postgresql-42.2.9.jar"
rm "${MCR_CONFIG_DIR}lib/mariadb-java-client-2.5.4.jar"
rm "${MCR_CONFIG_DIR}lib/h2-1.4.200.jar"
rm "${MCR_CONFIG_DIR}lib/mysql-connector-java-8.0.19.jar"

# delete old configuration and add new configuration
if grep -q "hibernate.c3p0" "${PERSISTENCE_XML}"; then
sed -ri "s/.*hibernate.c3p0.*//" "${PERSISTENCE_XML}"
sed -ri "s/(<property name=\"hibernate.connection.provider_class\" value=\")(.*)(\" \/>)/\1org.hibernate.hikaricp.internal.HikariCPConnectionProvider\3/" "${PERSISTENCE_XML}"
sed -ri "s/(<\/properties>)/<property name=\"hibernate.hikari.maximumPoolSize\" value=\"30\" \/>\n<property name=\"hibernate.hikari.minimumIdle\" value=\"2\" \/>\n<property name=\"hibernate.hikari.idleTimeout\" value=\"30000\" \/>\n<property name=\"hibernate.hikari.maxLifetime\" value=\"1800000\" \/>\n<property name=\"hibernate.hikari.leakDetectionThreshold\" value=\"9000\" \/>\n<property name=\"hibernate.hikari.registerMbeans\" value=\"true\" \/>\n\1/" "${PERSISTENCE_XML}"
fi

/opt/mir/mir/bin/mir.sh reload mappings in jpa configuration file
else
echo "No c3p0 driver found. Skip migration."
fi
}

function migrateJavaxPropertiesToJakarta() {
if grep -q "javax.persistence" "${PERSISTENCE_XML}"; then
echo "Migrate properties in persistence.xml from javax to jakarta"
sed -ri "s/(<property name=\")javax.persistence(.*\" value=\".*\" \/>)/\1jakarta.persistence\2/" "${PERSISTENCE_XML}"
fi
if grep -q "xmlns.jcp.org" "${PERSISTENCE_XML}"; then
echo "Migrate xmlns in persistence.xml from jcp.org to jakarta.ee"
sed -ri "s/xmlns=\".+persistence\"/xmlns=\"https:\/\/jakarta.ee\/xml\/ns\/persistence\"/" "${PERSISTENCE_XML}"
echo "Migrate schemaLocation in persistence.xml from jcp.org to jakarta.ee"
grep -ri "s/(xsi:schemaLocation=\").*jcp.org.*(\")/\1https:\/\/jakarta.ee\/xml\/ns\/persistence https:\/\/jakarta.ee\/xml\/ns\/persistence\/persistence_3_0.xsd\2/" "${PERSISTENCE_XML}"
fi
if grep -q "version=\"2" "${PERSISTENCE_XML}"; then
echo "Migrate version in persistence.xml from 2.* to 3.0"
sed -ri "s/version=\"2.*\"/version=\"3.0\"/" "${PERSISTENCE_XML}"
fi
}

function setDockerValues() {
echo "Set Docker Values to Config!"

migrateJavaxPropertiesToJakarta

if [ -n "${SOLR_URL}" ]; then
sed -ri "s/#?(MCR\.Solr\.ServerURL=).+/\1${SOLR_URL_ESCAPED}/" "${MYCORE_PROPERTIES}";
fi
Expand All @@ -74,19 +122,19 @@ function setDockerValues() {
fi

if [ -n "${JDBC_NAME}" ]; then
sed -ri "s/(name=\"javax.persistence.jdbc.user\" value=\").*(\")/\1${JDBC_NAME_ESCAPED}\2/" "${PERSISTENCE_XML}"
sed -ri "s/(name=\"jakarta.persistence.jdbc.user\" value=\").*(\")/\1${JDBC_NAME_ESCAPED}\2/" "${PERSISTENCE_XML}"
fi

if [ -n "${JDBC_PASSWORD}" ]; then
sed -ri "s/(name=\"javax.persistence.jdbc.password\" value=\").*(\")/\1${JDBC_PASSWORD_ESCAPED}\2/" "${PERSISTENCE_XML}"
sed -ri "s/(name=\"jakarta.persistence.jdbc.password\" value=\").*(\")/\1${JDBC_PASSWORD_ESCAPED}\2/" "${PERSISTENCE_XML}"
fi

if [ -n "${JDBC_DRIVER}" ]; then
sed -ri "s/(name=\"javax.persistence.jdbc.driver\" value=\").*(\")/\1${JDBC_DRIVER_ESCAPED}\2/" "${PERSISTENCE_XML}"
sed -ri "s/(name=\"jakarta.persistence.jdbc.driver\" value=\").*(\")/\1${JDBC_DRIVER_ESCAPED}\2/" "${PERSISTENCE_XML}"
fi

if [ -n "${JDBC_URL}" ]; then
sed -ri "s/(name=\"javax.persistence.jdbc.url\" value=\").*(\")/\1${JDBC_URL_ESCAPED}\2/" "${PERSISTENCE_XML}"
sed -ri "s/(name=\"jakarta.persistence.jdbc.url\" value=\").*(\")/\1${JDBC_URL_ESCAPED}\2/" "${PERSISTENCE_XML}"
fi

if [ -n "${SOLR_CLASSIFICATION_CORE}" ]; then
Expand All @@ -113,28 +161,27 @@ function setDockerValues() {
echo "MCR.Save.FileSystem=${MCR_SAVE_DIR}">>"${MYCORE_PROPERTIES}"
fi

migrateC3P0toHikari

case $JDBC_DRIVER in
org.postgresql.Driver) downloadDriver "https://jdbc.postgresql.org/download/postgresql-42.2.9.jar";;
org.mariadb.jdbc.Driver) downloadDriver "https://repo.maven.apache.org/maven2/org/mariadb/jdbc/mariadb-java-client/2.5.4/mariadb-java-client-2.5.4.jar";;
org.hsqldb.jdbcDriver) downloadDriver "https://repo.maven.apache.org/maven2/org/hsqldb/hsqldb/2.5.0/hsqldb-2.5.0.jar";;
org.h2.Driver) downloadDriver "https://repo.maven.apache.org/maven2/com/h2database/h2/1.4.200/h2-1.4.200.jar";;
com.mysql.jdbc.Driver) downloadDriver "https://repo.maven.apache.org/maven2/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar";;
org.postgresql.Driver) downloadDriver "https://jdbc.postgresql.org/download/postgresql-42.7.0.jar";;
org.mariadb.jdbc.Driver) downloadDriver "https://repo.maven.apache.org/maven2/org/mariadb/jdbc/mariadb-java-client/3.3.0/mariadb-java-client-3.3.0.jar";;
org.h2.Driver) downloadDriver "https://repo1.maven.org/maven2/com/h2database/h2/2.2.224/h2-2.2.224.jar";;
com.mysql.jdbc.Driver) downloadDriver "https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.2.0/mysql-connector-j-8.2.0.jar";;
esac

mkdir -p "${MCR_CONFIG_DIR}lib"

downloadDriver https://repo1.maven.org/maven2/org/hibernate/hibernate-c3p0/5.3.9.Final/hibernate-c3p0-5.3.9.Final.jar
downloadDriver https://repo1.maven.org/maven2/com/mchange/c3p0/0.9.5.2/c3p0-0.9.5.2.jar
downloadDriver https://repo1.maven.org/maven2/com/mchange/mchange-commons-java/0.2.15/mchange-commons-java-0.2.15.jar
downloadDriver https://repo1.maven.org/maven2/com/zaxxer/HikariCP/5.1.0/HikariCP-5.1.0.jar
}

function setUpMyCoRe {
echo "Set up MyCoRe!"
/opt/mir/mir/bin/mir.sh create configuration directory
setDockerValues
setupLog4jConfig
sed -ri "s/<mapping-file>META-INF\/mycore-viewer-mappings.xml<\/mapping-file>/&\n <mapping-file>META-INF\/mir-module-mappings.xml<\/mapping-file>\n <mapping-file>META-INF\/mycore-acl-mappings.xml<\/mapping-file>\n <mapping-file>META-INF\/mycore-jobqueue-mappings.xml<\/mapping-file>/" "${MCR_CONFIG_DIR}resources/META-INF/persistence.xml"
sed -ri "s/(<\/properties>)/<property name=\"hibernate\.connection\.provider_class\" value=\"org\.hibernate\.connection\.C3P0ConnectionProvider\" \/>\n<property name=\"hibernate\.c3p0\.min_size\" value=\"2\" \/>\n<property name=\"hibernate\.c3p0\.max_size\" value=\"50\" \/>\n<property name=\"hibernate\.c3p0\.acquire_increment\" value=\"2\" \/>\n<property name=\"hibernate\.c3p0\.max_statements\" value=\"30\" \/>\n<property name=\"hibernate\.c3p0\.timeout\" value=\"1800\" \/>\n\1/" "${MCR_CONFIG_DIR}resources/META-INF/persistence.xml"
/opt/mir/mir/bin/mir.sh reload mappings in jpa configuration file
sed -ri "s/(<\/properties>)/<property name=\"hibernate.hikari.maximumPoolSize\" value=\"30\" \/>\n<property name=\"hibernate.hikari.minimumIdle\" value=\"2\" \/>\n<property name=\"hibernate.hikari.idleTimeout\" value=\"30000\" \/>\n<property name=\"hibernate.hikari.maxLifetime\" value=\"1800000\" \/>\n<property name=\"hibernate.hikari.leakDetectionThreshold\" value=\"9000\" \/>\n<property name=\"hibernate.hikari.registerMbeans\" value=\"true\" \/>\n\1/" "${MCR_CONFIG_DIR}resources/META-INF/persistence.xml"
/opt/mir/mir/bin/setup.sh
}

Expand Down
6 changes: 6 additions & 0 deletions docker-log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@
</root>
<logger name="org.hibernate" level="error" />
<logger name="org.mycore.frontend.editor.validation" level="info" />
<logger name="org.mycore.common.xml.MCRURIResolver" >
<filters>
<MarkerFilter marker="tryResolveXML" onMatch="NEUTRAL" onMismatch="ACCEPT"/>
<MCRUniqueFilter onMatch="DENY" onMismatch="ACCEPT"/>
</filters>
</logger>
</loggers>
</configuration>
8 changes: 4 additions & 4 deletions mir-cli/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
8 changes: 4 additions & 4 deletions mir-common-resources/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
8 changes: 4 additions & 4 deletions mir-it/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
2 changes: 1 addition & 1 deletion mir-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<artifactItem>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.176</version>
<version>2.2.224</version>
</artifactItem>
</artifactItems>
</configuration>
Expand Down
15 changes: 8 additions & 7 deletions mir-it/src/test/integration/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
<persistence xmlns="https://jakarta.ee/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd"
version="3.0">
<persistence-unit name="MyCoRe" transaction-type="RESOURCE_LOCAL">
<!-- http://stackoverflow.com/questions/15026302/multiple-jars-single-persistence-unit-solution -->
<mapping-file>META-INF/mycore-base-mappings.xml</mapping-file>
Expand All @@ -14,14 +14,15 @@
<!-- required for MIR only: -->
<mapping-file>META-INF/mir-module-mappings.xml</mapping-file>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:h2:${MCR.Home.Integration}/${MCR.AppName}/data/h2/mir" />
<property name="javax.persistence.jdbc.user" value="sa" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="jakarta.persistence.jdbc.driver" value="org.h2.Driver" />
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:${MCR.Home.Integration}/${MCR.AppName}/data/h2/mir" />
<property name="jakarta.persistence.jdbc.user" value="sa" />
<property name="jakarta.persistence.jdbc.password" value="" />
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.jdbc.batch_size" value="0" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.auto_quote_keyword" value="true" />
</properties>
</persistence-unit>
</persistence>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

public abstract class MIREditorController extends MIRTestController {

Expand Down Expand Up @@ -44,7 +45,8 @@ protected void setHTMLAreaText(String childElementName, String text) {
protected void clickRepeater(String field) {
driver
.waitAndFindElement(
By.xpath(".//button[contains(@name, '" + field + "') and contains(@name, '_xed_submit_insert')]"))
By.xpath(".//button[contains(@name, '" + field + "') and contains(@name, '_xed_submit_insert')]"),
ExpectedConditions::elementToBeClickable)
.click();
}

Expand Down
Loading

0 comments on commit 983bad4

Please sign in to comment.