Package cn.org.rapid_framework.generator.provider.db.table.model

Examples of cn.org.rapid_framework.generator.provider.db.table.model.Table


public class DalgenGeneratorTest extends GeneratorTestCase{

  public void testGenerate() throws Exception{

    Table table = TableFactory.getInstance().getTable("USER_INFO");
   
    g.addTemplateRootDir(new File("template").getAbsoluteFile());
    g.addTemplateRootDir(new File("plugins/dalgen_table//dalgen_table/"));
    g.setExcludes("**/*Manager*.java,**/vo/query/**");
    g.setExcludes("**/*Manager*.java,**/*DaoTest.java,**/*ManagerTest.java");
 
View Full Code Here


public class IbatisGeneratorTest extends GeneratorTestCase{

  public void testGenerate() throws Exception{
 
    Table table = TableFactory.getInstance().getTable("USER_INFO");
   
    g.addTemplateRootDir(new File("template").getAbsoluteFile());
    g.addTemplateRootDir(new File("plugins/ibatis/template"));
   
    generateByTable(table);
View Full Code Here

public class ExtjsGeneratorTest extends GeneratorTestCase{

  public void testGenerate() throws Exception{

    Table table = TableFactory.getInstance().getTable("USER_INFO");
   
    g.addTemplateRootDir(new File("template").getAbsoluteFile());
    g.addTemplateRootDir(new File("plugins/extjs/template"));
   
    generateByTable(table);
View Full Code Here

  private Table getTable(String schema,String tableName) {
    return getTable(getCatalog(),schema,tableName);
  }
 
  private Table getTable(String catalog,String schema,String tableName) {
    Table t = null;
    try {
      t = _getTable(catalog,schema,tableName);
      if(t == null && !tableName.equals(tableName.toUpperCase())) {
        t = _getTable(catalog,schema,tableName.toUpperCase());
      }
View Full Code Here

    Connection conn = DataSourceProvider.getConnection();
    DatabaseMetaData dbMetaData = conn.getMetaData();
    ResultSet rs = dbMetaData.getTables(catalog, schema, tableName, null);
    try {
      while(rs.next()) {
        Table table = new TableCreateProcessor(conn,getSchema(),getCatalog()).createTable(rs);
        return table;
      }
    }finally {
      DBHelper.close(conn,rs);
    }
View Full Code Here

        String remarks = rs.getString("REMARKS");
        if(remarks == null && DatabaseMetaDataUtils.isOracleDataBase(connection.getMetaData())) {
          remarks = getOracleTableComments(tableName);
        }
       
        Table table = new Table();
        table.setSchema(schema);
        table.setCatalog(catalog);
        table.setSqlName(tableName);
        table.setRemarks(remarks);
       
        if ("SYNONYM".equals(tableType) && DatabaseMetaDataUtils.isOracleDataBase(connection.getMetaData())) {
            String[] ownerAndTableName = getSynonymOwnerAndTableName(tableName);
          table.setOwnerSynonymName(ownerAndTableName[0]);
          table.setTableSynonymName(ownerAndTableName[1]);
        }
       
        retriveTableColumns(table);
        table.initExportedKeys(connection.getMetaData());
        table.initImportedKeys(connection.getMetaData());
        BeanHelper.copyProperties(table, TableOverrideValuesProvider.getTableConfigValues(table.getSqlName()));
        return table;
      }catch(SQLException e) {
        throw new RuntimeException("create table object error,tableName:"+tableName,e);
      }finally {
          GLogger.perf("createTable() cost:"+(System.currentTimeMillis()- start)+" tableName:"+tableName);
View Full Code Here

public class TableTest extends TestCase{
 
  public void testTable() throws Exception {
    new GeneratorTestCase().runSqlScripts();
   
    Table t = TableFactory.getInstance().getTable("USER_INFO");
    t.getColumnByName("username").setHasOne("user_info(username)");
    //Table t2 = ObjectHelper.deepClone(t);
    print(t);
   
    System.out.println("\n\n column: \n");
    print(t.getColumns().iterator().next());
    printForTableConfig(t.getColumns().iterator().next());
  }
View Full Code Here

    }
  }
 
  public void test_remove_table_prefix() {
    GeneratorProperties.setProperty(GeneratorConstants.TABLE_REMOVE_PREFIXES, "t_,v_");
    Table table = new Table();
    table.setSqlName("t_user_info");
    assertEquals("UserInfo",table.getClassName());
   
    table.setSqlName("v_user");
    assertEquals("User",table.getClassName());
   
    table.setSqlName("diy_user");
    assertEquals("DiyUser",table.getClassName());
  }
View Full Code Here

    assertEquals("DiyUser",table.getClassName());
  }

   public void test_alipay_dalgen_rule() {
        GeneratorProperties.setProperty(GeneratorConstants.TABLE_NAME_SINGULARIZE, "true");
        Table table = new Table();
        table.setSqlName("bashes");
//        assertEquals("dalgen是这种规则","Bashe",table.getClassName()); //TODO dalgen是这种规则
   }
View Full Code Here

//        assertEquals("dalgen是这种规则","Bashe",table.getClassName()); //TODO dalgen是这种规则
   }
  
  public void test_TABLE_NAME_SINGULARIZE() {
        GeneratorProperties.setProperty(GeneratorConstants.TABLE_NAME_SINGULARIZE, "true");
        Table table = new Table();
        table.setSqlName("bashes");
        assertEquals("Bash",table.getClassName());
       
        table.setSqlName("cuStomeRs");
        assertEquals("CuStomeR",table.getClassName());
       
        GeneratorProperties.setProperty(GeneratorConstants.TABLE_REMOVE_PREFIXES, "t_,v_");
        table.setSqlName("t_user_infos");
        assertEquals("UserInfo",table.getClassName());
       
        GeneratorProperties.setProperty(GeneratorConstants.TABLE_NAME_SINGULARIZE, "false");
        table.setSqlName("bashes");
        assertEquals("Bashes",table.getClassName());
       
        table.setSqlName("cuStomeRs");
        assertEquals("CuStomeRs",table.getClassName());
       
        GeneratorProperties.setProperty(GeneratorConstants.TABLE_REMOVE_PREFIXES, "t_,v_");
        table.setSqlName("t_user_infos");
        assertEquals("UserInfos",table.getClassName());
       
      
    }
View Full Code Here

TOP

Related Classes of cn.org.rapid_framework.generator.provider.db.table.model.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.