Search in sources :

Example 66 with HazelcastProperties

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

the class OperationExecutorImpl_AbstractTest method setup.

@Before
public void setup() throws Exception {
    loggingService = new LoggingServiceImpl("foo", "jdk", new BuildInfo("1", "1", "1", 1, false, (byte) 1, "1"), true, null);
    serializationService = new DefaultSerializationServiceBuilder().build();
    config = smallInstanceConfig();
    thisAddress = new Address("localhost", 5701);
    Node node = Mockito.mock(Node.class);
    when(node.getConfig()).thenReturn(config);
    when(node.getProperties()).thenReturn(new HazelcastProperties(config));
    when(node.getVersion()).thenReturn(new MemberVersion(0, 0, 0));
    nodeExtension = new DefaultNodeExtension(node);
    handlerFactory = new DummyOperationRunnerFactory();
    responsePacketConsumer = new DummyResponsePacketConsumer();
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) DefaultNodeExtension(com.hazelcast.instance.impl.DefaultNodeExtension) Address(com.hazelcast.cluster.Address) LoggingServiceImpl(com.hazelcast.logging.impl.LoggingServiceImpl) BuildInfo(com.hazelcast.instance.BuildInfo) Node(com.hazelcast.instance.impl.Node) MemberVersion(com.hazelcast.version.MemberVersion) Before(org.junit.Before)

Example 67 with HazelcastProperties

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

the class OperationExecutorImpl_AbstractTest method initExecutor.

protected OperationExecutorImpl initExecutor() {
    props = new HazelcastProperties(config);
    executor = new OperationExecutorImpl(props, loggingService, thisAddress, handlerFactory, nodeExtension, "hzName", Thread.currentThread().getContextClassLoader());
    executor.start();
    return executor;
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties)

Example 68 with HazelcastProperties

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

the class OperationExecutorImpl_ExecuteBatchTest method newPartitions.

private BitSet newPartitions() {
    HazelcastProperties properties = new HazelcastProperties(config);
    BitSet bitSet = new BitSet(properties.getInteger(PARTITION_COUNT));
    for (int k = 0; k < bitSet.size(); k++) {
        bitSet.set(k);
    }
    return bitSet;
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) BitSet(java.util.BitSet)

Example 69 with HazelcastProperties

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

the class QueryResultSizeLimiterTest method initMocksWithConfiguration.

private void initMocksWithConfiguration(int maxResultSizeLimit, int maxLocalPartitionLimitForPreCheck) {
    Config config = new Config();
    config.setProperty(QUERY_RESULT_SIZE_LIMIT.getName(), valueOf(maxResultSizeLimit));
    config.setProperty(QUERY_MAX_LOCAL_PARTITION_LIMIT_FOR_PRE_CHECK.getName(), valueOf(maxLocalPartitionLimitForPreCheck));
    config.setProperty(ClusterProperty.PARTITION_COUNT.getName(), valueOf(PARTITION_COUNT));
    HazelcastProperties hazelcastProperties = new HazelcastProperties(config);
    InternalPartitionService partitionService = mock(InternalPartitionService.class);
    when(partitionService.getPartitionCount()).thenReturn(PARTITION_COUNT);
    NodeEngine nodeEngine = mock(NodeEngine.class);
    when(nodeEngine.getProperties()).thenReturn(hazelcastProperties);
    when(nodeEngine.getPartitionService()).thenReturn(partitionService);
    RecordStore recordStore = mock(RecordStore.class);
    when(recordStore.size()).then(new RecordStoreAnswer(localPartitions.values()));
    MapServiceContext mapServiceContext = mock(MapServiceContext.class);
    when(mapServiceContext.getNodeEngine()).thenReturn(nodeEngine);
    when(mapServiceContext.getRecordStore(anyInt(), anyString())).thenReturn(recordStore);
    when(mapServiceContext.getOrInitCachedMemberPartitions()).thenReturn(new PartitionIdSet(PARTITION_COUNT, localPartitions.keySet()));
    limiter = new QueryResultSizeLimiter(mapServiceContext, Logger.getLogger(QueryResultSizeLimiterTest.class));
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) Config(com.hazelcast.config.Config) RecordStore(com.hazelcast.map.impl.recordstore.RecordStore) PartitionIdSet(com.hazelcast.internal.util.collection.PartitionIdSet) MapServiceContext(com.hazelcast.map.impl.MapServiceContext)

Example 70 with HazelcastProperties

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

the class QueryBasicTest method testPredicatedEvaluatedSingleThreadedByDefault.

@Test
public void testPredicatedEvaluatedSingleThreadedByDefault() {
    Config config = getConfig();
    HazelcastProperties properties = new HazelcastProperties(config);
    boolean parallelEvaluation = properties.getBoolean(ClusterProperty.QUERY_PREDICATE_PARALLEL_EVALUATION);
    assertFalse(parallelEvaluation);
}
Also used : HazelcastProperties(com.hazelcast.spi.properties.HazelcastProperties) MapConfig(com.hazelcast.config.MapConfig) Config(com.hazelcast.config.Config) IndexConfig(com.hazelcast.config.IndexConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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