Package com.avaje.ebean.config

Examples of com.avaje.ebean.config.ServerConfig


public class CreateIdExpandedFormServer {

    public static EbeanServer create() {
       
       
        ServerConfig config = new ServerConfig();
        config.setName("h2");
        config.loadFromProperties();
        config.setName("modifiedH2");
       
        config.addClass(ROrder.class);
        config.addClass(ROrderPK.class);
        config.addClass(RCustomer.class);
        config.addClass(RCustomerKey.class);
       
        config.setDatabasePlatform(new ModifiedH2Platform());
       
        return EbeanServerFactory.create(config);  
    }
View Full Code Here


public class TestTypeManager extends BaseTestCase {

  @Test
  public void test() {

    ServerConfig serverConfig = new ServerConfig();
    serverConfig.setDatabasePlatform(new H2Platform());

    BootupClasses bootupClasses = new BootupClasses();

    DefaultTypeManager typeManager = new DefaultTypeManager(serverConfig, bootupClasses);
View Full Code Here

public class MainDdlWithSchema {

    public static void main(String[] args) {

        ServerConfig cfg = new ServerConfig();
        cfg.setName("h2");
        cfg.loadFromProperties();
        cfg.addClass(EBasic.class);

        // .... other settings ...
        //UnderscoreNamingConvention naming = new UnderscoreNamingConvention();
        //naming.setSchema("test");
        //cfg.setNamingConvention(naming);
        cfg.setDdlGenerate(true);
        cfg.setDdlRun(true);
        EbeanServer ebean = EbeanServerFactory.create(cfg);
        //ebean.createSqlUpdate("create schema foo").execute();
        System.out.println(ebean);
    }
View Full Code Here

    }
  }

  public static void main(String[] args) {
    // ### Configuration Objects ###
    ServerConfig serverConfig = new ServerConfig();
    DataSourceConfig dataSourceConfig = new DataSourceConfig();

    // ### Configuration Settings ###
    // -> data source
    dataSourceConfig.setDriver("org.h2.Driver");
    dataSourceConfig.setUsername("howtouser");
    dataSourceConfig.setPassword("");
    dataSourceConfig.setUrl("jdbc:h2:db/howto1");

    // -> server
    serverConfig.setName("default");
    serverConfig.setDataSourceConfig(dataSourceConfig);

    // auto create db if it does not exist
    if (!(new File("db/howto1.data.db")).exists()) {
      serverConfig.setDdlGenerate(true);
      serverConfig.setDdlRun(true);
      serverConfig.addClass(TOne.class);
    }

    EbeanServer eServer = EbeanServerFactory.create(serverConfig);

    long id = 1;
View Full Code Here

   * Create a server for running small oracle specific tests manually.
   * DDL generation etc.
   */
  private EbeanServer createOracleEbeanServer() {

    ServerConfig c = new ServerConfig();
    c.setName("ora");

    // requires oracle driver in class path
    DataSourceConfig oraDb = new DataSourceConfig();
    oraDb.setDriver("oracle.jdbc.driver.OracleDriver");
    oraDb.setUsername("junk");
    oraDb.setPassword("junk");
    oraDb.setUrl("jdbc:oracle:thin:junk/junk@localhost:1521:XE");
    oraDb.setHeartbeatSql("select count(*) from dual");
   
   
    c.loadFromProperties();
    c.setDdlGenerate(true);
    c.setDdlRun(true);
    c.setDefaultServer(false);
    c.setRegister(false);
    c.setDataSourceConfig(oraDb);
   
    //c.setDatabaseBooleanTrue("1");
    //c.setDatabaseBooleanFalse("0");
    c.setDatabaseBooleanTrue("T");
    c.setDatabaseBooleanFalse("F");

    c.addClass(TOne.class);
    c.addClass(TSMaster.class);
    c.addClass(TSDetail.class);

    return EbeanServerFactory.create(c);

  }
View Full Code Here

  }
 
  private EbeanServer createEbeanServer() {

    ServerConfig c = new ServerConfig();
    c.setName("pgtest");

    // requires postgres driver in class path
    DataSourceConfig postgresDb = new DataSourceConfig();
    postgresDb.setDriver("org.postgresql.Driver");
    postgresDb.setUsername("test");
    postgresDb.setPassword("test");
    postgresDb.setUrl("jdbc:postgresql://127.0.0.1:5432/test");
    postgresDb.setHeartbeatSql("select count(*) from t_one");
   
    c.loadFromProperties();
    c.setDdlGenerate(true);
    c.setDdlRun(true);
    c.setDefaultServer(false);
    c.setRegister(false);
    c.setDataSourceConfig(postgresDb);
   
    //c.setDatabaseBooleanTrue("1");
    //c.setDatabaseBooleanFalse("0");
    c.setDatabaseBooleanTrue("T");
    c.setDatabaseBooleanFalse("F");

    c.setDatabasePlatform(new PostgresPlatform());

    c.addClass(TOne.class);

    return EbeanServerFactory.create(c);

  }
View Full Code Here

public class TestAutoCommitDataSource extends BaseTestCase {

  @Test
  public void test() {
   
    ServerConfig config = new ServerConfig();
    config.setName("h2autocommit");
    config.loadFromProperties();
   
    config.addClass(UTDetail.class);
    config.setDdlGenerate(true);
    config.setDdlRun(true);
    config.setAutoCommitMode(true);
    GlobalProperties.setSkipPrimaryServer(true);
   
    EbeanServer ebeanServer = EbeanServerFactory.create(config);
   
View Full Code Here

   * Create the server reading configuration information from ebean.properties.
   */
  public SpiEbeanServer createServer(String name) {

    ConfigBuilder b = new ConfigBuilder();
    ServerConfig config = b.build(name);

    return createServer(config);
  }
View Full Code Here

  /**
   * Create a ServerConfig and load it from ebean.properties.
   */
  public ServerConfig build(String serverName) {
   
    ServerConfig config = new ServerConfig();
    config.setName(serverName)
   
    config.loadFromProperties();
   
    return config;
  }
View Full Code Here

        this.classLoader = classLoader;
        this.configFile = new File(dataFolder, "config.yml");
        this.logger = new PluginLogger(this);

        if (description.isDatabaseEnabled()) {
            ServerConfig db = new ServerConfig();

            db.setDefaultServer(false);
            db.setRegister(false);
            db.setClasses(getDatabaseClasses());
            db.setName(description.getName());
            server.configureDbConfig(db);

            DataSourceConfig ds = db.getDataSourceConfig();

            ds.setUrl(replaceDatabaseString(ds.getUrl()));
            dataFolder.mkdirs();

            ClassLoader previous = Thread.currentThread().getContextClassLoader();
View Full Code Here

TOP

Related Classes of com.avaje.ebean.config.ServerConfig

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.