Examples of JndiDataSourceLookup


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

  }

  @Test
  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

  @Ignore  // not doing schema parsing anymore for JPA 2.0 compatibility
  @Test
  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

  @Ignore  // not doing schema parsing anymore for JPA 2.0 compatibility
  @Test
  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

  }

  @Test
  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

  }

  @Test
  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

  }

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

    assertNotNull(info);
    assertEquals("The number of persistence units is incorrect.", 4, info.length);
View Full Code Here

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

  }

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

    assertNotNull(info);
    assertEquals("The number of persistence units is incorrect.", 4, info.length);
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 JndiDataSourceAutoConfiguration {

  @Bean(destroyMethod = "")
  @ConditionalOnMissingBean
  public DataSource dataSource(DataSourceProperties properties) {
    JndiDataSourceLookup dataSourceLookup = new JndiDataSourceLookup();
    return dataSourceLookup.getDataSource(properties.getJndiName());
  }
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.