Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.DriverManagerDataSource


    operation.validateParameters(new Object[] {"DUMMY_VALUE1", "DUMMY_VALUE2"});
  }

  public void testParametersSetWithList() {
    TestRdbmsOperation operation = new TestRdbmsOperation();
    DataSource ds = new DriverManagerDataSource();
    operation.setDataSource(ds);
    operation.setSql("select * from mytable where one = ? and two = ?");
    List l = new ArrayList();
    l.add(new SqlParameter("one", Types.NUMERIC));
    l.add(new SqlParameter("two", Types.VARCHAR));
View Full Code Here


* @since 05.03.2005
*/
public class LocalSessionFactoryBeanTests extends TestCase {

  public void testLocalSessionFactoryBeanWithDataSource() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    final List invocations = new ArrayList();
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
      protected Configuration newConfiguration() {
        return new Configuration() {
          public Configuration addInputStream(InputStream is) {
View Full Code Here

    assertTrue(sfb.getConfiguration() != null);
    assertEquals("newSessionFactory", invocations.get(0));
  }

  public void testLocalSessionFactoryBeanWithTransactionAwareDataSource() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    final List invocations = new ArrayList();
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
      protected Configuration newConfiguration() {
        return new Configuration() {
          public Configuration addInputStream(InputStream is) {
View Full Code Here

    assertTrue(sfb.getConfiguration() != null);
    assertEquals("newSessionFactory", invocations.get(0));
  }

  public void testLocalSessionFactoryBeanWithDataSourceAndMappingResources() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    MockControl tmControl = MockControl.createControl(TransactionManager.class);
    final TransactionManager tm = (TransactionManager) tmControl.getMock();
    final List invocations = new ArrayList();
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
      protected Configuration newConfiguration() {
View Full Code Here

    assertEquals("addResource", invocations.get(1));
    assertEquals("newSessionFactory", invocations.get(2));
  }

  public void testLocalSessionFactoryBeanWithDataSourceAndMappingJarLocations() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    final Set invocations = new HashSet();
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
      protected Configuration newConfiguration() {
        return new Configuration() {
          public Configuration addJar(File file) {
View Full Code Here

    assertTrue(invocations.contains("addResource mapping2.hbm.jar"));
    assertTrue(invocations.contains("newSessionFactory"));
  }

  public void testLocalSessionFactoryBeanWithDataSourceAndProperties() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    final Set invocations = new HashSet();
    LocalSessionFactoryBean sfb = new LocalSessionFactoryBean() {
      protected Configuration newConfiguration() {
        return new Configuration() {
          public Configuration addInputStream(InputStream is) {
View Full Code Here

      protected SessionFactory newSessionFactory(Configuration config) {
        return sessionFactory;
      }
    };
    sfb.setMappingResources(new String[0]);
    sfb.setDataSource(new DriverManagerDataSource());
    sfb.setExposeTransactionAwareSessionFactory(false);
    sfb.afterPropertiesSet();
    assertTrue(sessionFactory == sfb.getObject());
    sfb.destroy();
    factoryControl.verify();
View Full Code Here

          }
        };
      }
    };
    sfb.setMappingResources(new String[0]);
    sfb.setDataSource(new DriverManagerDataSource());
    MockControl interceptorControl = MockControl.createControl(Interceptor.class);
    Interceptor entityInterceptor = (Interceptor) interceptorControl.getMock();
    interceptorControl.replay();
    sfb.setEntityInterceptor(entityInterceptor);
    try {
View Full Code Here

          }
        };
      }
    };
    sfb.setMappingResources(new String[0]);
    sfb.setDataSource(new DriverManagerDataSource());
    sfb.setNamingStrategy(ImprovedNamingStrategy.INSTANCE);
    try {
      sfb.afterPropertiesSet();
      fail("Should have thrown IllegalArgumentException");
    }
View Full Code Here

        return null;
      }
    };

    sfb.setMappingResources(new String[0]);
    sfb.setDataSource(new DriverManagerDataSource());
    Properties classCache = new Properties();
    classCache.setProperty("org.springframework.beans.TestBean", "read-write");
    sfb.setEntityCacheStrategies(classCache);
    Properties collectionCache = new Properties();
    collectionCache.setProperty("org.springframework.beans.TestBean.friends", "read-only");
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.DriverManagerDataSource

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.