package com.ricebridge.xmlman.in.test;
import com.ricebridge.xmlman.*;
import com.ricebridge.xmlman.in.*;
import com.ricebridge.xmlman.in.test.*;
import org.jostraca.util.*;
import junit.framework.*;
import junit.textui.*;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import java.util.*;
import java.io.*;
public class PositionTest extends TestCase {
public PositionTest( String pName ) {
super( pName );
}
public static TestSuite suite() {
return new TestSuite( PositionTest.class );
}
public static void main( String[] pArgs ) {
TestRunner.run( suite() );
}
private static ArrayList sRecordSpecList = new ArrayList();
private static ArrayList sRecordDataList = new ArrayList();
static {
sRecordSpecList.add( new RecordSpec( "/foo/bar[2]", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2","2" } ) );
sRecordSpecList.add( new RecordSpec( "//bar[2]", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2bar2","2" },
new String[] {"bar2","2" } ) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[2]/que", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2que1","1" },
new String[] {"bar2que2","2" }
) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[2]/que[1]", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2que1","1" } ) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[2]/bar[1]", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2bar1","1" } ) );
sRecordSpecList.add( new RecordSpec( "//bar/fab", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar2bar2fab1","1" } ) );
sRecordSpecList.add( new RecordSpec( "//bar", new String[] { "@name", "position()" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1","1"},
new String[] {"bar2bar1","1"},
new String[] {"bar2bar2","2"},
new String[] {"bar2","2"},
new String[] {"bar3","3"}
) );
}
public void testPosition() throws Exception {
TestUtil.testRecords( "com/ricebridge/xmlman/in/test/position.xml", sRecordSpecList, sRecordDataList, this );
}
}