use of org.jboss.as.controller.client.helpers.domain.DomainClient in project wildfly by wildfly.
the class ModelPersistenceTestCase method testDomainOperationRollback.
@Test
public void testDomainOperationRollback() throws Exception {
DomainClient client = domainMasterLifecycleUtil.getDomainClient();
CfgFileDescription lastDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
// execute operation so the model gets updated
ModelNode op = ModelUtil.createOpNode("system-property=model-persistence-test", "add");
op.get(VALUE).set("test");
executeAndRollbackOperation(client, op);
// check that the model has not been updated
CfgFileDescription newDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription newMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription newSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
// check that the configs did not change
Assert.assertTrue(lastDomainBackupDesc.version == newDomainBackupDesc.version);
Assert.assertTrue(lastMasterBackupDesc.version == newMasterBackupDesc.version);
Assert.assertTrue(lastSlaveBackupDesc.version == newSlaveBackupDesc.version);
}
use of org.jboss.as.controller.client.helpers.domain.DomainClient in project wildfly by wildfly.
the class ModelPersistenceTestCase method testHostOperationRollback.
@Test
public void testHostOperationRollback() throws Exception {
DomainClient client = domainMasterLifecycleUtil.getDomainClient();
for (Host host : Host.values()) {
CfgFileDescription lastDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
// execute operation so the model gets updated
ModelNode op = host.equals(Host.MASTER) ? ModelUtil.createOpNode("host=master/system-property=model-persistence-test", "add") : ModelUtil.createOpNode("host=slave/system-property=model-persistence-test", "add");
op.get(VALUE).set("test");
executeAndRollbackOperation(client, op);
// check that the model has not been updated
CfgFileDescription newDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription newMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription newSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
// check that the configs did not change
Assert.assertTrue(lastDomainBackupDesc.version == newDomainBackupDesc.version);
Assert.assertTrue(lastMasterBackupDesc.version == newMasterBackupDesc.version);
Assert.assertTrue(lastSlaveBackupDesc.version == newSlaveBackupDesc.version);
}
}
use of org.jboss.as.controller.client.helpers.domain.DomainClient in project wildfly by wildfly.
the class ModelPersistenceTestCase method testDomainOperation.
private void testDomainOperation(ModelNode operation) throws Exception {
DomainClient client = domainMasterLifecycleUtil.getDomainClient();
CfgFileDescription lastBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
long lastFileHash = domainLastCfgFile.exists() ? FileUtils.checksumCRC32(domainLastCfgFile) : -1;
// execute operation so the model gets updated
executeOperation(client, operation);
// check that the automated snapshot of the domain has been generated
CfgFileDescription newBackupDesc = getLatestBackup(domainCurrentCfgDir);
Assert.assertNotNull("Model snapshot not found.", newBackupDesc);
// check that the version is incremented by one
Assert.assertTrue(lastBackupDesc.version == newBackupDesc.version - 1);
// check that the both master and slave host snapshot have not been generated
CfgFileDescription newMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription newSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
Assert.assertTrue(lastMasterBackupDesc.version == newMasterBackupDesc.version);
Assert.assertTrue(lastSlaveBackupDesc.version == newSlaveBackupDesc.version);
// check that the last cfg file has changed
Assert.assertTrue(lastFileHash != FileUtils.checksumCRC32(domainLastCfgFile));
}
use of org.jboss.as.controller.client.helpers.domain.DomainClient in project eap-additional-testsuite by jboss-set.
the class ModelPersistenceTestCase method testHostOperation.
private void testHostOperation(ModelNode operation, Host controller, Host target) throws Exception {
DomainClient client = controller.equals(Host.MASTER) ? domainMasterLifecycleUtil.getDomainClient() : domainSlaveLifecycleUtil.getDomainClient();
CfgFileDescription lastDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
CfgFileDescription lastMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription lastSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
long lastDomainFileHash = domainLastCfgFile.exists() ? FileUtils.checksumCRC32(domainLastCfgFile) : -1;
long lastMasterFileHash = masterLastCfgFile.exists() ? FileUtils.checksumCRC32(masterLastCfgFile) : -1;
long lastSlaveFileHash = slaveLastCfgFile.exists() ? FileUtils.checksumCRC32(slaveLastCfgFile) : -1;
// execute operation so the model gets updated
executeOperation(client, operation);
// check that the automated snapshot of the domain has not been generated
CfgFileDescription newDomainBackupDesc = getLatestBackup(domainCurrentCfgDir);
Assert.assertTrue(lastDomainBackupDesc.version == newDomainBackupDesc.version);
// check that only the appropriate host snapshot has been generated
CfgFileDescription newMasterBackupDesc = getLatestBackup(masterCurrentCfgDir);
CfgFileDescription newSlaveBackupDesc = getLatestBackup(slaveCurrentCfgDir);
if (target == Host.MASTER) {
Assert.assertTrue(lastMasterBackupDesc.version == newMasterBackupDesc.version - 1);
Assert.assertTrue(lastSlaveBackupDesc.version == newSlaveBackupDesc.version);
Assert.assertTrue(lastMasterFileHash != FileUtils.checksumCRC32(masterLastCfgFile));
Assert.assertTrue(lastSlaveFileHash == FileUtils.checksumCRC32(slaveLastCfgFile));
} else {
Assert.assertTrue(lastMasterBackupDesc.version == newMasterBackupDesc.version);
Assert.assertTrue(lastSlaveBackupDesc.version == newSlaveBackupDesc.version - 1);
Assert.assertTrue(lastMasterFileHash == FileUtils.checksumCRC32(masterLastCfgFile));
Assert.assertTrue(lastSlaveFileHash != FileUtils.checksumCRC32(slaveLastCfgFile));
}
Assert.assertTrue(lastDomainBackupDesc.version == newDomainBackupDesc.version);
Assert.assertTrue(lastDomainFileHash == FileUtils.checksumCRC32(domainLastCfgFile));
}
Aggregations