Examples of JndiDataSourceLookup


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

    assertEquals(0, info[0].getProperties().keySet().size());
  }

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

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

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

    SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
    DataSource ds = new DriverManagerDataSource();
    builder.bind("java:comp/env/jdbc/MyDB", ds);

    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example4.xml";
    PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);

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

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

    builder.clear();
  }

  public void testExample5() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example5.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(ds, pu2.getNonJtaDataSource());
  }

  public void testExample6() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example6.xml";
    PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);
    assertEquals(1, info.length);
    assertEquals("pu", info[0].getPersistenceUnitName());
    assertEquals(0, info[0].getProperties().keySet().size());
View Full Code Here

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

    assertEquals(0, info[0].getProperties().keySet().size());
  }

  public void testInvalidPersistence() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-invalid.xml";
    try {
      reader.readPersistenceUnitInfos(resource);
      fail("expected invalid document exception");
    }
View Full Code Here

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

    }
  }

  public void testNoSchemaPersistence() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-no-schema.xml";
    try {
      reader.readPersistenceUnitInfos(resource);
      fail("expected invalid document exception");
    }
View Full Code Here

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

    }
  }

  public void testPersistenceUnitRootUrl() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());

    URL url = reader.determinePersistenceUnitRootUrl(new ClassPathResource(
        "/org/springframework/orm/jpa/persistence-no-schema.xml"));
    assertNull(url);
View Full Code Here

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

    assertTrue("the containing folder should have been returned", url.toString().endsWith("/org/springframework/orm/jpa/"));
  }
 
  public void testPersistenceUnitRootUrlWithJar() throws Exception {
    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());

    ClassPathResource archive = new ClassPathResource("/org/springframework/orm/jpa/jpa-archive.jar");
    String newRoot = "jar:" + archive.getURL().toExternalForm() + "!/META-INF/persist.xml";
    Resource insideArchive = new UrlResource(newRoot);
    // make sure the location actually exists
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

   * @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
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.