Search in sources :

Example 61 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class InvocationRegistryTest method setup.

@Before
public void setup() {
    logger = Mockito.mock(ILogger.class);
    int capacity = 2;
    CallIdSequenceWithBackpressure callIdSequence = new CallIdSequenceWithBackpressure(capacity, 1000, ConcurrencyDetection.createDisabled());
    HazelcastProperties properties = new HazelcastProperties(new Properties());
    invocationRegistry = new InvocationRegistry(logger, callIdSequence, properties);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) CallIdSequenceWithBackpressure(com.hazelcast.spi.impl.sequence.CallIdSequenceWithBackpressure) ILogger(com.hazelcast.logging.ILogger) Properties(java.util.Properties) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Before(org.junit.Before)

Example 62 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method testBackPressureDisabledByDefault.

@Test
public void testBackPressureDisabledByDefault() {
    Config config = new Config();
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    BackpressureRegulator regulator = new BackpressureRegulator(hazelcastProperties, logger);
    assertFalse(regulator.isEnabled());
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 63 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method newCallIdSequence_whenBackPressureEnabled.

// ========================== newCallIdSequence =================
@Test
public void newCallIdSequence_whenBackPressureEnabled() {
    Config config = new Config();
    config.setProperty(BACKPRESSURE_ENABLED.getName(), "true");
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    BackpressureRegulator backpressureRegulator = new BackpressureRegulator(hazelcastProperties, logger);
    CallIdSequence callIdSequence = backpressureRegulator.newCallIdSequence(ConcurrencyDetection.createEnabled(100));
    assertInstanceOf(CallIdSequenceWithBackpressure.class, callIdSequence);
    assertEquals(backpressureRegulator.getMaxConcurrentInvocations(), callIdSequence.getMaxConcurrentInvocations());
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) CallIdSequence(com.hazelcast.spi.impl.sequence.CallIdSequence) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 64 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method testWriteThroughDoesntEnableBackPressure.

@Test
public void testWriteThroughDoesntEnableBackPressure() {
    Config config = new Config();
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    BackpressureRegulator regulator = new BackpressureRegulator(hazelcastProperties, logger);
    CallIdSequence callIdSequence = regulator.newCallIdSequence(ConcurrencyDetection.createEnabled(1000));
    assertEquals(Integer.MAX_VALUE, callIdSequence.getMaxConcurrentInvocations());
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config) CallIdSequence(com.hazelcast.spi.impl.sequence.CallIdSequence) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 65 with HazelcastProperties

use of com.hazelcast.spi.properties.HazelcastProperties in project hazelcast by hazelcast.

the class BackpressureRegulatorTest method newDisabledBackPressureService.

private BackpressureRegulator newDisabledBackPressureService() {
    Config config = new Config();
    config.setProperty(BACKPRESSURE_ENABLED.getName(), "false");
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    return new BackpressureRegulator(hazelcastProperties, logger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Config(com.hazelcast.config.Config)

Aggregations

HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)71 Config (com.hazelcast.config.Config)31 QuickTest (com.hazelcast.test.annotation.QuickTest)29 Test (org.junit.Test)29 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)25 ILogger (com.hazelcast.logging.ILogger)15 Address (com.hazelcast.cluster.Address)11 JoinConfig (com.hazelcast.config.JoinConfig)8 MulticastConfig (com.hazelcast.config.MulticastConfig)8 InetAddress (java.net.InetAddress)8 InetSocketAddress (java.net.InetSocketAddress)8 MulticastSocket (java.net.MulticastSocket)8 Before (org.junit.Before)8 ExecutionService (com.hazelcast.spi.impl.executionservice.ExecutionService)7 Properties (java.util.Properties)7 Node (com.hazelcast.instance.impl.Node)4 LoggingService (com.hazelcast.logging.LoggingService)4 MapConfig (com.hazelcast.config.MapConfig)3 TcpServerConnectionChannelErrorHandler (com.hazelcast.internal.server.tcp.TcpServerConnectionChannelErrorHandler)3 ClientConfig (com.hazelcast.client.config.ClientConfig)2