Пример #1
0
 /**
  * Create a region with the given region description name.
  *
  * @param regDescriptName The name of a region description.
  */
 protected void initializeRegion(String regDescriptName) {
   CacheHelper.createCache("cache1");
   String key = VmIDStr + RemoteTestModule.getMyVmid();
   String xmlFile = key + ".xml";
   try {
     CacheHelper.generateCacheXmlFile("cache1", regDescriptName, xmlFile);
   } catch (HydraRuntimeException e) {
     if (e.toString().indexOf("Cache XML file was already created") >= 0) {
       // this can occur when reinitializing after a stop-start because
       // the cache xml file is written during the first init tasks
     } else {
       throw new TestException(TestHelper.getStackTrace(e));
     }
   }
   aRegion = RegionHelper.createRegion(regDescriptName);
 }
 /** 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);
     }
   }
 }