01: /*
02: * User: Michael Rettig
03: * Date: Aug 14, 2002
04: * Time: 4:51:54 PM
05: */
06: package net.sourceforge.jaxor.tests;
07:
08: import net.sourceforge.jaxor.JaxorSession;
09: import net.sourceforge.jaxor.MetaField;
10: import net.sourceforge.jaxor.MetaRow;
11: import net.sourceforge.jaxor.example.domain.AddressBase;
12: import net.sourceforge.jaxor.example.domain.AddressMetaRow;
13: import net.sourceforge.jaxor.example.domain.AddressList;
14: import net.sourceforge.jaxor.example.tests.TableTestCase;
15: import net.sourceforge.jaxor.example.db.MySqlContextTestingFactory;
16: import net.sourceforge.jaxor.example.db.MckoiContextTestingFactory;
17: import net.sourceforge.jaxor.example.db.JaxorContextTestingFactory;
18: import net.sourceforge.jaxor.example.db.PostgresContextTestingFactory;
19: import net.sourceforge.jaxor.mappers.StringMapper;
20: import net.sourceforge.jaxor.util.Validation;
21:
22: public class MetaRowTest extends TableTestCase {
23:
24: protected MetaRow getRow() {
25: return new AddressMetaRow();
26: }
27:
28: public void testMetaRow() {
29: MetaRow row = new MetaRow("table", AddressBase.class,
30: AddressList.class);
31: MetaField field = new MetaField("name", false,
32: StringMapper.class);
33: row.add(field);
34: assertTrue(field == row.findMetaByColumn("NAME"));
35: assertTrue(field == row.findMetaByColumn("nAmE"));
36: }
37:
38: public void testFindInvalidColumns() {
39: MetaRow row = new AddressMetaRow();
40: boolean useCaps = getTestingContext()
41: .capitalizeTableNameForMetaData();
42: Validation val = row.validateColumns(JaxorSession
43: .getJaxorContext().getConnection(), useCaps);
44: assertTrue(!val.hasErrors());
45: }
46: }
|