diff --git a/.0pdd.yml b/.0pdd.yml index 36d0a7f..03a064d 100644 --- a/.0pdd.yml +++ b/.0pdd.yml @@ -1,3 +1,31 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +--- errors: - yegor256@gmail.com # alerts: diff --git a/.github/workflows/mvn.yml b/.github/workflows/mvn.yml index aade857..d791d31 100644 --- a/.github/workflows/mvn.yml +++ b/.github/workflows/mvn.yml @@ -56,6 +56,6 @@ jobs: ${{ runner.os }}-jdk-${{ matrix.java }}-maven- - run: java -version - run: mvn -version - - run: sudo apt-get install --yes libnuma1 libaio1 + - run: sudo apt-get install --yes libnuma1 libaio1 || true if: matrix.os == 'ubuntu-24.04' - run: mvn --errors --batch-mode clean install -Pqulice diff --git a/.rultor.yml b/.rultor.yml index ac5e654..567b4ef 100644 --- a/.rultor.yml +++ b/.rultor.yml @@ -1,3 +1,31 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. +--- docker: image: yegor256/rultor-image:1.20.0 assets: @@ -12,6 +40,7 @@ merge: mvn clean install -Pqulice --errors --batch-mode release: pre: false + # yamllint disable rule:line-length script: |- [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1 mvn versions:set "-DnewVersion=${tag}" --batch-mode diff --git a/pom.xml b/pom.xml index 6a095ff..1fb139c 100644 --- a/pom.xml +++ b/pom.xml @@ -299,7 +299,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE. com.qulice qulice-maven-plugin - 0.22.0 + 0.23.0 findbugs:.* diff --git a/src/it/basic-usage/invoker.properties b/src/it/basic-usage/invoker.properties index e513b11..531a338 100644 --- a/src/it/basic-usage/invoker.properties +++ b/src/it/basic-usage/invoker.properties @@ -1 +1,28 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. invoker.goals = install diff --git a/src/it/parallel/invoker.properties b/src/it/parallel/invoker.properties index e513b11..531a338 100644 --- a/src/it/parallel/invoker.properties +++ b/src/it/parallel/invoker.properties @@ -1 +1,28 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. invoker.goals = install diff --git a/src/it/skip/invoker.properties b/src/it/skip/invoker.properties index e513b11..531a338 100644 --- a/src/it/skip/invoker.properties +++ b/src/it/skip/invoker.properties @@ -1 +1,28 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. invoker.goals = install diff --git a/src/it/with-options/invoker.properties b/src/it/with-options/invoker.properties index e513b11..531a338 100644 --- a/src/it/with-options/invoker.properties +++ b/src/it/with-options/invoker.properties @@ -1 +1,28 @@ +# Copyright (c) 2012-2025, jcabi.com +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: 1) Redistributions of source code must retain the above +# copyright notice, this list of conditions and the following +# disclaimer. 2) Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. 3) Neither the name of the jcabi.com nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT +# NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +# OF THE POSSIBILITY OF SUCH DAMAGE. invoker.goals = install diff --git a/src/main/java/com/jcabi/mysql/maven/plugin/Instances.java b/src/main/java/com/jcabi/mysql/maven/plugin/Instances.java index ce39a24..1ecf28d 100644 --- a/src/main/java/com/jcabi/mysql/maven/plugin/Instances.java +++ b/src/main/java/com/jcabi/mysql/maven/plugin/Instances.java @@ -58,9 +58,9 @@ * Running instances of MySQL. * *

