/** Test unmarshalling of a JNDI datasource */
  public void testJNDIDatasourceUnmarshalling() throws Exception {
    DatasourceConfiguration datasource =
        parseDatasource(new ByteArrayInputStream(ANONYMOUS_JNDI_DATASOURCE.getBytes()));

    assertEquals(DataSourceType.JNDI_DATASOURCE, datasource.getType());

    JNDIDatasource jndiDatasource = (JNDIDatasource) datasource;

    assertEquals("jdbc/TestDB", jndiDatasource.getJndiName());
  }
  /** Test unmarshalling of a JDBC datasource */
  public void testJDBCUnmarshalling() throws Exception {

    DatasourceConfiguration datasource =
        parseDatasource(new ByteArrayInputStream(ANONYMOUS_JDBC_DATASOURCE.getBytes()));

    assertEquals(DataSourceType.JDBC_DATASOURCE, datasource.getType());

    JDBCDatasource jdbcDatasource = (JDBCDatasource) datasource;

    assertEquals("org.gjt.mm.mysql.Driver", jdbcDatasource.getDriverClass());
    assertEquals(
        "jdbc:mysql://127.0.0.1/logging?user=logger&password=logpass&database=logging",
        jdbcDatasource.getConnectionString());
  }
  /** Test unmarshalling of a Internal Pool datasource */
  public void testInternalPoolDatasourceUnmarshalling() throws Exception {
    DatasourceConfiguration datasource =
        parseDatasource(new ByteArrayInputStream(ANONYMOUS_INTERNAL_POOL_DATASOURCE.getBytes()));

    assertEquals(DataSourceType.INTERNAL_POOL_DATASOURCE, datasource.getType());

    InternalPoolDatasource internalPoolDatasource = (InternalPoolDatasource) datasource;

    assertEquals("org.gjt.mm.mysql.Driver", internalPoolDatasource.getDriverClass());
    assertEquals(
        "jdbc:mysql://127.0.0.1/logging?database=logging", internalPoolDatasource.getUrl());
    assertEquals("db_user", internalPoolDatasource.getUsername());
    assertEquals("db_password", internalPoolDatasource.getPassword());
    assertEquals("30", internalPoolDatasource.getMaxActive());
    assertEquals("10", internalPoolDatasource.getMaxIdle());
    assertEquals("5", internalPoolDatasource.getMaxWait());
  }