use of tech.pegasys.signers.secp256k1.multikey.MetadataFileFixture.KEY_FILE in project signers by ConsenSys.
the class FileBasedSigningMetadataFileTest method matchingMetadataFileWithoutPrefixShouldHaveExpectedName.
@Test
void matchingMetadataFileWithoutPrefixShouldHaveExpectedName() {
final FileBasedSigningMetadataFile fileBasedSigningMetadataFile = load(LOWERCASE_ADDRESS + CONFIG_FILE_EXTENSION, KEY_FILE, PASSWORD_FILE);
assertThat(fileBasedSigningMetadataFile.getFilename()).matches(LOWERCASE_ADDRESS + CONFIG_FILE_EXTENSION);
assertThat(fileBasedSigningMetadataFile.getConfig().getKeystoreFile().toFile().toString()).matches(KEY_FILE);
assertThat(fileBasedSigningMetadataFile.getConfig().getKeystorePasswordFile().toFile().toString()).matches(PASSWORD_FILE);
}
use of tech.pegasys.signers.secp256k1.multikey.MetadataFileFixture.KEY_FILE in project signers by ConsenSys.
the class SigningMetadataTomlConfigLoaderTest method loadAvailableConfigsReturnsAllValidMetadataFilesInDirectory.
@Test
void loadAvailableConfigsReturnsAllValidMetadataFilesInDirectory() {
final Filter<Path> filter = entry -> true;
final FileBasedSigningMetadataFile metadataFile1 = copyMetadataFileToDirectory(configsDirectory, LOWERCASE_ADDRESS + CONFIG_FILE_EXTENSION, KEY_FILE, PASSWORD_FILE);
final FileBasedSigningMetadataFile metadataFile2 = copyMetadataFileToDirectory(configsDirectory, "bar_" + PREFIX_ADDRESS + CONFIG_FILE_EXTENSION, KEY_FILE_2, PASSWORD_FILE_2);
final FileBasedSigningMetadataFile metadataFile3 = copyMetadataFileToDirectory(configsDirectory, PREFIX_LOWERCASE_DUPLICATE_FILENAME_2, KEY_FILE_2, PASSWORD_FILE_2);
final FileBasedSigningMetadataFile metadataFile4 = copyMetadataFileToDirectory(configsDirectory, PREFIX_LOWERCASE_DUPLICATE_FILENAME_1, KEY_FILE, PASSWORD_FILE);
// duplicate files are loaded at this stage since addresses aren't checked until signers are
// created
final Collection<SigningMetadataFile> metadataFiles = loader.loadAvailableSigningMetadataTomlConfigs(filter);
assertThat(metadataFiles).hasSize(4);
assertThat(metadataFiles).containsOnly(metadataFile1, metadataFile2, metadataFile3, metadataFile4);
}
use of tech.pegasys.signers.secp256k1.multikey.MetadataFileFixture.KEY_FILE in project signers by ConsenSys.
the class FileBasedSigningMetadataFileTest method matchingMetadataFileWithPrefixShouldHaveExpectedName.
@Test
void matchingMetadataFileWithPrefixShouldHaveExpectedName() {
final String prefix = "bar_";
final FileBasedSigningMetadataFile fileBasedSigningMetadataFile = load(prefix + PREFIX_ADDRESS + CONFIG_FILE_EXTENSION, KEY_FILE, PASSWORD_FILE);
assertThat(fileBasedSigningMetadataFile.getFilename()).matches(prefix + PREFIX_ADDRESS + CONFIG_FILE_EXTENSION);
assertThat(fileBasedSigningMetadataFile.getConfig().getKeystoreFile().toFile().toString()).matches(KEY_FILE);
assertThat(fileBasedSigningMetadataFile.getConfig().getKeystorePasswordFile().toFile().toString()).matches(PASSWORD_FILE);
}
use of tech.pegasys.signers.secp256k1.multikey.MetadataFileFixture.KEY_FILE in project signers by ConsenSys.
the class SigningMetadataTomlConfigLoaderTest method singleValidFilesWhichMatchFilterAreLoaded.
@Test
void singleValidFilesWhichMatchFilterAreLoaded() {
final Filter<Path> filter = entry -> entry.toString().endsWith(LOWERCASE_ADDRESS + CONFIG_FILE_EXTENSION);
final FileBasedSigningMetadataFile fileBasedSigningMetadataFile = copyMetadataFileToDirectory(configsDirectory, LOWERCASE_ADDRESS + CONFIG_FILE_EXTENSION, KEY_FILE, PASSWORD_FILE);
final Optional<SigningMetadataFile> loadedMetadataFile = loader.loadMetadata(filter);
assertThat(loadedMetadataFile).isNotEmpty();
final FileBasedSigningMetadataFile fileBasedSigningMetadata = (FileBasedSigningMetadataFile) loadedMetadataFile.get();
assertThat(fileBasedSigningMetadata.getConfig().getKeystoreFile()).isEqualTo(fileBasedSigningMetadataFile.getConfig().getKeystoreFile());
assertThat(fileBasedSigningMetadata.getConfig().getKeystorePasswordFile()).isEqualTo(fileBasedSigningMetadataFile.getConfig().getKeystorePasswordFile());
}
Aggregations