-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #483 from QuorumEngineering/feature/key-vault-with…
…-new-key-types Azure Key Vault integration for storage of Tessera public/private key pairs
- Loading branch information
Showing
69 changed files
with
1,958 additions
and
172 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
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
81 changes: 81 additions & 0 deletions
81
config-cli/src/test/java/com/quorum/tessera/config/cli/parsers/ConfigurationParserTest.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,81 @@ | ||
package com.quorum.tessera.config.cli.parsers; | ||
|
||
import com.quorum.tessera.config.Config; | ||
import org.apache.commons.cli.CommandLine; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
|
||
import java.io.FileNotFoundException; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.catchThrowable; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
public class ConfigurationParserTest { | ||
|
||
private ConfigurationParser configParser; | ||
private CommandLine commandLine; | ||
|
||
@Before | ||
public void setUp() { | ||
configParser = new ConfigurationParser(); | ||
commandLine = mock(CommandLine.class); | ||
} | ||
|
||
@Test | ||
public void providingKeygenAndVaultOptionsThenConfigfileNotParsed() throws Exception { | ||
when(commandLine.hasOption("configfile")).thenReturn(true); | ||
when(commandLine.hasOption("keygen")).thenReturn(true); | ||
when(commandLine.hasOption("keygenvaulturl")).thenReturn(true); | ||
|
||
Config result = configParser.parse(commandLine); | ||
|
||
assertThat(result).isNull(); | ||
} | ||
|
||
@Test | ||
public void providingKeygenOptionThenConfigfileIsParsed() { | ||
when(commandLine.hasOption("configfile")).thenReturn(true); | ||
when(commandLine.hasOption("keygen")).thenReturn(true); | ||
when(commandLine.hasOption("keygenvaulturl")).thenReturn(false); | ||
|
||
when(commandLine.getOptionValue("configfile")).thenReturn("some/path"); | ||
|
||
Throwable throwable = catchThrowable(() -> configParser.parse(commandLine)); | ||
|
||
//FileNotFoundException thrown as "some/path" does not exist | ||
assertThat(throwable).isInstanceOf(FileNotFoundException.class); | ||
} | ||
|
||
@Test | ||
public void providingVaultOptionThenConfigfileIsParsed() { | ||
when(commandLine.hasOption("configfile")).thenReturn(true); | ||
when(commandLine.hasOption("keygen")).thenReturn(false); | ||
when(commandLine.hasOption("keygenvaulturl")).thenReturn(true); | ||
|
||
when(commandLine.getOptionValue("configfile")).thenReturn("some/path"); | ||
|
||
Throwable throwable = catchThrowable(() -> configParser.parse(commandLine)); | ||
|
||
//FileNotFoundException thrown as "some/path" does not exist | ||
assertThat(throwable).isInstanceOf(FileNotFoundException.class); | ||
} | ||
|
||
@Test | ||
public void providingNeitherKeygenOptionsThenConfigfileIsParsed() { | ||
when(commandLine.hasOption("configfile")).thenReturn(true); | ||
when(commandLine.hasOption("keygen")).thenReturn(false); | ||
when(commandLine.hasOption("keygenvaulturl")).thenReturn(false); | ||
|
||
when(commandLine.getOptionValue("configfile")).thenReturn("some/path"); | ||
|
||
Throwable throwable = catchThrowable(() -> configParser.parse(commandLine)); | ||
|
||
//FileNotFoundException thrown as "some/path" does not exist | ||
assertThat(throwable).isInstanceOf(FileNotFoundException.class); | ||
} | ||
|
||
|
||
} |
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
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
Oops, something went wrong.