public void startServer() { CacheFactory cf = new CacheFactory(this.properties); cf.setPdxPersistent(pdxPersistent); cf.setPdxReadSerialized(pdxReadSerialized); if (pdxSerializer != null) { cf.setPdxSerializer(pdxSerializer); } cache = (InternalCache) cf.create(); DistributionConfig config = ((InternalDistributedSystem) cache.getDistributedSystem()).getConfig(); jmxPort = config.getJmxManagerPort(); httpPort = config.getHttpServicePort(); if (!noCacheServer) { server = cache.addCacheServer(); // memberPort is by default zero, which translates to "randomly select an available port," // which is why it is updated after this try block server.setPort(memberPort); try { server.start(); } catch (IOException e) { throw new RuntimeException("unable to start server", e); } memberPort = server.getPort(); } }
@Override public Cache createCache(Properties gemfireProperties, ServerLauncher serverLauncher) { final CacheConfig cacheConfig = serverLauncher.getCacheConfig(); final CacheFactory cacheFactory = new CacheFactory(gemfireProperties); if (cacheConfig.pdxPersistentUserSet) { cacheFactory.setPdxPersistent(cacheConfig.isPdxPersistent()); } if (cacheConfig.pdxDiskStoreUserSet) { cacheFactory.setPdxDiskStore(cacheConfig.getPdxDiskStore()); } if (cacheConfig.pdxIgnoreUnreadFieldsUserSet) { cacheFactory.setPdxIgnoreUnreadFields(cacheConfig.getPdxIgnoreUnreadFields()); } if (cacheConfig.pdxReadSerializedUserSet) { cacheFactory.setPdxReadSerialized(cacheConfig.isPdxReadSerialized()); } if (cacheConfig.pdxSerializerUserSet) { cacheFactory.setPdxSerializer(cacheConfig.getPdxSerializer()); } return cacheFactory.create(); } }
.when(cacheFactorySpy).setPdxPersistent(anyBoolean());