Package org.xmlBlaster.contrib.db

Examples of org.xmlBlaster.contrib.db.DbPool


    * Creates a database pooling instance and puts it to info.
    * @param info The configuration
    * @return The created pool
    */
   private DbPool setUpDbPool(I_Info info) {
      DbPool dbPool = new DbPool();
      dbPool.init(info);
      info.putObject("db.pool", dbPool);
      return dbPool;
   }
View Full Code Here


    * Creates a database pooling instance and puts it to info.
    * @param info The configuration
    * @return The created pool
    */
   private DbPool setUpDbPool(I_Info info) {
      DbPool dbPool = new DbPool();
      dbPool.init(info);
      info.putObject("db.pool", dbPool);
      return dbPool;
   }
View Full Code Here

      addIfNotSet("db.url", dbUrl);
      addIfNotSet("db.user", dbUser);
      addIfNotSet("db.password", dbPassword);
      addIfNotSet("db.drivers", dbDrivers);
     
      I_DbPool newPool = new DbPool();
     
      newPool.init(this);
      this.persistentInfo = new DbInfo(newPool, "replication", this);
      return newPool;
   }
View Full Code Here

         // connectionPoolSize
         QueuePluginManager pluginManager = new QueuePluginManager(glob);
         PluginInfo pluginInfo = new PluginInfo(glob, pluginManager, "JDBC", "1.0");
         info = new TestInfo();
         ((TestInfo)info).init(glob, pluginInfo);
         pool = new DbPool();
         pool.init(info);
        
         // delete tables
         String prefix = "queue.jdbc";
         storeFactory = new XBStoreFactory(prefix);
View Full Code Here

      info.put("jdbc.drivers", driverClass);
      info.put("db.url", dbUrl);
      info.put("db.user", dbUser);
      info.put("db.password", dbPassword);
       
      DbPool dbPool = new DbPool();
      dbPool.init(info);
      info.putObject("db.pool", dbPool);
     
      return dbPool;
   }
View Full Code Here

    * @see TestCase#setUp()
    */
   protected void setUp() throws Exception {
      super.setUp();
      I_Info info = new PropertiesInfo(System.getProperties());
      this.pool = new DbPool();
      this.pool.init(info);
      String context = null; // shall be set to '/'
      info.put("dbs.table", "TEST_DB_STORAGE");
      this.dbStorage = new DbStorage(info, this.pool, context);
     
View Full Code Here

    * Creates a database pooling instance and puts it to info.
    * @param info The configuration
    * @return The created pool
    */
   private DbPool setUpDbPool(I_Info info) {
      DbPool dbPool = new DbPool();
      dbPool.init(info);
      info.putObject("db.pool", dbPool);
      return dbPool;
   }
View Full Code Here

         SpecificHelper specificHelper = new SpecificHelper(System.getProperties());
         I_Info info = new PropertiesInfo((Properties)specificHelper.getProperties().clone());
         info.put("replication.searchable.xmlBlaster.table1", "first, second, third, fourth");
         info.put("replication.searchable.XMLBLASTER.TABLE2", "FIRST,SECOND");
        
         DbPool pool = new DbPool();
         pool.init(info);
         info.putObject(DbWriter.DB_POOL_KEY, pool);
        
         SearchableConfig searchableConfig = new SearchableConfig();
         searchableConfig.init(info);
         info.putObject(SearchableConfig.NAME, searchableConfig);
        
         pool.update("drop table table1");
         String txt = "create table table1 (first VARCHAR(100), second VARCHAR(100), third blob, fifth VARCHAR(29), primary key(first))";
         pool.update(txt);
        
         pool.update("INSERT INTO table1 (first, second, fifth) values ('oldOne', 'oldTwo', 'oldFive')");
        
         Set vals = searchableConfig.getSearchableColumnNames(null, "XMLBLASTER", "TABLE1");
         String[] ret = (String[])vals.toArray(new String[vals.size()]);
         assertEquals("Wrong number of colums found", 4, ret.length);
        
         SqlInfo sqlInfo = new SqlInfo(info);
         Connection conn = pool.reserve();
         sqlInfo.fillMetadata(conn, null, "XMLBLASTER", "TABLE1", null, null);
         pool.release(conn);
        
         SqlDescription description = sqlInfo.getDescription();
         boolean isConfigured = description.isColumnSearchConfigured(null);
         assertTrue("shall be configured", isConfigured);
        
         isConfigured = description.isColumnSearchConfigured("FIRST");
         assertTrue("shall be configured", isConfigured);
         isConfigured = description.isColumnSearchConfigured("SECOND");
         assertTrue("shall be configured", isConfigured);
         isConfigured = description.isColumnSearchConfigured("THIRD");
         assertFalse("shall not be configured", isConfigured);
         isConfigured = description.isColumnSearchConfigured("FOURTH");
         assertTrue("shall be configured (since it could be added later)", isConfigured);
        
         String oldFirst = "oldOne";
         String oldSecond = "oldTwo";
         String first = "one";
         String second = "two";
         String fifth = "five";
         int replKey = 1;
         SqlInfo sql = createMsg(info, oldFirst, oldSecond, first, second, fifth, replKey);
        
         String xml = sql.toXml("");
         log.info(xml);
        
         SqlInfoParser parser = new SqlInfoParser();
         parser.init(info);
        
         sql = parser.parse(xml);
        
         ReplicationWriter writer = new ReplicationWriter();
         writer.init(info);
         writer.store(sql);
        
         // verify now,

         conn = pool.reserve();
         Statement st = conn.createStatement();
         ResultSet rs = st.executeQuery("SELECT count(*) FROM TABLE1");
         rs.next();
         int count = rs.getInt(1);
         assertEquals("there must be only one entry in the table TABLE1", 1, count);
         st.close();
         st = conn.createStatement();
         rs = st.executeQuery("SELECT FIRST,SECOND,FIFTH FROM TABLE1");
         rs.next();
         first = rs.getString(1);
         second = rs.getString(2);
         fifth = rs.getString(3);
         st.close();
         pool.release(conn);
        
         assertEquals("first", "one", first);
         assertEquals("second", "two", second);
         assertEquals("fifth", "five", fifth);
        
         pool.update("drop table table1");
      }
      catch (Exception ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur here" + ex.getMessage(), false);
      }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.db.DbPool

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.