Search in sources :

Example 41 with InvalidConfigurationException

use of com.hazelcast.config.InvalidConfigurationException in project hazelcast by hazelcast.

the class MapContainer method initWanReplication.

public void initWanReplication(NodeEngine nodeEngine) {
    WanReplicationRef wanReplicationRef = mapConfig.getWanReplicationRef();
    if (wanReplicationRef == null) {
        return;
    }
    String wanReplicationRefName = wanReplicationRef.getName();
    Config config = nodeEngine.getConfig();
    if (!TRUE.equals(mapConfig.getMerkleTreeConfig().getEnabled()) && hasPublisherWithMerkleTreeSync(config, wanReplicationRefName)) {
        throw new InvalidConfigurationException("Map " + name + " has disabled merkle trees but the WAN replication scheme " + wanReplicationRefName + " has publishers that use merkle trees." + " Please enable merkle trees for the map.");
    }
    WanReplicationService wanReplicationService = nodeEngine.getWanReplicationService();
    wanReplicationDelegate = wanReplicationService.getWanReplicationPublishers(wanReplicationRefName);
    SplitBrainMergePolicyProvider mergePolicyProvider = nodeEngine.getSplitBrainMergePolicyProvider();
    wanMergePolicy = mergePolicyProvider.getMergePolicy(wanReplicationRef.getMergePolicyClassName());
    checkMapMergePolicy(mapConfig, wanReplicationRef.getMergePolicyClassName(), mergePolicyProvider);
    WanReplicationConfig wanReplicationConfig = config.getWanReplicationConfig(wanReplicationRefName);
    if (wanReplicationConfig != null) {
        WanConsumerConfig wanConsumerConfig = wanReplicationConfig.getConsumerConfig();
        if (wanConsumerConfig != null) {
            persistWanReplicatedData = wanConsumerConfig.isPersistWanReplicatedData();
        }
    }
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) MapConfig(com.hazelcast.config.MapConfig) IndexConfig(com.hazelcast.config.IndexConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanSyncConfig(com.hazelcast.config.WanSyncConfig) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationService(com.hazelcast.wan.impl.WanReplicationService) SplitBrainMergePolicyProvider(com.hazelcast.spi.merge.SplitBrainMergePolicyProvider) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException)

Example 42 with InvalidConfigurationException

use of com.hazelcast.config.InvalidConfigurationException in project hazelcast by hazelcast.

the class RegionValidatorTest method validateInvalidRegion.

@Test
public void validateInvalidRegion() {
    // given
    String region = "us-wrong-1";
    String expectedMessage = String.format("The provided region %s is not a valid AWS region.", region);
    // when
    Runnable validateRegion = () -> RegionValidator.validateRegion(region);
    // then
    InvalidConfigurationException thrownEx = assertThrows(InvalidConfigurationException.class, validateRegion);
    assertEquals(expectedMessage, thrownEx.getMessage());
}
Also used : InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException) Test(org.junit.Test)

Example 43 with InvalidConfigurationException

use of com.hazelcast.config.InvalidConfigurationException in project hazelcast by hazelcast.

the class RegionValidatorTest method validateInvalidGovRegion.

@Test
public void validateInvalidGovRegion() {
    // given
    String region = "us-gov-wrong-1";
    String expectedMessage = String.format("The provided region %s is not a valid AWS region.", region);
    // when
    Runnable validateRegion = () -> RegionValidator.validateRegion(region);
    // then
    InvalidConfigurationException thrownEx = assertThrows(InvalidConfigurationException.class, validateRegion);
    assertEquals(expectedMessage, thrownEx.getMessage());
}
Also used : InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException) Test(org.junit.Test)

Aggregations

InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)43 Node (org.w3c.dom.Node)19 YamlNode (com.hazelcast.internal.yaml.YamlNode)5 IOException (java.io.IOException)5 EvictionConfig (com.hazelcast.config.EvictionConfig)3 ValidationException (com.hazelcast.config.properties.ValidationException)3 YamlMapping (com.hazelcast.internal.yaml.YamlMapping)3 DiscoveryStrategy (com.hazelcast.spi.discovery.DiscoveryStrategy)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2 XmlClientConfigBuilder (com.hazelcast.client.config.XmlClientConfigBuilder)2 Member (com.hazelcast.cluster.Member)2 EventJournalConfig (com.hazelcast.config.EventJournalConfig)2 EvictionPolicy (com.hazelcast.config.EvictionPolicy)2 MaxSizePolicy (com.hazelcast.config.MaxSizePolicy)2 OnJoinPermissionOperationName (com.hazelcast.config.OnJoinPermissionOperationName)2 PermissionType (com.hazelcast.config.PermissionConfig.PermissionType)2 PredicateConfig (com.hazelcast.config.PredicateConfig)2 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)2 DefaultDiscoveryService (com.hazelcast.spi.discovery.impl.DefaultDiscoveryService)2 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)2