Search in sources :

Example 1 with ClientService

use of com.hazelcast.client.ClientService in project hazelcast by hazelcast.

the class HazelcastOSGiInstanceTest method getClientServiceCalledSuccessfullyOverOSGiInstance.

@Test
public void getClientServiceCalledSuccessfullyOverOSGiInstance() {
    ClientService mockClientService = mock(ClientService.class);
    HazelcastInstance mockHazelcastInstance = mock(HazelcastInstance.class);
    HazelcastOSGiInstance hazelcastOSGiInstance = createHazelcastOSGiInstance(mockHazelcastInstance);
    when(mockHazelcastInstance.getClientService()).thenReturn(mockClientService);
    assertEquals(mockClientService, hazelcastOSGiInstance.getClientService());
    verify(mockHazelcastInstance).getClientService();
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientService(com.hazelcast.client.ClientService) HazelcastOSGiTestUtil.createHazelcastOSGiInstance(com.hazelcast.osgi.impl.HazelcastOSGiTestUtil.createHazelcastOSGiInstance) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with ClientService

use of com.hazelcast.client.ClientService in project hazelcast by hazelcast.

the class PhoneHomeClientsTest method addClientListener.

private void addClientListener(Node node) {
    ClientService clientService = node.getNodeEngine().getHazelcastInstance().getClientService();
    clientService.addClientListener(new ClientListener() {

        @Override
        public void clientConnected(Client client) {
        }

        @Override
        public void clientDisconnected(Client client) {
            disconnectedClientCount.incrementAndGet();
        }
    });
}
Also used : ClientService(com.hazelcast.client.ClientService) Client(com.hazelcast.client.Client) ClientListener(com.hazelcast.client.ClientListener)

Aggregations

ClientService (com.hazelcast.client.ClientService)2 Client (com.hazelcast.client.Client)1 ClientListener (com.hazelcast.client.ClientListener)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 HazelcastOSGiTestUtil.createHazelcastOSGiInstance (com.hazelcast.osgi.impl.HazelcastOSGiTestUtil.createHazelcastOSGiInstance)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1