@Ignore @Test public void testFoolGreedyAlgorithm() throws Exception {
  PartitionedRegionLoadModel model=new PartitionedRegionLoadModel(bucketOperator,1,50,getAddressComparor(false),Collections.<InternalDistributedMember>emptySet(),null);
  InternalDistributedMember member1=new InternalDistributedMember(InetAddress.getByName("127.0.0.1"),1);
  InternalDistributedMember member2=new InternalDistributedMember(InetAddress.getByName("127.0.0.1"),2);
  InternalDistributedMember member3=new InternalDistributedMember(InetAddress.getByName("127.0.0.1"),3);
  PartitionMemberInfoImpl details1=buildDetails(member1,500,500,new long[]{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},new long[]{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0});
  PartitionMemberInfoImpl details2=buildDetails(member2,500,500,new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
  PartitionMemberInfoImpl details3=buildDetails(member3,500,500,new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},new long[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0});
  model.addRegion("a",Arrays.asList(details1,details2,details3),new FakeOfflineDetails(),true);
  doMoves(new CompositeDirector(true,true,false,false),model);
  for (  PartitionMemberInfo details : model.getPartitionedMemberDetails("a")) {
    assertEquals(20,details.getBucketCount());
  }
}

@ Ignore @ Test public void testFoolGreedyAlgorithm ( ) throws Exception { PartitionedRegionLoadModel model = new PartitionedRegionLoadModel ( bucketOperator , 1 , 50 , getAddressComparor ( false ) , Collections . < InternalDistributedMember > emptySet ( ) , null ) ; InternalDistributedMember member1 = new InternalDistributedMember ( InetAddress . getByName ( "127.0.0.1" ) , 1 ) ; InternalDistributedMember member2 = new InternalDistributedMember ( InetAddress . getByName ( "127.0.0.1" ) , 2 ) ; InternalDistributedMember member3 = new InternalDistributedMember ( InetAddress . getByName ( "127.0.0.1" ) , 3 ) ; PartitionMemberInfoImpl details1 = buildDetails ( member1 , 500 , 500 , new long [ ] { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , new long [ ] { 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ) ; PartitionMemberInfoImpl details2 = buildDetails ( member2 , 500 , 500 , new long [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 } , new long [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 } ) ; PartitionMemberInfoImpl details3 = buildDetails ( member3 , 500 , 500 , new long [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , new long [ ] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ) ; model . addRegion ( "a" , Arrays . asList ( details1 , details2 , details3 ) , new FakeOfflineDetails ( ) , true ) ; doMoves ( new CompositeDirector ( true , true , false , false ) , model ) ; for ( PartitionMemberInfo details : model . getPartitionedMemberDetails ( "a" ) ) { assertEquals ( 20 , details . getBucketCount ( ) ) ; } }
test which illustrates the problem with our greedy algorithm . it doesn ' t necessarily end up with a balanced result . todo rebalance - change this test or fix the algorithm ?
