Skip to content

Commit

Permalink
Merge branch 'master' into DAT-18191
Browse files Browse the repository at this point in the history
  • Loading branch information
suryaaki2 authored Oct 3, 2024
2 parents c110a35 + 2679b9a commit 455666b
Show file tree
Hide file tree
Showing 70 changed files with 232 additions and 185 deletions.
5 changes: 4 additions & 1 deletion .github/util/package-install4j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ if [ ! -e target/keys ]; then
echo "WARNING: not signing installer because target/keys directory does not exist."
INSTALL4J_ARGS="$INSTALL4J_ARGS --disable-signing"
else
INSTALL4J_ARGS="$INSTALL4J_ARGS --win-keystore-password=$INSTALL4J_WINDOWS_KEY_PASSWORD --mac-keystore-password=$INSTALL4J_APPLE_KEY_PASSWORD --apple-id=$INSTALL4J_APPLE_ID --apple-id-password=$INSTALL4J_APPLE_ID_PASSWORD"
INSTALL4J_ARGS="$INSTALL4J_ARGS --win-keystore-password=$INSTALL4J_WINDOWS_KEY_PASSWORD"
# Commenting out mac-related signing arguments
# INSTALL4J_ARGS="$INSTALL4J_ARGS --mac-keystore-password=$INSTALL4J_APPLE_KEY_PASSWORD --apple-id=$INSTALL4J_APPLE_ID --apple-id-password=$INSTALL4J_APPLE_ID_PASSWORD"
fi


"$install4jc" --license=$INSTALL4J_10_LICENSE
"$install4jc" $INSTALL4J_ARGS src/main/install4j/liquibase.install4j

3 changes: 3 additions & 0 deletions .github/workflows/dry-run-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
dry_run_id: ${{ steps.get_run_id.outputs.dry_run_id }}
dry_run_branch_name: ${{ steps.get_run_id.dry_run_branch_name }}
steps:
- name: Get run-tests.yml runId
id: get_run_id
Expand All @@ -24,6 +25,7 @@ jobs:
# Extract the last successful run ID
run_id=$(echo "$response" | jq -r '.workflow_runs[0].id')
echo "dry_run_id=$run_id" >> $GITHUB_OUTPUT
echo "dry_run_branch_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
dry-run-create-release:
needs: [ setup ]
Expand Down Expand Up @@ -67,6 +69,7 @@ jobs:
dry_run_zip_url: ${{ needs.dry-run-create-release.outputs.dry_run_zip_url }}
dry_run_tar_gz_url: ${{ needs.dry-run-create-release.outputs.dry_run_tar_gz_url }}
dry_run: true
dry_run_branch_name: ${{ needs.dry-run-create-release.outputs.dry_run_branch_name }}
secrets: inherit

cleanup:
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
description: 'URL of the dry-run tar.gz release'
required: false
type: string
dry_run_branch_name:
description: 'The branch name of the dry-run'
required: false
type: string
workflow_call:
inputs:
tag:
Expand All @@ -47,7 +51,10 @@ on:
description: 'URL of the dry-run tar.gz release'
required: false
type: string

dry_run_branch_name:
description: 'The branch name of the dry-run'
required: false
type: string
env:
MAVEN_VERSION: '3.9.2'
jobs:
Expand All @@ -58,6 +65,7 @@ jobs:
tag: ${{ steps.collect-data.outputs.tag }}
version: ${{ steps.collect-data.outputs.version }}
ref_branch: ${{ steps.ref-branch.outputs.branch }}
dry_run_branch_name: ${{ inputs.dry_run_branch_name }}
steps:
- name: Collect Data
id: collect-data
Expand Down Expand Up @@ -87,8 +95,11 @@ jobs:
run: |
if [ "${{ github.ref_name }}" == "release" ]; then
echo "branch=release" >> $GITHUB_OUTPUT
else
elif [ "${{ github.ref_name }}" == "master" ]; then
echo "branch=master" >> $GITHUB_OUTPUT
else
echo "branch=${{ inputs.dry_run_branch_name }}" >> $GITHUB_OUTPUT
fi
manual_trigger_deployment:
if: ${{ inputs.dry_run == false }}
Expand Down
1 change: 1 addition & 0 deletions liquibase-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected int handleException(Throwable exception) {
cause = cause.getCause();
}

