use of com.hazelcast.client.test.TestHazelcastFactory in project hazelcast by hazelcast.
the class ClientClusterStateTest method before.
@Before
public void before() {
factory = new TestHazelcastFactory();
instances = factory.newInstances(new Config(), 4);
for (HazelcastInstance instance : instances) {
assertClusterSizeEventually(4, instance);
}
instance = instances[instances.length - 1];
}
use of com.hazelcast.client.test.TestHazelcastFactory in project hazelcast by hazelcast.
the class ClientMapAggregateTest method getMapWithNodeCount.
public <K, V> IMap<K, V> getMapWithNodeCount(int nodeCount) {
if (nodeCount < 1) {
throw new IllegalArgumentException("node count < 1");
}
factory = new TestHazelcastFactory();
Config config = new Config();
config.setProperty("hazelcast.partition.count", "3");
MapConfig mapConfig = new MapConfig();
mapConfig.setName("aggr");
mapConfig.setInMemoryFormat(InMemoryFormat.OBJECT);
config.addMapConfig(mapConfig);
factory.newInstances(config, nodeCount);
client = factory.newHazelcastClient();
return client.getMap("aggr");
}
use of com.hazelcast.client.test.TestHazelcastFactory in project hazelcast by hazelcast.
the class ClientSetTest method setup.
@Before
public void setup() throws IOException {
hazelcastFactory = new TestHazelcastFactory();
hazelcastFactory.newHazelcastInstance();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
set = client.getSet(randomString());
}
use of com.hazelcast.client.test.TestHazelcastFactory in project hazelcast by hazelcast.
the class ClientLoggerConfigurationTest method testLoggingWithConfiguration.
// Test with programmatic or system property configuration according to boolean parameter.
// the idea of the test is to configure a specific logging type for a client and then
// test its LoggingService produce instances of the expected Logger impl
protected void testLoggingWithConfiguration(boolean programmaticConfiguration) throws IOException {
hazelcastFactory = new TestHazelcastFactory();
Config cg = new Config();
cg.setProperty("hazelcast.logging.type", "jdk");
hazelcastFactory.newHazelcastInstance(cg);
ClientConfig config = new ClientConfig();
if (programmaticConfiguration) {
config.setProperty("hazelcast.logging.type", "log4j2");
} else {
System.setProperty("hazelcast.logging.type", "log4j2");
}
client = hazelcastFactory.newHazelcastClient(config);
ILogger clientLogger = client.getLoggingService().getLogger("loggerName");
// this part is fragile.
// client wraps the actual logger in its own class
ILogger actualLogger = (ILogger) getFromField(clientLogger, "logger");
Class<?> clientLoggerClass = actualLogger.getClass();
ILogger expectedLogger = new Log4j2Factory().getLogger("expectedLogger");
Class<?> expectedLoggerClass = expectedLogger.getClass();
assertSame(expectedLoggerClass, clientLoggerClass);
}
use of com.hazelcast.client.test.TestHazelcastFactory in project hazelcast by hazelcast.
the class ClientQueryCacheContextTest method setUp.
@Before
public void setUp() {
factory = new TestHazelcastFactory();
factory.newHazelcastInstance();
HazelcastInstance hz = factory.newHazelcastClient();
ClientMapProxy proxy = (ClientMapProxy) hz.getMap("test");
context = proxy.getQueryContext();
}
Aggregations