public void test_addressing(){
  final Journal store=(Journal)getStore();
  try {
    final RWStrategy bufferStrategy=(RWStrategy)store.getBufferStrategy();
    final RWStore rw=bufferStrategy.getStore();
    final ArrayList<Integer> sizes=new ArrayList<Integer>();
    final TreeMap<Long,Integer> paddrs=new TreeMap<Long,Integer>();
    for (int i=0; i < 100000; i++) {
      final int s=r.nextInt(250) + 1;
      sizes.add(s);
      final int a=rw.alloc(s,null);
      final long pa=rw.physicalAddress(a);
      assertTrue(paddrs.get(pa) == null);
      paddrs.put(pa,a);
    }
    for (int i=0; i < 50; i++) {
      final int s=r.nextInt(500) + 1;
      sizes.add(s);
      final int a=rw.alloc(s,null);
      final long pa=rw.physicalAddress(a);
      paddrs.put(pa,a);
    }
  }
  finally {
    store.destroy();
  }
}

public void test_addressing ( ) { final Journal store = ( Journal ) getStore ( ) ; try { final RWStrategy bufferStrategy = ( RWStrategy ) store . getBufferStrategy ( ) ; final RWStore rw = bufferStrategy . getStore ( ) ; final ArrayList < Integer > sizes = new ArrayList < Integer > ( ) ; final TreeMap < Long , Integer > paddrs = new TreeMap < Long , Integer > ( ) ; for ( int i = 0 ; i < 100000 ; i ++ ) { final int s = r . nextInt ( 250 ) + 1 ; sizes . add ( s ) ; final int a = rw . alloc ( s , null ) ; final long pa = rw . physicalAddress ( a ) ; assertTrue ( paddrs . get ( pa ) == null ) ; paddrs . put ( pa , a ) ; } for ( int i = 0 ; i < 50 ; i ++ ) { final int s = r . nextInt ( 500 ) + 1 ; sizes . add ( s ) ; final int a = rw . alloc ( s , null ) ; final long pa = rw . physicalAddress ( a ) ; paddrs . put ( pa , a ) ; } } finally { store . destroy ( ) ; } }
ensures the allocation of unique addresses by mapping allocated address with uniqueness assertion against physical address .
