package com.ricebridge.xmlman.in.test;
import com.ricebridge.xmlman.*;
import com.ricebridge.xmlman.in.*;
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 ConditionTest extends TestCase {
public ConditionTest( String pName ) {
super( pName );
}
public static TestSuite suite() {
return new TestSuite( ConditionTest.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[1=1]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[1=2]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo[@name='foo1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[@name='notfoo1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo[bar]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[notbar]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//foo", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "//foo[1=1]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "//foo[1=2]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//foo[@name='foo1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "//foo[@name='notfoo1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//foo[bar]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "//foo[notbar]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo/bar[1=1]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[1=2]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo/bar[@name='bar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[@name='notbar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo/bar[notque]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo//bar[1=1]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo//bar[1=2]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo//bar[@name='bar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo//bar[@name='notbar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "/foo//bar[notque]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[1=1]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "//bar[1=2]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[@name='bar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "//bar[@name='notbar1']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[notque]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[@name='bar1'][@type='one']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "//bar[@name='bar1'][@type='two']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[@name='bar1' and @type='one']", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[false() or true()]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[(false() or true()) and true()]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"foo1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo[not(true())]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make() );
sRecordSpecList.add( new RecordSpec( "//bar[/foo=/foo]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/foo/bar[/foo=/foo]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "foo/bar[/foo=/foo]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "/*/bar[/foo=/foo]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
sRecordSpecList.add( new RecordSpec( "*/bar[/foo=/foo]", new String[] { "@name" } ) );
sRecordDataList.add( ListUtil.make( new String[] {"bar1"} ) );
}
public void testCondition() throws Exception {
TestUtil.testRecords( "com/ricebridge/xmlman/in/test/condition.xml", sRecordSpecList, sRecordDataList, this );
}
}