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");
}
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);
}
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);
}
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;
}
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();
}
Aggregations