Examples of JndiDataSourceLookup


Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

    realDsResource = new Resource("jdbc/realDs", realDs);

    P6TestUtil.setupTestData(realDs);

    // get the data source from JNDI
    DataSource ds = new JndiDataSourceLookup().getDataSource("jdbc/spyDs");
    assertNotNull("JNDI data source not found", ds);

    // get the connection
    con = ds.getConnection();
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

      poolingDSs.add(fixedDs);
    }

    // liquibase opens it's own transaction => keep it out of ours
    try {
      P6TestUtil.setupTestData(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs"));
      P6TestUtil.setupTestData(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs"));
    } catch (LiquibaseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    try {
      tm.begin();
      // TODO move to liquibase?
      cleanData(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs"));
      cleanData(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs"));
      tm.commit();
    } catch (NotSupportedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (SystemException e) {
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

  @Test
  public void twoPhaseCommitDataPersistedOnCommit() {
    try {
      tm.begin();
      insertData(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs"));
      insertData(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs"));
      tm.commit();

      tm.begin();
      assertEquals(1, queryForInt(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs")));
      assertEquals(1, queryForInt(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs")));
      tm.commit();

    } catch (NotSupportedException e) {
      e.printStackTrace();
      Assert.fail();
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

  @Test
  public void twoPhaseCommitDataNotPersistedOnRollback() {
    try {
      tm.begin();
      insertData(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs"));
      insertData(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs"));
      tm.rollback();

      tm.begin();
      assertEquals(0, queryForInt(new JndiDataSourceLookup().getDataSource("jdbc/inTestDs")));
      assertEquals(0, queryForInt(new JndiDataSourceLookup().getDataSource("jdbc/fixedDs")));
      tm.commit();

    } catch (NotSupportedException e) {
      e.printStackTrace();
      Assert.fail();
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

    }
  }

  @Test
  public void testSpyEnabledDataSource() throws SQLException {
    DataSource spyDs1 = new JndiDataSourceLookup().getDataSource("jdbc/spyDs1");

    // The spy data sources should be spy enabled
    validateSpyEnabled(spyDs1);
    // verify that the correct database driver was used
    assertTrue(spyDs1.getConnection().getMetaData().getDatabaseProductName().contains("H2"));

    DataSource spyDs3 = new JndiDataSourceLookup().getDataSource("jdbc/spyDs3");
    // The spy data sources should be spy enabled
    validateSpyEnabled(spyDs3);
    // verify that the correct database driver was used
    assertTrue(spyDs3.getConnection().getMetaData().getDatabaseProductName().contains("HSQL"));
  }
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

  }

  @Test
  public void testNotSpyEnabledDataSource() throws SQLException {
    // the read data sources should NOT be spy enabled
    DataSource realDs1 = new JndiDataSourceLookup().getDataSource("jdbc/realDs1");
    validateNotSpyEnabled(realDs1);
    DataSource realDs2 = new JndiDataSourceLookup().getDataSource("jdbc/realDs2");
    validateNotSpyEnabled(realDs2);
    DataSource realDs3 = new JndiDataSourceLookup().getDataSource("jdbc/realDs3");
    validateNotSpyEnabled(realDs3);
  }
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

    P6TestUtil.setupTestData(realDs);


    // get the data source from JNDI
    DataSource ds = new JndiDataSourceLookup().getDataSource("jdbc/spyDs");
    assertNotNull("JNDI data source not found", ds);

    // get the connection
    con = ds.getConnection();
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

   * @see org.springframework.jdbc.datasource.lookup.BeanFactoryDataSourceLookup
   * @see #setDataSources
   * @see #setDefaultDataSource
   */
  public void setDataSourceLookup(DataSourceLookup dataSourceLookup) {
    this.dataSourceLookup = (dataSourceLookup != null ? dataSourceLookup : new JndiDataSourceLookup());
  }
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

*/
public class PersistenceXmlParsingTests extends TestCase {

  public void testExample1() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example1.xml";
    PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);

    assertNotNull(info);
    assertEquals(1, info.length);
View Full Code Here

Examples of org.springframework.jdbc.datasource.lookup.JndiDataSourceLookup

    assertEquals("OrderManagement", info[0].getPersistenceUnitName());
  }

  public void testExample2() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example2.xml";
    PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);

    assertNotNull(info);
    assertEquals(1, info.length);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.