@Test public void gatewayReceiverCanBeCreatedButIsNotPersistedWithoutConfigurationService() { doReturn(mock(Set.class)).when(command).getMembers(any(), any()); doReturn(null).when(command).getConfigurationPersistenceService(); result1 = new CliFunctionResult("member", CliFunctionResult.StatusState.OK, "result1"); functionResults.add(result1); gfsh.executeAndAssertThat(command, "create gateway-receiver").statusIsSuccess() .containsOutput( "Cluster configuration service is not running. Configuration change is not persisted"); verify(ccService, never()).addXmlEntity(any(), any()); verify(ccService, never()).updateCacheConfig(any(), any()); }
@Test public void gatewayReceiverIsCreatedButNotPersistedWithMemberOption() { doReturn(mock(Set.class)).when(command).getMembers(any(), any()); doReturn(ccService).when(command).getConfigurationPersistenceService(); result1 = new CliFunctionResult("member", CliFunctionResult.StatusState.OK, "result1"); functionResults.add(result1); gfsh.executeAndAssertThat(command, "create gateway-receiver --member=xyz").statusIsSuccess() .containsOutput( "Configuration change is not persisted because the command is executed on specific member"); verify(ccService, never()).addXmlEntity(any(), any()); verify(ccService, never()).updateCacheConfig(any(), any()); }
persistClusterConfiguration(result, () -> { ((InternalConfigurationPersistenceService) getConfigurationPersistenceService()) .addXmlEntity(xmlEntity, null); });
if (null != xmlEntity.get()) { if (addXmlElement) { ccService.addXmlEntity(xmlEntity.get(), null); } else { ccService.deleteXmlEntity(xmlEntity.get(), null);