private CacheConfig.GatewayReceiver buildConfiguration(Boolean manualStart, Integer startPort, Integer endPort, String bindAddress, Integer maximumTimeBetweenPings, Integer socketBufferSize, String[] gatewayTransportFilters, String hostnameForSenders) { CacheConfig.GatewayReceiver configuration = new CacheConfig.GatewayReceiver(); if (gatewayTransportFilters != null) { List<DeclarableType> filters = Arrays.stream(gatewayTransportFilters).map(fullyQualifiedClassName -> { DeclarableType thisFilter = new DeclarableType(); thisFilter.setClassName(fullyQualifiedClassName); return thisFilter; }).collect(Collectors.toList()); configuration.getGatewayTransportFilters().addAll(filters); } if (startPort != null) { configuration.setStartPort(String.valueOf(startPort)); } if (endPort != null) { configuration.setEndPort(String.valueOf(endPort)); } configuration.setBindAddress(bindAddress); if (maximumTimeBetweenPings != null) { configuration.setMaximumTimeBetweenPings(String.valueOf(maximumTimeBetweenPings)); } if (socketBufferSize != null) { configuration.setSocketBufferSize(String.valueOf(socketBufferSize)); } configuration.setHostnameForSenders(hostnameForSenders); configuration.setManualStart(manualStart); return configuration; }
public GatewayReceiverFunctionArgs(GatewayReceiver configuration, Boolean ifNotExists) { this.manualStart = configuration.isManualStart(); this.startPort = configuration.getStartPort() != null ? Integer.valueOf(configuration.getStartPort()) : null; this.endPort = configuration.getEndPort() != null ? Integer.valueOf(configuration.getEndPort()) : null; this.bindAddress = configuration.getBindAddress(); this.socketBufferSize = configuration.getSocketBufferSize() != null ? Integer.valueOf(configuration.getSocketBufferSize()) : null; this.maximumTimeBetweenPings = configuration.getMaximumTimeBetweenPings() != null ? Integer.valueOf(configuration.getMaximumTimeBetweenPings()) : null; this.gatewayTransportFilters = configuration.getGatewayTransportFilters() != null ? configuration.getGatewayTransportFilters().stream().map(DeclarableType::getClassName) .toArray(String[]::new) : null; this.hostnameForSenders = configuration.getHostnameForSenders(); this.ifNotExists = ifNotExists; }
.isEqualTo(declarableWithString); assertThat(cacheConfig.getGatewayConflictResolver()).isEqualTo(declarableWithString); assertThat(cacheConfig.getGatewayReceiver().getGatewayTransportFilters().get(0)) .isEqualTo(declarableWithString); assertThat(cacheConfig.getGatewayHubs().get(0).getGateway().get(0).getGatewayListeners().get(0))
@CliCommand(value = DESTROY_GATEWAYRECEIVER, help = DESTROY_GATEWAYRECEIVER__HELP) @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN) @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER, operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.GATEWAY) public ResultModel destroyGatewayReceiver( @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, optionContext = ConverterHint.MEMBERGROUP, help = DESTROY_GATEWAYRECEIVER__GROUP__HELP) String[] onGroups, @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS}, optionContext = ConverterHint.MEMBERIDNAME, help = DESTROY_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember, @CliOption(key = CliStrings.IFEXISTS, help = CliStrings.IFEXISTS_HELP, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean ifExists) { boolean persisted = true; Set<DistributedMember> members = getMembers(onGroups, onMember); List<CliFunctionResult> functionResults = executeAndGetFunctionResult(DestroyGatewayReceiverFunction.INSTANCE, null, members); ResultModel result = ResultModel.createMemberStatusResult(functionResults, ifExists); result.setConfigObject(new CacheConfig.GatewayReceiver()); return result; }
public static void setBasicValues(CacheConfig cache) { cache.setCopyOnRead(true); CacheConfig.GatewayReceiver receiver = new CacheConfig.GatewayReceiver(); receiver.setBindAddress("localhost"); receiver.setEndPort("8080"); receiver.setManualStart(false); receiver.setStartPort("6000"); cache.setGatewayReceiver(receiver); cache.setVersion("1.0"); RegionConfig region = new RegionConfig(); region.setName("testRegion"); region.setType("REPLICATE"); cache.getRegions().add(region); }
@Test public void updateGatewayReceiverConfig() { service.updateCacheConfig("cluster", cacheConfig -> { CacheConfig.GatewayReceiver receiver = new CacheConfig.GatewayReceiver(); cacheConfig.setGatewayReceiver(receiver); return cacheConfig; }); System.out.println(configuration.getCacheXmlContent()); assertThat(configuration.getCacheXmlContent()).contains("<gateway-receiver/>"); }