- Timestamp:
- 02/04/10 21:56:24 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MetadataBeans/trunk/src/test/java/org/eobjects/metamodel/MetaModelTestCase.java
r886 r887 30 30 import org.eobjects.metamodel.data.Row; 31 31 import org.eobjects.metamodel.schema.Column; 32 import org.eobjects.metamodel.schema.MutableColumn; 32 33 import org.eobjects.metamodel.schema.ColumnType; 33 import org.eobjects.metamodel.schema. Relationship;34 import org.eobjects.metamodel.schema. Schema;35 import org.eobjects.metamodel.schema. Table;34 import org.eobjects.metamodel.schema.ImmutableRelationship; 35 import org.eobjects.metamodel.schema.MutableSchema; 36 import org.eobjects.metamodel.schema.MutableTable; 36 37 import org.eobjects.metamodel.schema.TableType; 37 38 … … 81 82 * </ul> 82 83 */ 83 protected Schema getExampleSchema() {84 Schema schema = newSchema("MetaModelSchema");85 86 Table table1 = newTable(TABLE_CONTRIBUTOR, TableType.TABLE, schema);87 Column column1 = newColumn(COLUMN_CONTRIBUTOR_CONTRIBUTOR_ID,84 protected MutableSchema getExampleSchema() { 85 MutableSchema schema = new MutableSchema("MetaModelSchema"); 86 87 MutableTable table1 = new MutableTable(TABLE_CONTRIBUTOR, TableType.TABLE, schema); 88 MutableColumn column1 = new MutableColumn(COLUMN_CONTRIBUTOR_CONTRIBUTOR_ID, 88 89 ColumnType.INTEGER, table1, 0, false).setIndexed(true); 89 Column column2 = newColumn(COLUMN_CONTRIBUTOR_NAME,90 MutableColumn column2 = new MutableColumn(COLUMN_CONTRIBUTOR_NAME, 90 91 ColumnType.VARCHAR, table1, 1, false); 91 Column column3 = new Column(COLUMN_CONTRIBUTOR_COUNTRY,92 Column column3 = new MutableColumn(COLUMN_CONTRIBUTOR_COUNTRY, 92 93 ColumnType.VARCHAR, table1, 2, true); 93 94 table1.setColumns(column1, column2, column3); 94 95 95 Table table2 = newTable(TABLE_PROJECT, TableType.TABLE, schema);96 Column column4 = newColumn(COLUMN_PROJECT_PROJECT_ID,96 MutableTable table2 = new MutableTable(TABLE_PROJECT, TableType.TABLE, schema); 97 MutableColumn column4 = new MutableColumn(COLUMN_PROJECT_PROJECT_ID, 97 98 ColumnType.INTEGER, table2, 0, false); 98 Column column5 = newColumn(COLUMN_PROJECT_NAME, ColumnType.VARCHAR,99 MutableColumn column5 = new MutableColumn(COLUMN_PROJECT_NAME, ColumnType.VARCHAR, 99 100 table2, 1, false); 100 Column column6 = new Column(COLUMN_PROJECT_LINES_OF_CODE,101 Column column6 = new MutableColumn(COLUMN_PROJECT_LINES_OF_CODE, 101 102 ColumnType.BIGINT, table2, 2, true); 102 Column column7 = new Column(COLUMN_PROJECT_PARENT_PROJECT_ID,103 Column column7 = new MutableColumn(COLUMN_PROJECT_PARENT_PROJECT_ID, 103 104 ColumnType.INTEGER, table2, 3, true); 104 105 table2.setColumns(column4, column5, column6, column7); 105 106 106 Table table3 = newTable(TABLE_ROLE, TableType.TABLE, schema);107 Column column8 = newColumn(COLUMN_ROLE_CONTRIBUTOR_ID,107 MutableTable table3 = new MutableTable(TABLE_ROLE, TableType.TABLE, schema); 108 MutableColumn column8 = new MutableColumn(COLUMN_ROLE_CONTRIBUTOR_ID, 108 109 ColumnType.INTEGER, table3, 0, false); 109 Column column9 = newColumn(COLUMN_ROLE_PROJECT_ID, ColumnType.INTEGER,110 MutableColumn column9 = new MutableColumn(COLUMN_ROLE_PROJECT_ID, ColumnType.INTEGER, 110 111 table3, 1, false); 111 Column column10 = newColumn(COLUMN_ROLE_ROLE_NAME, ColumnType.VARCHAR,112 MutableColumn column10 = new MutableColumn(COLUMN_ROLE_ROLE_NAME, ColumnType.VARCHAR, 112 113 table3, 2, false); 113 114 table3.setColumns(column8, column9, column10); 114 115 115 Table table4 = newTable(TABLE_PROJECT_CONTRIBUTOR, TableType.VIEW,116 MutableTable table4 = new MutableTable(TABLE_PROJECT_CONTRIBUTOR, TableType.VIEW, 116 117 schema); 117 Column column11 = newColumn(COLUMN_PROJECT_CONTRIBUTOR_CONTRIBUTOR,118 MutableColumn column11 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_CONTRIBUTOR, 118 119 ColumnType.VARCHAR, table4, 0, false); 119 Column column12 = newColumn(COLUMN_PROJECT_CONTRIBUTOR_PROJECT,120 MutableColumn column12 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_PROJECT, 120 121 ColumnType.VARCHAR, table4, 1, false); 121 Column column13 = newColumn(COLUMN_PROJECT_CONTRIBUTOR_ROLE,122 MutableColumn column13 = new MutableColumn(COLUMN_PROJECT_CONTRIBUTOR_ROLE, 122 123 ColumnType.VARCHAR, table4, 2, false); 123 ArrayList< Column> columnList = new ArrayList<Column>();124 ArrayList<MutableColumn> columnList = new ArrayList<MutableColumn>(); 124 125 columnList.add(column11); 125 126 columnList.add(column12); … … 128 129 129 130 // one-Contributor-to-many-Role's 130 Relationship.createRelationship(newColumn[] { column1 },131 new Column[] { column8 });131 ImmutableRelationship.createRelationship(new MutableColumn[] { column1 }, 132 new MutableColumn[] { column8 }); 132 133 133 134 // one-Project-to-many-Role's 134 Relationship.createRelationship(newColumn[] { column4 },135 new Column[] { column9 });135 ImmutableRelationship.createRelationship(new MutableColumn[] { column4 }, 136 new MutableColumn[] { column9 }); 136 137 137 138 // view relation [contributor -> contributor_name] 138 Relationship.createRelationship(newColumn[] { column2 },139 new Column[] { column11 });139 ImmutableRelationship.createRelationship(new MutableColumn[] { column2 }, 140 new MutableColumn[] { column11 }); 140 141 141 142 // view relation [project -> project_name] 142 Relationship.createRelationship(newColumn[] { column5 },143 new Column[] { column12 });143 ImmutableRelationship.createRelationship(new MutableColumn[] { column5 }, 144 new MutableColumn[] { column12 }); 144 145 145 146 // view relation [role -> role_name] 146 Relationship.createRelationship(newColumn[] { column10 },147 new Column[] { column13 });147 ImmutableRelationship.createRelationship(new MutableColumn[] { column10 }, 148 new MutableColumn[] { column13 }); 148 149 149 150 schema.setTables(table1, table2, table3, table4);
Note: See TracChangeset
for help on using the changeset viewer.
