Search in sources :

Example 1 with AwsConfig

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

the class TestClientNetworkConfig method smokeAwsConfig.

@Test
public void smokeAwsConfig() {
    AwsConfig aws = client.getClientConfig().getNetworkConfig().getAwsConfig();
    assertFalse(aws.isEnabled());
    assertEquals("sample-access-key", aws.getProperty("access-key"));
    assertEquals("sample-secret-key", aws.getProperty("secret-key"));
    assertEquals("sample-region", aws.getProperty("region"));
    assertEquals("sample-header", aws.getProperty("host-header"));
    assertEquals("sample-group", aws.getProperty("security-group-name"));
    assertEquals("sample-tag-key", aws.getProperty("tag-key"));
    assertEquals("sample-tag-value", aws.getProperty("tag-value"));
    assertEquals("sample-role", aws.getProperty("iam-role"));
}
Also used : AwsConfig(com.hazelcast.config.AwsConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with AwsConfig

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

the class AliasedDiscoveryConfigDTOTest method testDefault.

@Test
public void testDefault() {
    testDefault(new GcpConfig());
    testDefault(new AzureConfig());
    testDefault(new AwsConfig());
    testDefault(new EurekaConfig());
    testDefault(new KubernetesConfig());
}
Also used : EurekaConfig(com.hazelcast.config.EurekaConfig) AwsConfig(com.hazelcast.config.AwsConfig) AzureConfig(com.hazelcast.config.AzureConfig) KubernetesConfig(com.hazelcast.config.KubernetesConfig) GcpConfig(com.hazelcast.config.GcpConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with AwsConfig

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

the class WanBatchPublisherConfigDTOTest method testSerialization.

@Test
public void testSerialization() {
    Map<String, Comparable> properties = new HashMap<>();
    properties.put("key1", "value1");
    properties.put("key2", "value2");
    WanBatchPublisherConfig expected = new WanBatchPublisherConfig().setClusterName("myClusterName").setPublisherId("myPublisherId").setSnapshotEnabled(true).setInitialPublisherState(WanPublisherState.STOPPED).setQueueCapacity(23).setBatchSize(500).setBatchMaxDelayMillis(1000).setResponseTimeoutMillis(60000).setQueueFullBehavior(WanQueueFullBehavior.THROW_EXCEPTION).setAcknowledgeType(WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE).setDiscoveryPeriodSeconds(20).setMaxTargetEndpoints(100).setMaxConcurrentInvocations(500).setUseEndpointPrivateAddress(true).setIdleMinParkNs(100).setIdleMaxParkNs(1000).setTargetEndpoints("a,b,c,d").setDiscoveryConfig(new DiscoveryConfig()).setSyncConfig(new WanSyncConfig()).setAwsConfig(new AwsConfig().setEnabled(true).setProperty("connection-timeout-seconds", "20")).setGcpConfig(new GcpConfig().setEnabled(true).setProperty("gcp", "gcp-val")).setAzureConfig(new AzureConfig().setEnabled(true).setProperty("azure", "azure-val")).setKubernetesConfig(new KubernetesConfig().setEnabled(true).setProperty("kubernetes", "kubernetes-val")).setEurekaConfig(new EurekaConfig().setEnabled(true).setProperty("eureka", "eureka-val")).setEndpoint("WAN").setProperties(properties);
    WanBatchPublisherConfig actual = cloneThroughJson(expected);
    assertTrue("Expected: " + expected + ", got:" + actual, WAN_PUBLISHER_CONFIG_CHECKER.check(expected, actual));
}
Also used : WanBatchPublisherConfig(com.hazelcast.config.WanBatchPublisherConfig) EurekaConfig(com.hazelcast.config.EurekaConfig) AwsConfig(com.hazelcast.config.AwsConfig) WanSyncConfig(com.hazelcast.config.WanSyncConfig) HashMap(java.util.HashMap) AzureConfig(com.hazelcast.config.AzureConfig) KubernetesConfig(com.hazelcast.config.KubernetesConfig) GcpConfig(com.hazelcast.config.GcpConfig) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with AwsConfig

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

the class DefaultAddressPicker method preferIPv4Stack.

private boolean preferIPv4Stack() {
    boolean preferIPv4Stack = Boolean.getBoolean("java.net.preferIPv4Stack") || hazelcastProperties.getBoolean(GroupProperty.PREFER_IPv4_STACK);
    // AWS does not support IPv6
    JoinConfig join = config.getNetworkConfig().getJoin();
    AwsConfig awsConfig = join.getAwsConfig();
    boolean awsEnabled = awsConfig != null && awsConfig.isEnabled();
    return preferIPv4Stack || awsEnabled;
}
Also used : AwsConfig(com.hazelcast.config.AwsConfig) JoinConfig(com.hazelcast.config.JoinConfig)

Example 5 with AwsConfig

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

the class ClientDiscoverySpiTest method testParsing.

@Test
public void testParsing() throws Exception {
    String xmlFileName = "hazelcast-client-discovery-spi-test.xml";
    InputStream xmlResource = ClientDiscoverySpiTest.class.getClassLoader().getResourceAsStream(xmlFileName);
    ClientConfig clientConfig = new XmlClientConfigBuilder(xmlResource).build();
    ClientNetworkConfig networkConfig = clientConfig.getNetworkConfig();
    AwsConfig awsConfig = networkConfig.getAwsConfig();
    assertNull(awsConfig);
    DiscoveryConfig discoveryConfig = networkConfig.getDiscoveryConfig();
    assertTrue(discoveryConfig.isEnabled());
    assertEquals(1, discoveryConfig.getDiscoveryStrategyConfigs().size());
    DiscoveryStrategyConfig providerConfig = discoveryConfig.getDiscoveryStrategyConfigs().iterator().next();
    assertEquals(3, providerConfig.getProperties().size());
    assertEquals("foo", providerConfig.getProperties().get("key-string"));
    assertEquals("123", providerConfig.getProperties().get("key-int"));
    assertEquals("true", providerConfig.getProperties().get("key-boolean"));
}
Also used : AwsConfig(com.hazelcast.config.AwsConfig) XmlClientConfigBuilder(com.hazelcast.client.config.XmlClientConfigBuilder) DiscoveryStrategyConfig(com.hazelcast.config.DiscoveryStrategyConfig) InputStream(java.io.InputStream) ClientConfig(com.hazelcast.client.config.ClientConfig) DiscoveryConfig(com.hazelcast.config.DiscoveryConfig) ClientNetworkConfig(com.hazelcast.client.config.ClientNetworkConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

AwsConfig (com.hazelcast.config.AwsConfig)10 Test (org.junit.Test)7 QuickTest (com.hazelcast.test.annotation.QuickTest)6 AzureConfig (com.hazelcast.config.AzureConfig)4 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)4 EurekaConfig (com.hazelcast.config.EurekaConfig)4 GcpConfig (com.hazelcast.config.GcpConfig)4 KubernetesConfig (com.hazelcast.config.KubernetesConfig)4 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)3 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2 ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)2 JoinConfig (com.hazelcast.config.JoinConfig)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 InputStream (java.io.InputStream)2 XmlClientConfigBuilder (com.hazelcast.client.config.XmlClientConfigBuilder)1 AttributeConfig (com.hazelcast.config.AttributeConfig)1 BitmapIndexOptions (com.hazelcast.config.BitmapIndexOptions)1 CachePartitionLostListenerConfig (com.hazelcast.config.CachePartitionLostListenerConfig)1 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)1