The class is thread-safe. + * @since 0.1 * @checkstyle ClassDataAbstractionCoupling (500 lines) * @checkstyle MultipleStringLiterals (500 lines) - * @since 0.1 */ @ToString @EqualsAndHashCode(of = "processes") @@ -391,35 +391,35 @@ private void configure(@NotNull final Config config, String.format("--password=%s", Instances.DEFAULT_PASSWORD), String.format("--socket=%s", socket) ).start(); - final PrintWriter writer = new PrintWriter( + try (PrintWriter writer = new PrintWriter( new OutputStreamWriter( process.getOutputStream(), StandardCharsets.UTF_8 ) - ); - writer.print("CREATE DATABASE "); - writer.print(config.dbname()); - writer.println(";"); - if (!Instances.DEFAULT_USER.equals(config.user())) { - writer.println( - String.format( - "CREATE USER '%s'@'%s' IDENTIFIED BY '%s';", - config.user(), - Instances.DEFAULT_HOST, - config.password() - ) - ); - writer.println( - String.format( - "GRANT ALL ON %s.* TO '%s'@'%s';", - config.dbname(), - config.user(), - Instances.DEFAULT_HOST - ) - ); - writer.println("SHOW DATABASES;"); + )) { + writer.print("CREATE DATABASE "); + writer.print(config.dbname()); + writer.println(";"); + if (!Instances.DEFAULT_USER.equals(config.user())) { + writer.println( + String.format( + "CREATE USER '%s'@'%s' IDENTIFIED BY '%s';", + config.user(), + Instances.DEFAULT_HOST, + config.password() + ) + ); + writer.println( + String.format( + "GRANT ALL ON %s.* TO '%s'@'%s';", + config.dbname(), + config.user(), + Instances.DEFAULT_HOST + ) + ); + writer.println("SHOW DATABASES;"); + } } - writer.close(); new VerboseProcess(process).stdout(); Logger.info( this, diff --git a/src/test/java/com/jcabi/mysql/maven/plugin/ClassifyMojoTest.java b/src/test/java/com/jcabi/mysql/maven/plugin/ClassifyMojoTest.java index e482e72..eec7fa9 100644 --- a/src/test/java/com/jcabi/mysql/maven/plugin/ClassifyMojoTest.java +++ b/src/test/java/com/jcabi/mysql/maven/plugin/ClassifyMojoTest.java @@ -57,6 +57,7 @@ void detectsCurrentPlatform() throws Exception { mojo.setClassifier(name); mojo.execute(); MatcherAssert.assertThat( + "should be true", props.getProperty(name).matches("[a-z]+-[a-z0-9_]+"), Matchers.is(true) ); diff --git a/src/test/java/com/jcabi/mysql/maven/plugin/InstancesTest.java b/src/test/java/com/jcabi/mysql/maven/plugin/InstancesTest.java index 584d7c0..0766fe8 100644 --- a/src/test/java/com/jcabi/mysql/maven/plugin/InstancesTest.java +++ b/src/test/java/com/jcabi/mysql/maven/plugin/InstancesTest.java @@ -38,14 +38,15 @@ import java.util.concurrent.TimeUnit; import javax.sql.DataSource; import org.hamcrest.MatcherAssert; +import org.hamcrest.Matchers; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** * Test case for {@link Instances}. + * @since 0.6 * @checkstyle ClassDataAbstractionCoupling (500 lines) * @checkstyle MultipleStringLiterals (500 lines) - * @since 0.6 */ @SuppressWarnings("PMD.AvoidDuplicateLiterals") final class InstancesTest { @@ -347,7 +348,8 @@ void willCreateDatabaseEvenWithoutClear() throws Exception { ); MatcherAssert.assertThat( "Instance reusedExistingDatabase should be false.", - !instances.reusedExistingDatabase() + !instances.reusedExistingDatabase(), + Matchers.is(true) ); final DataSource source = new UrlSource( String.format( @@ -399,7 +401,8 @@ void canReuseExistingDatabse() throws Exception { ); MatcherAssert.assertThat( "Instance reusedExistingDatabase should be false.", - !instances.reusedExistingDatabase() + !instances.reusedExistingDatabase(), + Matchers.is(true) ); final DataSource source = new UrlSource( String.format( @@ -456,7 +459,8 @@ private void checkExistingDatabase(final File target) throws Exception { ); MatcherAssert.assertThat( "Instance reusedExistingDatabase should be true.", - instances.reusedExistingDatabase() + instances.reusedExistingDatabase(), + Matchers.is(true) ); do { TimeUnit.SECONDS.sleep(InstancesTest.SLEEP_SECONDS);