public void test_clearAllSolutionSets(){
  final List<IBindingSet[]> in1=new LinkedList<IBindingSet[]>();
{
    final List<IBindingSet> t=new LinkedList<IBindingSet>();
{
      final ListBindingSet b=new ListBindingSet();
      t.add(b);
    }
    in1.add(t.toArray(new IBindingSet[0]));
  }
  final List<IBindingSet[]> in2=new LinkedList<IBindingSet[]>();
{
    final List<IBindingSet> t=new LinkedList<IBindingSet>();
{
      final ListBindingSet b=new ListBindingSet();
      t.add(b);
    }
{
      final ListBindingSet b=new ListBindingSet();
      t.add(b);
    }
    in1.add(t.toArray(new IBindingSet[0]));
  }
  final String solutionSet1=getName() + 1;
  final String solutionSet2=getName() + 2;
  try {
    solutionSetsManager.getSolutions(solutionSet1);
    fail("Expecting: " + IllegalStateException.class);
  }
 catch (  IllegalStateException ex) {
    if (log.isInfoEnabled())     log.info("Ignoring expected exception: " + ex);
  }
  try {
    solutionSetsManager.getSolutions(solutionSet2);
    fail("Expecting: " + IllegalStateException.class);
  }
 catch (  IllegalStateException ex) {
    if (log.isInfoEnabled())     log.info("Ignoring expected exception: " + ex);
  }
  solutionSetsManager.putSolutions(solutionSet1,new CloseableIteratorWrapper<IBindingSet[]>(in1.iterator()));
  solutionSetsManager.putSolutions(solutionSet2,new CloseableIteratorWrapper<IBindingSet[]>(in2.iterator()));
  assertSameSolutionsAnyOrder(flatten(in1.iterator()),solutionSetsManager.getSolutions(solutionSet1));
  assertSameSolutionsAnyOrder(flatten(in2.iterator()),solutionSetsManager.getSolutions(solutionSet2));
  solutionSetsManager.clearAllSolutions();
  try {
    final ICloseableIterator<IBindingSet[]> itr=solutionSetsManager.getSolutions(solutionSet1);
    try {
      assertFalse(itr.hasNext());
    }
  finally {
      itr.close();
    }
    fail("Expecting: " + IllegalStateException.class);
  }
 catch (  IllegalStateException ex) {
    if (log.isInfoEnabled())     log.info("Ignoring expected exception: " + ex);
  }
  assertFalse(solutionSetsManager.existsSolutions(solutionSet1));
  try {
    solutionSetsManager.getSolutions(solutionSet2);
    fail("Expecting: " + IllegalStateException.class);
  }
 catch (  IllegalStateException ex) {
    if (log.isInfoEnabled())     log.info("Ignoring expected exception: " + ex);
  }
  assertFalse(solutionSetsManager.existsSolutions(solutionSet2));
}

public void test_clearAllSolutionSets ( ) { final List < IBindingSet [ ] > in1 = new LinkedList < IBindingSet [ ] > ( ) ; { final List < IBindingSet > t = new LinkedList < IBindingSet > ( ) ; { final ListBindingSet b = new ListBindingSet ( ) ; t . add ( b ) ; } in1 . add ( t . toArray ( new IBindingSet [ 0 ] ) ) ; } final List < IBindingSet [ ] > in2 = new LinkedList < IBindingSet [ ] > ( ) ; { final List < IBindingSet > t = new LinkedList < IBindingSet > ( ) ; { final ListBindingSet b = new ListBindingSet ( ) ; t . add ( b ) ; } { final ListBindingSet b = new ListBindingSet ( ) ; t . add ( b ) ; } in1 . add ( t . toArray ( new IBindingSet [ 0 ] ) ) ; } final String solutionSet1 = getName ( ) + 1 ; final String solutionSet2 = getName ( ) + 2 ; try { solutionSetsManager . getSolutions ( solutionSet1 ) ; fail ( "Expecting: " + IllegalStateException . class ) ; } catch ( IllegalStateException ex ) { if ( log . isInfoEnabled ( ) ) log . info ( "Ignoring expected exception: " + ex ) ; } try { solutionSetsManager . getSolutions ( solutionSet2 ) ; fail ( "Expecting: " + IllegalStateException . class ) ; } catch ( IllegalStateException ex ) { if ( log . isInfoEnabled ( ) ) log . info ( "Ignoring expected exception: " + ex ) ; } solutionSetsManager . putSolutions ( solutionSet1 , new CloseableIteratorWrapper < IBindingSet [ ] > ( in1 . iterator ( ) ) ) ; solutionSetsManager . putSolutions ( solutionSet2 , new CloseableIteratorWrapper < IBindingSet [ ] > ( in2 . iterator ( ) ) ) ; assertSameSolutionsAnyOrder ( flatten ( in1 . iterator ( ) ) , solutionSetsManager . getSolutions ( solutionSet1 ) ) ; assertSameSolutionsAnyOrder ( flatten ( in2 . iterator ( ) ) , solutionSetsManager . getSolutions ( solutionSet2 ) ) ; solutionSetsManager . clearAllSolutions ( ) ; try { final ICloseableIterator < IBindingSet [ ] > itr = solutionSetsManager . getSolutions ( solutionSet1 ) ; try { assertFalse ( itr . hasNext ( ) ) ; } finally { itr . close ( ) ; } fail ( "Expecting: " + IllegalStateException . class ) ; } catch ( IllegalStateException ex ) { if ( log . isInfoEnabled ( ) ) log . info ( "Ignoring expected exception: " + ex ) ; } assertFalse ( solutionSetsManager . existsSolutions ( solutionSet1 ) ) ; try { solutionSetsManager . getSolutions ( solutionSet2 ) ; fail ( "Expecting: " + IllegalStateException . class ) ; } catch ( IllegalStateException ex ) { if ( log . isInfoEnabled ( ) ) log . info ( "Ignoring expected exception: " + ex ) ; } assertFalse ( solutionSetsManager . existsSolutions ( solutionSet2 ) ) ; }
unit test for clearing all named solution sets .
