Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line args to scope DAT-15396 #4506

Merged
merged 39 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bcb31d1
Added bogus comment
wwillard7800 May 31, 2023
468c5eb
Added a dropAll cleanup method
wwillard7800 May 31, 2023
ee9b994
Used wrong annotation for cleanup
wwillard7800 May 31, 2023
2e3ca06
Make cleanup method static
wwillard7800 May 31, 2023
d095de4
Fix cleanup method reference
wwillard7800 May 31, 2023
7b83309
Removed cleanup method
wwillard7800 May 31, 2023
9566405
Test cleanup
wwillard7800 May 31, 2023
ce4d6c3
Merge branch 'master' into DAT-14694
obovsunivskyii Jun 1, 2023
8636998
Merge remote-tracking branch 'origin/master' into DAT-14694
wwillard7800 Jun 15, 2023
c157d28
Merge remote-tracking branch 'origin/master' into DAT-14694
wwillard7800 Jun 15, 2023
c37fba8
Merge remote-tracking branch 'origin/master' into DAT-14694
wwillard7800 Jun 20, 2023
f5f5bd4
Save and restore database major version in Postgres tests
wwillard7800 Jun 21, 2023
79a1450
Merge remote-tracking branch 'origin/DAT-14694' into DAT-14694
wwillard7800 Jun 21, 2023
ff82d9f
Merge remote-tracking branch 'origin/master' into DAT-14694
wwillard7800 Jun 21, 2023
0bc4191
Save and restore database major version in Postgres tests
wwillard7800 Jun 21, 2023
d96d759
Merge remote-tracking branch 'origin/check-definition-test-fix' into …
wwillard7800 Jun 22, 2023
c714d75
Merge remote-tracking branch 'origin/master'
wwillard7800 Jun 22, 2023
d72afa6
Added an expectedResult field to testDef to allow for assertion
wwillard7800 Jun 27, 2023
c51ac71
Save and restore database major version in Postgres tests
wwillard7800 Jun 21, 2023
8373179
Added an expectedResult field to testDef to allow for assertion
wwillard7800 Jun 27, 2023
97029ef
Merge remote-tracking branch 'origin/master' into DAT-15145
wwillard7800 Jun 28, 2023
2474c16
Temporary fix to enable tests to pass
wwillard7800 Jun 28, 2023
36594ec
Merge remote-tracking branch 'origin/DAT-15145' into DAT-15145
wwillard7800 Jun 28, 2023
ec1a469
Merge remote-tracking branch 'origin/master' into DAT-15145
wwillard7800 Jul 10, 2023
149f654
Merge branch 'DAT-14694' into DAT-15145
wwillard7800 Jul 10, 2023
282c562
Merge remote-tracking branch 'origin/master' into DAT-15145
wwillard7800 Jul 11, 2023
9529b5c
Merge remote-tracking branch 'origin/master' into DAT-15145
wwillard7800 Jul 17, 2023
5c60034
Make command line arguments available in scope
wwillard7800 Jul 18, 2023
b72c3d3
Merge remote-tracking branch 'origin/master' into DAT-15396
wwillard7800 Jul 26, 2023
1b31ae7
fix local dev builds
StevenMassaro Jul 26, 2023
c5486fd
Recover previous commit
wwillard7800 Jul 26, 2023
8dfa78c
Merge remote-tracking branch 'origin/github-action-fix-dev-builds' in…
wwillard7800 Jul 26, 2023
6cc8c24
Merge remote-tracking branch 'origin/master' into DAT-15396
wwillard7800 Jul 27, 2023
50abfe4
DAT-15396
wwillard7800 Jul 28, 2023
783c53f
Merge remote-tracking branch 'origin/master' into DAT-15396
wwillard7800 Jul 31, 2023
07a3b5f
Merge remote-tracking branch 'origin/master' into DAT-15396
abrackx Aug 2, 2023
4532bf6
Merge branch 'master' into DAT-15396
abrackx Aug 4, 2023
c1c0688
Merge branch 'master' into DAT-15396
abrackx Aug 4, 2023
0dfca43
Merge branch 'master' into DAT-15396
abrackx Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

public class LiquibaseCommandLine {

public static final String COMMAND_ARGUMENTS = "commandArguments";

private final Map<String, String> legacyPositionalArguments;

/**
Expand Down Expand Up @@ -353,7 +355,7 @@ public int execute(String[] args) {

return Scope.child(Collections.singletonMap(Scope.Attr.logService.name(), newLogService), () -> {
try {
return Scope.child(configureScope(), () -> {
return Scope.child(configureScope(args), () -> {

if (!LiquibaseCommandLineConfiguration.SHOULD_RUN.getCurrentValue()) {
Scope.getCurrentScope().getUI().sendErrorMessage((
Expand Down Expand Up @@ -636,8 +638,9 @@ public int getPrecedence() {
*
* @return values to set in the scope
*/
private Map<String, Object> configureScope() throws Exception {
private Map<String, Object> configureScope(String[] args) throws Exception {
Map<String, Object> returnMap = new HashMap<>();
returnMap.put(COMMAND_ARGUMENTS, args);

final ClassLoader classLoader = configureClassLoader();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,11 @@ Long Description: ${commandDefinition.getLongDescription() ?: "NOT SET"}
checkFileContent(testDef.expectedFileContent, "Command File Content")
checkDatabaseContent(testDef.expectedDatabaseContent, database, "Database snapshot content")

if (!testDef.expectedResult.isEmpty()) {
def entrySet = testDef.expectedResult.entrySet()
def oneEntry = entrySet.iterator().next()
assert results.getResult(oneEntry.getKey()) == oneEntry.getValue()
}
if (!testDef.expectedResults.isEmpty()) {
for (def returnedResult : results.getResults().entrySet()) {
def expectedResult = testDef.expectedResults.get(returnedResult.getKey())
Expand Down Expand Up @@ -836,11 +841,16 @@ Long Description: ${commandDefinition.getLongDescription() ?: "NOT SET"}
private File outputFile

private Map<String, ?> expectedResults = new HashMap<>()
private Map<String, ?> expectedResult = new HashMap<>()
private Class<Throwable> expectedException
private Object expectedExceptionMessage
private File expectFileToExist
private File expectFileToNotExist

def setExpectedResult(Map<String, ?> expectedResult) {
this.expectedResult = expectedResult
}

def setup(@DelegatesTo(TestSetupDefinition) Closure closure) {
def setupDef = new TestSetupDefinition()

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<argLine></argLine>
</properties>

<!-- comment -->
<distributionManagement>
<repository>
<id>github</id>
Expand Down