/** Install a PersistenceObserver to help tests create a "tie" on disk recovery. */ public static void installPersistenceObserver() { PersistenceObserver observer = RecoveryPrms.getPersistenceObserver(); if (observer == null) { Log.getLogWriter().info("No PersistenceObserver was specified"); } else { Log.getLogWriter().info("Installing " + observer.getClass().getName()); PersistenceObserverHolder.setInstance(observer); } }
/** Creates and initializes a server or peer. */ public static synchronized void HydraTask_initializeExpectException() throws Throwable { if (RecoveryTest.testInstance == null) { RecoveryTest.testInstance = new RecoveryTest(); int numRootRegions = RecoveryPrms.getNumRootRegions(); int numSubregions = RecoveryPrms.getNumSubregions(); int hierDepth = RecoveryPrms.getRegionHierarchyDepth(); if ((numSubregions != 0) || (hierDepth != 1)) { throw new TestException("Unable to handle subregions in this test"); } CacheHelper.createCache("cache1"); final String regionConfigName = TestConfig.tasktab() .stringAt( RecoveryPrms.regionConfigNames, TestConfig.tab().stringAt(RecoveryPrms.regionConfigNames, null)); String createdRegions = ""; for (int i = 1; i <= numRootRegions; i++) { try { final String regionName = "Region_" + i; createdRegions = createdRegions + RegionHelper.createRegion(regionName, regionConfigName).getFullPath() + " "; } catch (ConflictingPersistentDataException e) { Log.getLogWriter().info("Caught expected exception " + TestHelper.getStackTrace(e)); } } if (createdRegions.length() > 0) { throw new TestException( "Expected to get " + ConflictingPersistentDataException.class.getName() + " on region creation, but the following regions were successfully created: " + createdRegions); } } }