Program: 50313
Project: 50313
Buggy source:
@Test(timeout=40000) public void testSuperClientPartitionOwnership() throws Exception {
  Config configSuperClient=new Config();
  configSuperClient.setSuperClient(true);
  HazelcastInstance hNormal=Hazelcast.newHazelcastInstance(new Config());
  final HazelcastInstance hSuper=Hazelcast.newHazelcastInstance(configSuperClient);
  Map map=hSuper.getMap("String_Node_Str");
  assertNull(map.put("String_Node_Str","String_Node_Str"));
  Set<Partition> partitions2=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions2) {
    assertEquals(partition.getOwner(),hNormal.getCluster().getLocalMember());
  }
  hNormal.shutdown();
  Thread.sleep(3000);
  Set<Partition> partitions=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertNull(partition.getOwner());
  }
  hNormal=Hazelcast.newHazelcastInstance(new Config());
  partitions=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertEquals(hNormal.getCluster().getLocalMember(),partition.getOwner());
  }
  assertNull(map.put("String_Node_Str","String_Node_Str"));
  hSuper.shutdown();
  partitions=hNormal.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertEquals(hNormal.getCluster().getLocalMember(),partition.getOwner());
  }
  assertEquals("String_Node_Str",hNormal.getMap("String_Node_Str").get("String_Node_Str"));
}

Fixed version (ground truth):
@Test(timeout=40000) public void testSuperClientPartitionOwnership() throws Exception {
  Config configSuperClient=new Config();
  configSuperClient.setSuperClient(true);
  HazelcastInstance hNormal=Hazelcast.newHazelcastInstance(new Config());
  final HazelcastInstance hSuper=Hazelcast.newHazelcastInstance(configSuperClient);
  IMap mapSuper=hSuper.getMap("String_Node_Str");
  IMap mapNormal=hNormal.getMap("String_Node_Str");
  for (int i=0; i < 1000; i++) {
    mapNormal.put("String_Node_Str" + i,"String_Node_Str" + i);
  }
  for (int i=1000; i < 2000; i++) {
    mapSuper.put("String_Node_Str" + i,"String_Node_Str" + i);
  }
  Set<Partition> partitions2=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions2) {
    assertEquals(partition.getOwner(),hNormal.getCluster().getLocalMember());
  }
  assertEquals(2000,mapNormal.size());
  assertEquals(2000,mapSuper.size());
  assertEquals(0,mapSuper.getLocalMapStats().getOwnedEntryCount());
  assertEquals(0,mapSuper.getLocalMapStats().getBackupEntryCount());
  assertEquals(2000,mapNormal.getLocalMapStats().getOwnedEntryCount());
  assertEquals(0,mapNormal.getLocalMapStats().getBackupEntryCount());
  hNormal.shutdown();
  Thread.sleep(3000);
  Set<Partition> partitions=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertNull(partition.getOwner());
  }
  hNormal=Hazelcast.newHazelcastInstance(new Config());
  partitions=hSuper.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertEquals(hNormal.getCluster().getLocalMember(),partition.getOwner());
  }
  assertNull(mapSuper.put("String_Node_Str","String_Node_Str"));
  hSuper.shutdown();
  partitions=hNormal.getPartitionService().getPartitions();
  for (  Partition partition : partitions) {
    assertEquals(hNormal.getCluster().getLocalMember(),partition.getOwner());
  }
  assertEquals("String_Node_Str",hNormal.getMap("String_Node_Str").get("String_Node_Str"));
}