/*******************************************************************************
 * Copyright (c) 2008 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.engine.data.dte;

import junit.framework.TestCase;

public class ResultSetIndexTest extends TestCase
{

	void setupIndex( ResultSetIndex index )
	{
		index.addResultSet( "master-page", null, -1, "master-page" );
		index.addResultSet( "query", null, -1, "query" );
		index.addResultSet( "nest", "query", 0, "nest1" );
		index.addResultSet( "nest", "query", 10, "nest2" );
		index.addResultSet( "nest", "query", 12, "nest3" );
	}

	public void testResultSet( )
	{
		ResultSetIndex index = new ResultSetIndex( );
		setupIndex( index );
		assertEquals( "master-page", index.getResultSet( "master-page", null,
				-1 ) );
		assertEquals( "query", index.getResultSet( "query", null, -1 ) );
		assertEquals( "nest1", index.getResultSet( "nest", "query", 0 ) );
		assertEquals( "nest1", index.getResultSet( "nest", "query", 9 ) );
		assertEquals( "nest2", index.getResultSet( "nest", "query", 10 ) );
		assertEquals( "nest3", index.getResultSet( "nest", "query", 12 ) );
	}
}

@@ -747,18 +747,20 @@
 , null, 
+%22
 -1
+%22
 , %22maste
@@ -807,18 +807,20 @@
 , null, 
+%22
 -1
+%22
 , %22query
@@ -863,17 +863,19 @@
 query%22, 
-0
+%220%22
 , %22nest1
@@ -918,18 +918,20 @@
 query%22, 
+%22
 10
+%22
 , %22nest2
@@ -974,18 +974,20 @@
 query%22, 
+%22
 12
+%22
 , %22nest3
@@ -991,16 +991,76 @@
 st3%22 );%0A
+%09%09index.addResultSet( %22nest%22, %22query%22, %22String%22, %22nest4%22 );%0A
 %09%7D%0A%0A%09pub
@@ -1235,18 +1235,20 @@
 ll,%0A%09%09%09%09
+%22
 -1
+%22
  ) );%0A%09%09
@@ -1305,18 +1305,20 @@
 , null, 
+%22
 -1
+%22
  ) );%0A%09%09
@@ -1377,17 +1377,19 @@
 query%22, 
-0
+%220%22
  ) );%0A%09%09
@@ -1452,9 +1452,11 @@
 y%22, 
-9
+%229%22
  ) )
@@ -1519,18 +1519,20 @@
 query%22, 
+%22
 10
+%22
  ) );%0A%09%09
@@ -1591,18 +1591,96 @@
 query%22, 
+%22
 12
+%22 ) );%0A%09%09assertEquals( %22nest4%22, index.getResultSet( %22nest%22, %22query%22, %22String%22
  ) );%0A%09%7D

Fix failed test.