use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class EncryptionMXBeanTest method testMasterKeyChangeTheSameKeyName.
/**
* @throws Exception If failed.
*/
@Test
public void testMasterKeyChangeTheSameKeyName() throws Exception {
IgniteEx ignite = startGrid(GRID_0);
ignite.cluster().active(true);
EncryptionMXBean mBean = getMBean(GRID_0);
assertEquals(DEFAULT_MASTER_KEY_NAME, ignite.encryption().getMasterKeyName());
mBean.changeMasterKey(MASTER_KEY_NAME_2);
assertEquals(MASTER_KEY_NAME_2, ignite.encryption().getMasterKeyName());
assertThrowsWithCause(() -> mBean.changeMasterKey(MASTER_KEY_NAME_2), IgniteException.class);
assertEquals(MASTER_KEY_NAME_2, ignite.encryption().getMasterKeyName());
}
use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class EncryptionMXBeanTest method testMasterKeyChangeFromClient.
/**
* @throws Exception If failed.
*/
@Test
public void testMasterKeyChangeFromClient() throws Exception {
IgniteEx ignite = startGrid(GRID_0);
IgniteEx client = startClientGrid(getConfiguration("client"));
ignite.cluster().active(true);
EncryptionMXBean mBean = getMBean(client.name());
assertEquals(DEFAULT_MASTER_KEY_NAME, ignite.encryption().getMasterKeyName());
assertThrowsWithCause(mBean::getMasterKeyName, UnsupportedOperationException.class);
assertThrowsWithCause(() -> mBean.changeMasterKey(MASTER_KEY_NAME_2), IgniteException.class);
assertEquals(DEFAULT_MASTER_KEY_NAME, ignite.encryption().getMasterKeyName());
}
use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class IgniteMBeansManager method registerMBeansAfterNodeStarted.
/**
* Registers kernal MBeans (for kernal, metrics, thread pools) after node start.
*
* @throws IgniteCheckedException if fails to register any of the MBeans.
*/
public void registerMBeansAfterNodeStarted() throws IgniteCheckedException {
if (U.IGNITE_MBEANS_DISABLED)
return;
// Kernal
IgniteMXBean kernalMXBean = new IgniteMXBeanImpl(kernal);
registerMBean("Kernal", IgniteKernal.class.getSimpleName(), kernalMXBean, IgniteMXBean.class);
// Metrics
ClusterMetricsMXBean locMetricsBean = new ClusterLocalNodeMetricsMXBeanImpl(ctx.discovery());
registerMBean("Kernal", locMetricsBean.getClass().getSimpleName(), locMetricsBean, ClusterMetricsMXBean.class);
ClusterMetricsMXBean metricsBean = new ClusterMetricsMXBeanImpl(kernal.cluster(), ctx);
registerMBean("Kernal", metricsBean.getClass().getSimpleName(), metricsBean, ClusterMetricsMXBean.class);
// Transaction metrics
TransactionMetricsMxBean txMetricsMXBean = new TransactionMetricsMxBeanImpl(ctx.cache().transactions().metrics());
registerMBean("TransactionMetrics", txMetricsMXBean.getClass().getSimpleName(), txMetricsMXBean, TransactionMetricsMxBean.class);
// Transactions
TransactionsMXBean txMXBean = new TransactionsMXBeanImpl(ctx);
registerMBean("Transactions", txMXBean.getClass().getSimpleName(), txMXBean, TransactionsMXBean.class);
// Queries management
QueryMXBean qryMXBean = new QueryMXBeanImpl(ctx);
registerMBean("Query", qryMXBean.getClass().getSimpleName(), qryMXBean, QueryMXBean.class);
// Compute task management
ComputeMXBean computeMXBean = new ComputeMXBeanImpl(ctx);
registerMBean("Compute", computeMXBean.getClass().getSimpleName(), computeMXBean, ComputeMXBean.class);
// Service management
ServiceMXBean serviceMXBean = new ServiceMXBeanImpl(ctx);
registerMBean("Service", serviceMXBean.getClass().getSimpleName(), serviceMXBean, ServiceMXBean.class);
// Data storage
DataStorageMXBean dataStorageMXBean = new DataStorageMXBeanImpl(ctx);
registerMBean("DataStorage", dataStorageMXBean.getClass().getSimpleName(), dataStorageMXBean, DataStorageMXBean.class);
// Baseline configuration
BaselineAutoAdjustMXBean baselineAutoAdjustMXBean = new BaselineAutoAdjustMXBeanImpl(ctx);
registerMBean("Baseline", baselineAutoAdjustMXBean.getClass().getSimpleName(), baselineAutoAdjustMXBean, BaselineAutoAdjustMXBean.class);
// Encryption
EncryptionMXBean encryptionMXBean = new EncryptionMXBeanImpl(ctx);
registerMBean("Encryption", encryptionMXBean.getClass().getSimpleName(), encryptionMXBean, EncryptionMXBean.class);
// Snapshot.
SnapshotMXBean snpMXBean = new SnapshotMXBeanImpl(ctx);
registerMBean("Snapshot", snpMXBean.getClass().getSimpleName(), snpMXBean, SnapshotMXBean.class);
// Defragmentation.
DefragmentationMXBean defragMXBean = new DefragmentationMXBeanImpl(ctx);
registerMBean("Defragmentation", defragMXBean.getClass().getSimpleName(), defragMXBean, DefragmentationMXBean.class);
// Metrics configuration
MetricsMxBean metricsMxBean = new MetricsMxBeanImpl(ctx.metric(), log);
registerMBean("Metrics", metricsMxBean.getClass().getSimpleName(), metricsMxBean, MetricsMxBean.class);
ctx.pools().registerMxBeans(this);
if (U.IGNITE_TEST_FEATURES_ENABLED) {
WorkersControlMXBean workerCtrlMXBean = new WorkersControlMXBeanImpl(ctx.workersRegistry());
registerMBean("Kernal", workerCtrlMXBean.getClass().getSimpleName(), workerCtrlMXBean, WorkersControlMXBean.class);
}
FailureHandlingMxBean blockOpCtrlMXBean = new FailureHandlingMxBeanImpl(ctx.workersRegistry(), ctx.cache().context().database());
registerMBean("Kernal", blockOpCtrlMXBean.getClass().getSimpleName(), blockOpCtrlMXBean, FailureHandlingMxBean.class);
if (ctx.query().moduleEnabled())
ctx.query().getIndexing().registerMxBeans(this);
PerformanceStatisticsMBeanImpl performanceStatMbean = new PerformanceStatisticsMBeanImpl(ctx);
registerMBean("PerformanceStatistics", performanceStatMbean.getClass().getSimpleName(), performanceStatMbean, PerformanceStatisticsMBean.class);
}
use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class EncryptionMXBeanTest method testCacheGroupKeyChange.
/**
* @throws Exception If failed.
*/
@Test
public void testCacheGroupKeyChange() throws Exception {
IgniteEx ignite = startGrid(GRID_0);
ignite.cluster().active(true);
createEncryptedCache(ignite, null, cacheName(), null);
EncryptionMXBean mBean = getMBean(GRID_0);
int grpId = CU.cacheId(cacheName());
assertEquals(INITIAL_KEY_ID, ignite.context().encryption().getActiveKey(grpId).id());
mBean.changeCacheGroupKey(cacheName());
assertEquals(INITIAL_KEY_ID + 1, ignite.context().encryption().getActiveKey(grpId).id());
checkGroupKey(grpId, INITIAL_KEY_ID + 1, getTestTimeout());
}
use of org.apache.ignite.mxbean.EncryptionMXBean in project ignite by apache.
the class EncryptionMXBeanTest method testMasterKeyChange.
/**
* @throws Exception If failed.
*/
@Test
public void testMasterKeyChange() throws Exception {
IgniteEx ignite = startGrid(GRID_0);
ignite.cluster().active(true);
EncryptionMXBean mBean = getMBean(GRID_0);
assertEquals(DEFAULT_MASTER_KEY_NAME, ignite.encryption().getMasterKeyName());
assertEquals(DEFAULT_MASTER_KEY_NAME, mBean.getMasterKeyName());
mBean.changeMasterKey(MASTER_KEY_NAME_2);
assertEquals(MASTER_KEY_NAME_2, ignite.encryption().getMasterKeyName());
assertEquals(MASTER_KEY_NAME_2, mBean.getMasterKeyName());
}
Aggregations