Skip to content

Commit

Permalink
Fix CustomPropertiesTest#testNativeClient
Browse files Browse the repository at this point in the history
  • Loading branch information
emre committed Apr 13, 2017
1 parent 336804f commit a8a8a65
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -25,6 +25,7 @@
import com.hazelcast.hibernate.entity.DummyEntity;
import com.hazelcast.hibernate.instance.HazelcastAccessor;
import com.hazelcast.hibernate.instance.HazelcastMockInstanceLoader;
import com.hazelcast.test.AssertTask;
import com.hazelcast.test.HazelcastSerialClassRunner;
import com.hazelcast.test.annotation.SlowTest;
import org.hamcrest.BaseMatcher;
Expand Down Expand Up @@ -74,7 +75,7 @@ public void testNativeClient() throws Exception {
loader.configure(props);
loader.setInstanceFactory(factory);
SessionFactory sf = createSessionFactory(props, loader);
HazelcastInstance hz = HazelcastAccessor.getHazelcastInstance(sf);
final HazelcastInstance hz = HazelcastAccessor.getHazelcastInstance(sf);
assertTrue(hz instanceof HazelcastClientProxy);
assertEquals(1, main.getCluster().getMembers().size());
HazelcastClientProxy client = (HazelcastClientProxy) hz;
Expand All @@ -86,7 +87,14 @@ public void testNativeClient() throws Exception {
factory.newHazelcastInstance(config);
assertEquals(2, hz.getCluster().getMembers().size());
main.shutdown();
Thread.sleep(1000 * 1); // let client to reconnect

assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertEquals(1, hz.getCluster().getMembers().size());
}
});

assertEquals(1, hz.getCluster().getMembers().size());
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
Expand Down

0 comments on commit a8a8a65

Please sign in to comment.