if (StringUtil.isEmpty(uiMessage)) {
if (StringUtils.isEmpty(uiMessage)) {
uiMessage = exception.getClass().getName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ public static void main(final String[] args) throws Exception {
final URLClassLoader classloader = new URLClassLoader(libUrls.toArray(new URL[0]), parentLoader);
Thread.currentThread().setContextClassLoader(classloader);

Class<?> cli = null;
Class<?> cli;
try {
cli = classloader.loadClass(LiquibaseCommandLine.class.getName());
} catch (ClassNotFoundException classNotFoundException) {
throw new RuntimeException(
String.format("Unable to find Liquibase classes in the configured home: '%s'.", liquibaseHome)
String.format("Unable to find Liquibase classes in the configured home: '%s'.", liquibaseHome), classNotFoundException
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import liquibase.logging.mdc.customobjects.Version;
import liquibase.util.ObjectUtil;
import liquibase.util.StringUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -101,7 +102,7 @@ private static LibraryInfo getLibraryInfo(File pathEntryFile) throws IOException
*/
private static void handleCompilerJarEdgeCase(File pathEntryFile, JarFile jarFile, LibraryInfo libraryInfo) {
try {
if (pathEntryFile.toString().endsWith("compiler.jar") && StringUtil.isEmpty(libraryInfo.version)) {
if (pathEntryFile.toString().endsWith("compiler.jar") && StringUtils.isEmpty(libraryInfo.version)) {
ZipEntry entry = jarFile.getEntry("META-INF/maven/com.github.spullara.mustache.java/compiler/pom.properties");
InputStream inputStream = jarFile.getInputStream(entry);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package liquibase.integration.commandline

import liquibase.Scope
import liquibase.command.CommandBuilder
import liquibase.command.CommandFactory
import liquibase.configuration.ConfigurationDefinition
import liquibase.exception.LiquibaseException
import liquibase.logging.core.BufferedLogService
Expand Down Expand Up @@ -624,7 +625,11 @@ https://docs.liquibase.com
@Unroll
def "toArgNames for command arguments"() {
expect:
LiquibaseCommandLine.toArgNames(new CommandBuilder(["argTest"] as String[][]).argument(argName, String).build()).join(", ") == expected
LiquibaseCommandLine.toArgNames(new CommandBuilder([["argTest"]] as String[][]).argument(argName, String).build()).join(", ") == expected

cleanup:
final CommandFactory commandFactory = Scope.getCurrentScope().getSingleton(CommandFactory.class);
commandFactory.unregister(["argTest"] as String[])

where:
argName | expected
Expand Down Expand Up @@ -662,6 +667,10 @@ https://docs.liquibase.com
expect:
LiquibaseCommandLine.toArgNames(new CommandBuilder([["argCommand"]] as String[][]).argument(argName, String).addAlias(alias).build()).join(", ") == expected

cleanup:
final CommandFactory commandFactory = Scope.getCurrentScope().getSingleton(CommandFactory.class);
commandFactory.unregister(["argCommand"] as String[])

where:
prefix | argName | alias | expected
"liquibase" | "test" | "testAlias" | "--test, --test-alias, --testAlias"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import spock.lang.Unroll
class LiquibaseCommandLineThreadingTest extends Specification {

@Unroll
@Ignore("this test causes later tests to fail, because the global argument definitions are not stored statically, but are instantiated statically, thus hiding them from other threads")
def "2 threads global flags" () {
given:
def returnCode = 0
Expand Down
2 changes: 1 addition & 1 deletion liquibase-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
</goals>
<configuration>
<target>
<jar destfile="${project.build.directory}/${build.finalName}.jar"
<jar destfile="${project.build.directory}/${project.build.finalName}.jar"
update="true"
basedir="${project.build.directory}/classes"
includes="**/pom.xml"
Expand Down
11 changes: 7 additions & 4 deletions liquibase-dist/src/main/install4j/liquibase.install4j
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<variables>
<variable name="liquibaseVersion" value="0-SNAPSHOT" />
</variables>
<codeSigning macEnabled="true" macPkcs12File="../../../target/keys/datical_apple.p12" windowsEnabled="true" windowsPkcs12File="../../../target/keys/datical_windows.pfx" macNotarize="true" appleId="[email protected]" useAscProvider="true" ascProvider="BQ3PYUB226">
<codeSigning windowsEnabled="true" windowsPkcs12File="../../../target/keys/datical_windows.pfx" >
<!-- <codeSigning macEnabled="true" macPkcs12File="../../../target/keys/datical_apple.p12" windowsEnabled="true" windowsPkcs12File="../../../target/keys/datical_windows.pfx" macNotarize="true" appleId="[email protected]" useAscProvider="true" ascProvider="BQ3PYUB226"> -->
<macSearchedJars>
<entry>jna-*</entry>
<entry>swt-*</entry>
Expand Down Expand Up @@ -535,16 +536,18 @@ return console.askYesNo(message, true);
</modules>
</jreBundle>
</windows>
<!--
<macosFolder name="macOS Folder" id="154" installDir="liquibase" customInstallBaseDir="/usr/local/opt">
<excludedLaunchers>
<launcher id="156" />
<launcher id="158" />
<launcher id="156" />
<launcher id="158" />
</excludedLaunchers>
<jreBundle>
<modules>
<defaultModules set="jre" />
<defaultModules set="jre" />
</modules>
</jreBundle>
</macosFolder>
-->
</mediaSets>
</install4j>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public LiquibaseSdkConfigurationValueProvider() {

}
} catch (IOException e) {
Scope.getCurrentScope().getLog(getClass()).info("Cannot find liquibase.test.yaml");
Scope.getCurrentScope().getLog(getClass()).info("Cannot find liquibase.test.yaml", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void stopContainers(List<FieldInfo> containers, IMethodInvocation invoca
try {
testSystem.stop();
} catch (Exception e) {
Scope.getCurrentScope().getLog(getClass()).warning("Cannot stop "+testSystem.getDefinition());
Scope.getCurrentScope().getLog(getClass()).warning("Cannot stop " + testSystem.getDefinition(), e);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,23 @@ class UpdateTestingRollbackCommandsIntegrationTest extends Specification {
cleanup:
CommandUtil.runDropAll(h2)
}

def "run UpdateTestingRollback specifying a tag with changelog parameter from Liquibase class"() {
when:
def testTag = "testTag"
def liquibase = new Liquibase("liquibase/update-tests.yml", new ClassLoaderResourceAccessor(), h2.getDatabaseFromFactory())
liquibase.updateTestingRollback(testTag, new Contexts(), new LabelExpression())

then:
def resultSet = h2.getConnection().createStatement().executeQuery("select count(1) from databasechangelog")
resultSet.next()
resultSet.getInt(1) == 1

def rsTableExist = h2.getConnection().createStatement().executeQuery("select count(1) from example_table")
rsTableExist.next()
rsTableExist.getInt(1) == 0

cleanup:
CommandUtil.runDropAll(h2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ protected void wipeDatabase() {
database.commit();
}
} catch (SQLException e) {
logger.warning(String.format("Failed to drop table %s", database.getDatabaseChangeLogLockTableName()), e);
if (database instanceof PostgresDatabase) { // throws "current transaction is aborted" unless we roll back the connection
database.rollback();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Optional Args:
password (String) Password to use to connect to the database
Default: null
OBFUSCATED
tag (String) The tag to update to
Default: null
username (String) Username to use to connect to the database
Default: null
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ protected void parsePropertiesFile(InputStream propertiesInputStream)
}
} catch (Exception e) {
getLog().info(" '" + key + "' in properties file is not being used by this "
+ "task.");
+ "task.", e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import liquibase.integration.commandline.CommandLineUtils;
import liquibase.resource.ResourceAccessor;
import liquibase.util.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
Expand Down Expand Up @@ -306,7 +307,7 @@ protected void performLiquibaseTask(Liquibase liquibase) throws LiquibaseExcepti
liquibaseCommand.addArgumentValue(ReferenceDbUrlConnectionCommandStep.REFERENCE_DATABASE_ARG, referenceDatabase);
liquibaseCommand.addArgumentValue(PreCompareCommandStep.COMPARE_CONTROL_ARG, new CompareControl(schemaComparisons, diffTypes));
liquibaseCommand.addArgumentValue(PreCompareCommandStep.OBJECT_CHANGE_FILTER_ARG, objectChangeFilter);
if (StringUtil.isEmpty(diffTypes)) {
if (StringUtils.isEmpty(diffTypes)) {
liquibaseCommand.addArgumentValue(PreCompareCommandStep.SNAPSHOT_TYPES_ARG, new Class[0]);
} else {
liquibaseCommand.addArgumentValue(PreCompareCommandStep.SNAPSHOT_TYPES_ARG, DiffCommandStep.parseSnapshotTypes(diffTypes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void verifySupportsMethodImplementation(Set<Change> plugins) {
}
}
} catch (NoSuchMethodException e) {
throw new UnexpectedLiquibaseException(String.format(SUPPORTS_METHOD_REQUIRED_MESSAGE, plugin.getClass().getName()));
throw new UnexpectedLiquibaseException(String.format(SUPPORTS_METHOD_REQUIRED_MESSAGE, plugin.getClass().getName()), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -53,7 +54,7 @@ private CheckSum(String checksum, int version) {
* Parse the given storedCheckSum string value and return a new CheckSum object.
*/
public static CheckSum parse(String checksumValue) {
if (StringUtil.isEmpty(checksumValue)) {
if (StringUtils.isEmpty(checksumValue)) {
return null;
}
// The general layout of a checksum is:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected void validateChangeSetExecutor(ChangeSet changeSet, RuntimeEnvironment
catch (UnexpectedLiquibaseException ule) {
String message = String.format(MSG_COULD_NOT_FIND_EXECUTOR, executorName, changeSet);
Scope.getCurrentScope().getLog(getClass()).severe(message);
throw new LiquibaseException(message);
throw new LiquibaseException(message, ule);
}
//
// ASSERT: the Executor is valid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import liquibase.util.StringUtil;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

import java.time.Instant;
import java.util.*;
Expand Down Expand Up @@ -870,7 +871,7 @@ private Executor setupCustomExecutorIfNecessary(Database database) {
* @return String The mapped value
*/
public static String lookupExecutor(String executorName) {
if (StringUtil.isEmpty(executorName)) {
if (StringUtils.isEmpty(executorName)) {
return null;
}
String key = "liquibase." + executorName.toLowerCase() + ".executor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public void handleChildNodeHelper(ParsedNode node, ResourceAccessor resourceAcce
case PROPERTY: {
try {
String contextFilter = node.getChildValue(null, CONTEXT_FILTER, String.class);
if (StringUtil.isEmpty(contextFilter)) {
if (StringUtils.isEmpty(contextFilter)) {
contextFilter = node.getChildValue(null, CONTEXT, String.class);
}
String dbms = node.getChildValue(null, DBMS, String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private String expandExpressions(StringReader reader, DatabaseChangeLog changeLo
}
} catch (IOException exception) {
// Unreachable as we initialize the StringReader with a non-null string
throw new RuntimeException(exception);
}

if (inExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import liquibase.structure.core.Table;
import liquibase.util.StreamUtil;
import liquibase.util.StringUtil;
import org.apache.commons.lang3.StringUtils;

import java.io.*;
import java.util.*;
Expand Down Expand Up @@ -183,9 +184,9 @@ private void validateRequiredSchemas(DatabaseSnapshot snapshot, CatalogAndSchema
throw new LiquibaseException("Could not find any of the required schemas at the configured database.");
}

Set<String> schemasNamesAtDb = schemasFoundAtDb.stream().filter(s -> !StringUtil.isEmpty(s.getName()))
Set<String> schemasNamesAtDb = schemasFoundAtDb.stream().filter(s -> !StringUtils.isEmpty(s.getName()))
.map(s -> s.getName().toLowerCase()).collect(Collectors.toSet());
Set<String> requiredSchemaNames = Arrays.stream(schemaList).filter(s -> !StringUtil.isEmpty(s.getSchemaName()))
Set<String> requiredSchemaNames = Arrays.stream(schemaList).filter(s -> !StringUtils.isEmpty(s.getSchemaName()))
.map(s -> s.getSchemaName().toLowerCase()).collect(Collectors.toSet());
List<String> notFoundSchemas = new ArrayList<>();

Expand Down
Loading

0 comments on commit 455666b

Please sign in to comment.