Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac1a2ac
commit 60dcfa4
Showing
14 changed files
with
139 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...src/main/java/org/seedstack/seed/core/internal/configuration/tool/AbstractConfigTool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...in/java/org/seedstack/seed/core/internal/configuration/tool/utils/ConfigurationUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
core/src/test/java/org/seedstack/seed/core/internal/configuration/tool/AbstractToolIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.seedstack.seed.core.internal.configuration.tool; | ||
|
||
import org.junit.After; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.runner.RunWith; | ||
import org.seedstack.seed.core.internal.configuration.tool.fixtures.ExitExceptionSecurityManager; | ||
import org.seedstack.seed.testing.junit4.SeedITRunner; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.PrintStream; | ||
|
||
@RunWith(SeedITRunner.class) | ||
public abstract class AbstractToolIT { | ||
|
||
final static ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||
|
||
private final static PrintStream savedOut = System.out; | ||
private static SecurityManager savedSecurityManager = System.getSecurityManager(); | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
System.setOut(new PrintStream(output)); | ||
System.setSecurityManager(new ExitExceptionSecurityManager()); | ||
} | ||
|
||
@AfterClass | ||
public static void afterClass() { | ||
System.setOut(savedOut); | ||
System.setSecurityManager(savedSecurityManager); | ||
} | ||
|
||
@After | ||
public void afterTest() { | ||
output.reset(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
core/src/test/java/org/seedstack/seed/core/internal/configuration/tool/GenericToolIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright © 2013-2021, The SeedStack authors <http://seedstack.org> | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
package org.seedstack.seed.core.internal.configuration.tool; | ||
|
||
import org.junit.Test; | ||
import org.seedstack.seed.SeedException; | ||
import org.seedstack.seed.core.internal.ToolLauncher; | ||
import org.seedstack.seed.core.internal.configuration.tool.fixtures.ExitException; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
|
||
public class GenericToolIT extends AbstractToolIT { | ||
|
||
@Test | ||
public void nonExistentSeedTool() { | ||
ToolLauncher launcher = new ToolLauncher("non-existentSeedTool"); | ||
assertThatExceptionOfType(SeedException.class).isThrownBy(() -> launcher.launch(new String[]{"jta"})); | ||
} | ||
|
||
@Test | ||
public void validConfigToolWithParameters() throws Exception { | ||
ToolLauncher launcher = new ToolLauncher("config"); | ||
try { | ||
launcher.launch(new String[]{"transaction.jta"}); | ||
} catch (ExitException e) { | ||
assertThat(output.toString()).contains("Configuration options"); | ||
} | ||
} | ||
|
||
@Test | ||
public void validConfigToolWithoutParameters() throws Exception { | ||
ToolLauncher launcher = new ToolLauncher("config"); | ||
try { | ||
launcher.launch(new String[]{}); | ||
} catch (ExitException e) { | ||
assertThat(output.toString()).contains("Configuration options"); | ||
} | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...c/test/java/org/seedstack/seed/core/internal/configuration/tool/fixtures/Credentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...test/java/org/seedstack/seed/core/internal/configuration/tool/fixtures/ExitException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...eedstack/seed/core/internal/configuration/tool/fixtures/ExitExceptionSecurityManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.