use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class EncryptionMXBeanTest method testMasterKeyChangeOnInactiveAndReadonlyCluster.
/**
* @throws Exception If failed.
*/
@Test
public void testMasterKeyChangeOnInactiveAndReadonlyCluster() throws Exception {
IgniteEx grid0 = startGrid(GRID_0);
assertFalse(grid0.cluster().active());
EncryptionMXBean mBean = getMBean(GRID_0);
assertEquals(DEFAULT_MASTER_KEY_NAME, grid0.encryption().getMasterKeyName());
assertThrowsWithCause(() -> mBean.changeMasterKey(MASTER_KEY_NAME_2), IgniteException.class);
assertEquals(DEFAULT_MASTER_KEY_NAME, grid0.encryption().getMasterKeyName());
grid0.cluster().state(ACTIVE_READ_ONLY);
mBean.changeMasterKey(MASTER_KEY_NAME_2);
assertEquals(MASTER_KEY_NAME_2, grid0.encryption().getMasterKeyName());
}
Aggregations