Search in sources :

Example 16 with AdminException

use of org.apache.geode.admin.AdminException in project geode by apache.

the class IncrementalBackupDUnitTest method incremental.

/**
   * Invokes {@link AdminDistributedSystem#backupAllMembers(File, File)} on a member.
   * 
   * @param vm a member of the distributed system.
   * @return a status of the backup operation.
   */
private BackupStatus incremental(VM vm) {
    return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members.") {

        @Override
        public Object call() {
            DistributedSystemConfig config;
            AdminDistributedSystem adminDS = null;
            try {
                config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
                adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
                adminDS.connect();
                return adminDS.backupAllMembers(getIncrementalDir(), getBaselineBackupDir());
            } catch (AdminException e) {
                throw new RuntimeException(e);
            } finally {
                if (adminDS != null) {
                    adminDS.disconnect();
                }
            }
        }
    });
}
Also used : AdminException(org.apache.geode.admin.AdminException) DistributedSystemConfig(org.apache.geode.admin.DistributedSystemConfig) SerializableCallable(org.apache.geode.test.dunit.SerializableCallable) AdminDistributedSystem(org.apache.geode.admin.AdminDistributedSystem) BackupStatus(org.apache.geode.admin.BackupStatus)

Aggregations

AdminException (org.apache.geode.admin.AdminException)16 DistributedSystemConfig (org.apache.geode.admin.DistributedSystemConfig)8 AdminDistributedSystem (org.apache.geode.admin.AdminDistributedSystem)7 OperationCancelledException (org.apache.geode.admin.OperationCancelledException)6 Set (java.util.Set)4 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)4 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)4 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)4 Test (org.junit.Test)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 BackupStatus (org.apache.geode.admin.BackupStatus)3 PersistentID (org.apache.geode.cache.persistence.PersistentID)3 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)3 Host (org.apache.geode.test.dunit.Host)3 VM (org.apache.geode.test.dunit.VM)3 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)3 Cache (org.apache.geode.cache.Cache)2 Region (org.apache.geode.cache.Region)2 DiskRegion (org.apache.geode.internal.cache.DiskRegion)2