CacheCreation implements InternalCache { void initializeRegions(Map<String, Region<?, ?>> declarativeRegions, Cache cache) { for (Region region : declarativeRegions.values()) { RegionCreation regionCreation = (RegionCreation) region; regionCreation.createRoot(cache); } } CacheCreation();  CacheCreation(boolean forParsing); static void clearThreadLocals(); @Override int getLockTimeout(); @Override void setLockTimeout(int seconds); @Override int getLockLease(); @Override void setLockLease(int seconds); @Override int getSearchTimeout(); @Override void setSearchTimeout(int seconds); @Override int getMessageSyncInterval(); @Override void setMessageSyncInterval(int seconds); @Override Set<Region<?, ?>> rootRegions(); @Override DiskStoreFactory createDiskStoreFactory(); static PoolManagerImpl getCurrentPoolManager(); void initializeDeclarablesMap(InternalCache cache); boolean sameAs(Cache other); @Override void close(); @Override void close(boolean keepAlive); @Override boolean isReconnecting(); @Override boolean waitUntilReconnected(long time, TimeUnit units); @Override void stopReconnecting(); @Override Cache getReconnectedCache(); @Override LogWriter getLogger(); @Override LogWriter getSecurityLogger(); @Override LogWriterI18n getLoggerI18n(); @Override LogWriterI18n getSecurityLoggerI18n(); @Override DistributedSystem getDistributedSystem(); @Override boolean isClosed(); @Override String getName(); @Override CancelCriterion getCancelCriterion(); @Override QueryService getQueryService(); @Override InternalQueryService getInternalQueryService(); @Override void lockDiskStore(String diskStoreName); @Override void unlockDiskStore(String diskStoreName); QueryConfigurationServiceCreation getQueryConfigurationServiceCreation(); void setQueryConfigurationServiceCreation(
      QueryConfigurationServiceCreation queryConfigurationServiceCreation); @Override JSONFormatter getJsonFormatter(); @Override RegionFactory<K, V> createRegionFactory(RegionShortcut shortcut); @Override RegionFactory<K, V> createRegionFactory(); @Override RegionFactory<K, V> createRegionFactory(String regionAttributesId); @Override RegionFactory<K, V> createRegionFactory(RegionAttributes<K, V> regionAttributes); @Override Region createVMRegion(String name, RegionAttributes aRegionAttributes); @Override Region createRegion(String name, RegionAttributes aRegionAttributes); Region createRegion(String name, String refid); @Override Region getRegion(String path); @Override CacheServer addCacheServer(); @Override InternalCacheServer addGatewayReceiverServer(GatewayReceiver gatewayReceiver); @Override @VisibleForTesting boolean removeCacheServer(final CacheServer cacheServer); @Override boolean removeGatewayReceiverServer(InternalCacheServer receiverServer); @Override void setReadSerializedForCurrentThread(final boolean value); @Override @VisibleForTesting void setReadSerializedForTest(final boolean value); @Override PdxInstanceFactory createPdxInstanceFactory(final String className,
      final boolean expectDomainClass); @Override void waitForRegisterInterestsInProgress(); @Override void reLoadClusterConfiguration(); @Override SecurityService getSecurityService(); @Override List<CacheServer> getCacheServers(); @Override void addGatewaySender(GatewaySender sender); @Override void addAsyncEventQueue(final AsyncEventQueueImpl asyncQueue); @Override void removeAsyncEventQueue(final AsyncEventQueue asyncQueue); @Override QueryMonitor getQueryMonitor(); @Override void close(final String reason, final Throwable systemFailureCause,
      final boolean keepAlive, final boolean keepDS, boolean skipAwait); @Override JmxManagerAdvisor getJmxManagerAdvisor(); @Override List<Properties> getDeclarableProperties(final String className); @Override long getUpTime(); @Override Set<Region<?, ?>> rootRegions(final boolean includePRAdminRegions); @Override Set<InternalRegion> getAllRegions(); @Override DistributedRegion getRegionInDestroy(final String path); @Override void addRegionOwnedDiskStore(final DiskStoreImpl dsi); @Override DiskStoreMonitor getDiskStoreMonitor(); @Override void close(final String reason, final Throwable optionalCause); @Override LocalRegion getRegionByPathForProcessing(final String path); @Override List<InternalCacheServer> getCacheServersAndGatewayReceiver(); @Override boolean isGlobalRegionInitializing(final String fullPath); @Override DistributionAdvisor getDistributionAdvisor(); @Override void setQueryMonitorRequiredForResourceManager(final boolean required); @Override boolean isQueryMonitorDisabledForLowMemory(); @Override boolean isRESTServiceRunning(); @Override InternalLogWriter getInternalLogWriter(); @Override InternalLogWriter getSecurityInternalLogWriter(); @Override Set<InternalRegion> getApplicationRegions(); @Override void removeGatewaySender(final GatewaySender sender); @Override DistributedLockService getGatewaySenderLockService(); @Override @VisibleForTesting RestAgent getRestAgent(); @Override Properties getDeclarableProperties(final Declarable declarable); @Override void setRESTServiceRunning(final boolean isRESTServiceRunning); @Override void close(final String reason, final boolean keepAlive, final boolean keepDS); @Override void addGatewayReceiver(GatewayReceiver receiver); @Override void removeGatewayReceiver(GatewayReceiver receiver); void addAsyncEventQueue(AsyncEventQueue asyncEventQueue); @Override Set<GatewaySender> getGatewaySenders(); @Override GatewaySender getGatewaySender(String id); @Override Set<GatewayReceiver> getGatewayReceivers(); @Override Set<AsyncEventQueue> getAsyncEventQueues(); @Override @VisibleForTesting Set<AsyncEventQueue> getAsyncEventQueues(boolean visibleOnly); @Override @VisibleForTesting void closeDiskStores(); @Override AsyncEventQueue getAsyncEventQueue(String id); @Override void setIsServer(boolean isServer); @Override boolean isServer(); void setDynamicRegionFactoryConfig(DynamicRegionFactory.Config v); @Override CacheTransactionManager getCacheTransactionManager(); @Override void setCopyOnRead(boolean copyOnRead); @Override boolean getCopyOnRead(); void addCacheTransactionManagerCreation(
      CacheTransactionManagerCreation cacheTransactionManagerCreation); @Override Context getJNDIContext(); @Override DiskStore findDiskStore(String name); void addDiskStore(DiskStore ds); @Override Collection<DiskStore> listDiskStores(); @Override RegionAttributes getRegionAttributes(String id); @Override void setRegionAttributes(String id, RegionAttributes attrs); @Override Map<String, RegionAttributes<?, ?>> listRegionAttributes(); @Override void loadCacheXml(InputStream is); @Override void readyForEvents(); Map<String, Pool> getPools(); PoolFactory createPoolFactory(); void setFunctionServiceCreation(FunctionServiceCreation functionServiceCreation); void setResourceManagerCreation(ResourceManagerCreation resourceManagerCreation); @Override ResourceManagerCreation getResourceManager(); void setSerializerCreation(SerializerCreation serializerCreation); void addBackup(File backup); @Override List<File> getBackupFiles(); @Override Region<K, V> getRegionByPath(String path); @Override InternalRegion getInternalRegionByPath(String path); @Override boolean isClient(); @Override InternalDistributedSystem getInternalDistributedSystem(); @Override Set<PartitionedRegion> getPartitionedRegions(); @Override void addRegionListener(final RegionListener regionListener); @Override void removeRegionListener(final RegionListener regionListener); @Override Set<RegionListener> getRegionListeners(); @Override GatewaySenderFactory createGatewaySenderFactory(); @Override GatewayReceiverFactory createGatewayReceiverFactory(); @Override AsyncEventQueueFactory createAsyncEventQueueFactory(); void setPdxReadSerialized(boolean readSerialized); void setPdxIgnoreUnreadFields(boolean ignore); void setPdxSerializer(PdxSerializer serializer); void setPdxDiskStore(String diskStore); void setPdxPersistent(boolean persistent); @Override boolean getPdxReadSerialized(); @Override PdxSerializer getPdxSerializer(); @Override String getPdxDiskStore(); @Override boolean getPdxPersistent(); @Override boolean getPdxIgnoreUnreadFields(); @Override CacheConfig getCacheConfig(); @Override boolean getPdxReadSerializedByAnyGemFireServices(); @Override void setDeclarativeCacheConfig(final CacheConfig cacheConfig); @Override void initializePdxRegistry(); @Override void readyDynamicRegionFactory(); @Override void setBackupFiles(final List<File> backups); @Override void addDeclarableProperties(final Map<Declarable, Properties> mapOfNewDeclarableProps); @Override Set<DistributedMember> getMembers(); @Override Set<DistributedMember> getAdminMembers(); @Override Set<DistributedMember> getMembers(Region region); @Override Declarable getInitializer(); @Override Properties getInitializerProps(); @Override void setInitializer(Declarable declarable, Properties props); @Override boolean hasPool(); @Override DiskStoreFactory createDiskStoreFactory(final DiskStoreAttributes attrs); @Override Region<K, V> basicCreateRegion(final String name,
      final RegionAttributes<K, V> attrs); @Override BackupService getBackupService(); @Override @VisibleForTesting Throwable getDisconnectCause(); @Override void addPartitionedRegion(final PartitionedRegion region); @Override void removePartitionedRegion(final PartitionedRegion region); @Override void addDiskStore(final DiskStoreImpl dsi); @Override TXEntryStateFactory getTXEntryStateFactory(); @Override EventTrackerExpiryTask getEventTrackerTask(); @Override void removeDiskStore(final DiskStoreImpl diskStore); @Override void setGatewayConflictResolver(GatewayConflictResolver resolver); @Override GatewayConflictResolver getGatewayConflictResolver(); @Override PdxInstanceFactory createPdxInstanceFactory(String className); @Override PdxInstance createPdxEnum(String className, String enumName, int enumOrdinal); @Override CacheSnapshotService getSnapshotService(); @Override ExtensionPoint<Cache> getExtensionPoint(); @Override InternalDistributedMember getMyId(); @Override Collection<DiskStore> listDiskStoresIncludingRegionOwned(); @Override CqService getCqService(); @Override T getService(Class<T> clazz); @Override Optional<T> getOptionalService(Class<T> clazz); @Override Collection<CacheService> getServices(); @Override SystemTimer getCCPTimer(); @Override void cleanupForClient(final CacheClientNotifier cacheClientNotifier,
      final ClientProxyMembershipID client); @Override void purgeCCPTimer(); @Override FilterProfile getFilterProfile(final String regionName); @Override Region getRegion(final String path, final boolean returnDestroyedRegion); @Override MemoryAllocator getOffHeapStore(); @Override Region<K, V> createVMRegion(final String name, final RegionAttributes<K, V> p_attrs,
      final InternalRegionArguments internalRegionArgs); @Override DistributedLockService getPartitionedRegionLockService(); @Override PersistentMemberManager getPersistentMemberManager(); @Override Set<GatewaySender> getAllGatewaySenders(); @Override CachePerfStats getCachePerfStats(); @Override DistributionManager getDistributionManager(); @Override void regionReinitialized(final Region region); @Override void setRegionByPath(final String path, final InternalRegion r); @Override InternalResourceManager getInternalResourceManager(); @Override ResourceAdvisor getResourceAdvisor(); @Override boolean isCacheAtShutdownAll(); @Override boolean requiresNotificationFromPR(final PartitionedRegion r); @Override RegionAttributes<K, V> invokeRegionBefore(final InternalRegion parent,
      final String name, final RegionAttributes<K, V> attrs,
      final InternalRegionArguments internalRegionArgs); @Override void invokeRegionAfter(final InternalRegion region); @Override void invokeBeforeDestroyed(final InternalRegion region); @Override void invokeCleanupFailedInitialization(final InternalRegion region); @Override TXManagerImpl getTXMgr(); @Override boolean forcedDisconnect(); @Override InternalResourceManager getInternalResourceManager(
      final boolean checkCancellationInProgress); @Override boolean isCopyOnRead(); @Override TombstoneService getTombstoneService(); @Override QueryService getLocalQueryService(); @Override void registerInterestStarted(); @Override void registerInterestCompleted(); @Override void regionReinitializing(final String fullPath); @Override void unregisterReinitializingRegion(final String fullPath); @Override boolean removeRoot(final InternalRegion rootRgn); @Override Executor getEventThreadPool(); @Override LocalRegion getReinitializingRegion(final String fullPath); @Override boolean keepDurableSubscriptionsAlive(); @Override CacheClosedException getCacheClosedException(final String reason); @Override CacheClosedException getCacheClosedException(final String reason, final Throwable cause); @Override TypeRegistry getPdxRegistry(); @Override DiskStoreImpl getOrCreateDefaultDiskStore(); @Override ExpirationScheduler getExpirationScheduler(); @Override TransactionManager getJTATransactionManager(); @Override TXManagerImpl getTxManager(); @Override void beginDestroy(final String path, final DistributedRegion region); @Override void endDestroy(final String path, final DistributedRegion region); @Override ClientMetadataService getClientMetadataService(); @Override long cacheTimeMillis(); @Override void initialize(); @Override URL getCacheXmlURL(); @Override boolean hasPersistentRegion(); @Override void shutDownAll(); @Override void invokeRegionEntrySynchronizationListenersAfterSynchronization(
      InternalDistributedMember sender, InternalRegion region,
      List<InitialImageOperation.Entry> entriesToSynchronize); @Override Object convertPdxInstanceIfNeeded(Object obj, boolean preferCD); @Override Boolean getPdxReadSerializedOverride(); @Override void setPdxReadSerializedOverride(boolean pdxReadSerialized); @Override void registerPdxMetaData(Object instance); @Override InternalCacheForClientAccess getCacheForProcessingClientRequests(); @Override void throwCacheExistsException(); @Override MeterRegistry getMeterRegistry(); @Override void saveCacheXmlForReconnect(); @Override @VisibleForTesting HeapEvictor getHeapEvictor(); @Override @VisibleForTesting OffHeapEvictor getOffHeapEvictor(); @Override StatisticsClock getStatisticsClock();  }
@Test public void declarativeRegionIsCreated() { CacheCreation cacheCreation = new CacheCreation(); RegionCreation declarativeRegion = mock(RegionCreation.class); Map<String, Region<?, ?>> declarativeRegions = new HashMap<>(); declarativeRegions.put("testRegion", declarativeRegion); cacheCreation.initializeRegions(declarativeRegions, cache); verify(declarativeRegion, times(1)).createRoot(cache); }