Search in sources :

Example 6 with HazelcastProperties

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

the class StoreLatencyPluginResetTest method test.

@Test
public void test() throws InterruptedException {
    Properties props = new Properties();
    props.put(StoreLatencyPlugin.PERIOD_SECONDS.getName(), "1");
    props.put(StoreLatencyPlugin.RESET_PERIOD_SECONDS.getName(), "2");
    HazelcastProperties properties = new HazelcastProperties(props);
    StoreLatencyPlugin plugin = new StoreLatencyPlugin(Logger.getLogger(StoreLatencyPlugin.class), properties);
    StoreLatencyPlugin.LatencyProbe probe = plugin.newProbe("foo", "queue", "somemethod");
    probe.recordValue(MICROSECONDS.toNanos(1));
    probe.recordValue(MICROSECONDS.toNanos(2));
    probe.recordValue(MICROSECONDS.toNanos(5));
    // run for the first time.
    plugin.run(logWriter);
    assertContains("max(us)=5");
    // reset the logWriter so we don't get previous run content.
    reset();
    // run for the second time;
    plugin.run(logWriter);
    // now it should still contain the old statistics
    assertContains("max(us)=5");
    // reset the logWriter so we don't get previous run content.
    reset();
    // run for the third time; now the stats should be gone
    plugin.run(logWriter);
    // now it should not contain the old statistics
    assertNotContains("max(us)=5");
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Properties(java.util.Properties) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 7 with HazelcastProperties

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

the class StoreLatencyPluginTest method setup.

@Before
public void setup() {
    Properties p = new Properties();
    p.put(StoreLatencyPlugin.PERIOD_SECONDS, "1");
    HazelcastProperties properties = new HazelcastProperties(p);
    plugin = new StoreLatencyPlugin(Logger.getLogger(StoreLatencyPlugin.class), properties);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Properties(java.util.Properties) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) Before(org.junit.Before)

Example 8 with HazelcastProperties

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

the class RepairingTaskTest method newRepairingTask.

private RepairingTask newRepairingTask(Config config) {
    MetaDataFetcher metaDataFetcher = mock(MetaDataFetcher.class);
    ExecutionService executionService = mock(ExecutionService.class);
    MinimalPartitionService minimalPartitionService = mock(MinimalPartitionService.class);
    String uuid = UuidUtil.newUnsecureUUID().toString();
    ILogger logger = Logger.getLogger(RepairingTask.class);
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    return new RepairingTask(metaDataFetcher, executionService.getGlobalTaskScheduler(), minimalPartitionService, hazelcastProperties, uuid, logger);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) ILogger(com.hazelcast.logging.ILogger) ExecutionService(com.hazelcast.spi.ExecutionService)

Example 9 with HazelcastProperties

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

the class QueryOptimizerFactoryTest method createMockHazelcastProperties.

private HazelcastProperties createMockHazelcastProperties(HazelcastProperty property, String stringValue) {
    HazelcastProperties properties = mock(HazelcastProperties.class);
    when(properties.getString(property)).thenReturn(stringValue);
    return properties;
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties)

Example 10 with HazelcastProperties

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

the class AsyncInboundResponseHandlerTest method setup.

@Before
public void setup() {
    ILogger logger = Logger.getLogger(getClass());
    HazelcastThreadGroup threadGroup = new HazelcastThreadGroup("test", logger, getClass().getClassLoader());
    responsePacketHandler = mock(PacketHandler.class);
    asyncHandler = new AsyncInboundResponseHandler(threadGroup, logger, responsePacketHandler, new HazelcastProperties(new Config()));
    asyncHandler.start();
    serializationService = new DefaultSerializationServiceBuilder().build();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) PacketHandler(com.hazelcast.spi.impl.PacketHandler) Config(com.hazelcast.config.Config) ILogger(com.hazelcast.logging.ILogger) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Before(org.junit.Before)

Aggregations

HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)29 Config (com.hazelcast.config.Config)12 QuickTest (com.hazelcast.test.annotation.QuickTest)11 Test (org.junit.Test)11 ParallelTest (com.hazelcast.test.annotation.ParallelTest)9 ExecutionService (com.hazelcast.spi.ExecutionService)4 ILogger (com.hazelcast.logging.ILogger)3 Before (org.junit.Before)3 MapConfig (com.hazelcast.config.MapConfig)2 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)2 BatchInvalidator (com.hazelcast.internal.nearcache.impl.invalidation.BatchInvalidator)2 NonStopInvalidator (com.hazelcast.internal.nearcache.impl.invalidation.NonStopInvalidator)2 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)2 NodeEngine (com.hazelcast.spi.NodeEngine)2 OperationService (com.hazelcast.spi.OperationService)2 Properties (java.util.Properties)2 ClientLoggingService (com.hazelcast.client.impl.ClientLoggingService)1 MapIndexConfig (com.hazelcast.config.MapIndexConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 ClusterService (com.hazelcast.internal.cluster.ClusterService)1