|
|
|
@ -113,6 +113,8 @@ public class BesuCommandTest extends CommandTestAbstract { |
|
|
|
|
.put("config", (new JsonObject()).put("chainId", GENESIS_CONFIG_TEST_CHAINID)); |
|
|
|
|
private static final JsonObject GENESIS_INVALID_DATA = |
|
|
|
|
(new JsonObject()).put("config", new JsonObject()); |
|
|
|
|
private static final String ENCLAVE_PUBLIC_KEY_PATH = |
|
|
|
|
BesuCommand.class.getResource("/orion_publickey.pub").getPath(); |
|
|
|
|
|
|
|
|
|
private final String[] validENodeStrings = { |
|
|
|
|
"enode://" + VALID_NODE_ID + "@192.168.0.1:4567", |
|
|
|
@ -2680,6 +2682,44 @@ public class BesuCommandTest extends CommandTestAbstract { |
|
|
|
|
assertThat(enclaveArg.getValue().isEnabled()).isEqualTo(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void privacyMultiTenancyIsConfiguredWhenConfiguredWithNecessaryOptions() { |
|
|
|
|
when(storageService.getByName("rocksdb-privacy")) |
|
|
|
|
.thenReturn(Optional.of(rocksDBSPrivacyStorageFactory)); |
|
|
|
|
|
|
|
|
|
parseCommand( |
|
|
|
|
"--privacy-enabled", |
|
|
|
|
"--rpc-http-authentication-enabled", |
|
|
|
|
"--privacy-multi-tenancy-enabled", |
|
|
|
|
"--rpc-http-authentication-jwt-public-key-file", |
|
|
|
|
"/non/existent/file", |
|
|
|
|
"--privacy-public-key-file", |
|
|
|
|
ENCLAVE_PUBLIC_KEY_PATH); |
|
|
|
|
|
|
|
|
|
final ArgumentCaptor<PrivacyParameters> privacyParametersArgumentCaptor = |
|
|
|
|
ArgumentCaptor.forClass(PrivacyParameters.class); |
|
|
|
|
|
|
|
|
|
verify(mockControllerBuilder).privacyParameters(privacyParametersArgumentCaptor.capture()); |
|
|
|
|
verify(mockControllerBuilder).build(); |
|
|
|
|
|
|
|
|
|
assertThat(privacyParametersArgumentCaptor.getValue().isMultiTenancyEnabled()).isTrue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void privacyMultiTenancyWithoutAuthenticationFails() { |
|
|
|
|
parseCommand( |
|
|
|
|
"--privacy-enabled", |
|
|
|
|
"--privacy-multi-tenancy-enabled", |
|
|
|
|
"--rpc-http-authentication-jwt-public-key-file", |
|
|
|
|
"/non/existent/file", |
|
|
|
|
"--privacy-public-key-file", |
|
|
|
|
ENCLAVE_PUBLIC_KEY_PATH); |
|
|
|
|
|
|
|
|
|
assertThat(commandErrorOutput.toString()) |
|
|
|
|
.startsWith( |
|
|
|
|
"Privacy multi-tenancy requires either http authentication to be enabled or WebSocket authentication to be enabled"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Path createFakeGenesisFile(final JsonObject jsonGenesis) throws IOException { |
|
|
|
|
final Path genesisFile = Files.createTempFile("genesisFile", ""); |
|
|
|
|
Files.write(genesisFile, encodeJsonGenesis(jsonGenesis).getBytes(UTF_8)); |
|
|
|
|