public void testGetDatasourceProperties() throws Exception {
    Properties props = new Properties();
    props.setProperty("connection-url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
    props.setProperty("user-name", "sa");
    props.setProperty("password", "sa");
    props.setProperty("connection-properties", "foo=bar,blah=blah");
    props.setProperty("max-pool-size", "4");

    admin.createDataSource("Oracle11_PushDS", "h2", props);

    Properties p = admin.getDataSource("Oracle11_PushDS");
    assertEquals("4", p.getProperty("max-pool-size"));
    assertEquals("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", p.getProperty("connection-url"));

    admin.deleteDataSource("Oracle11_PushDS");

    p = new Properties();
    p.setProperty("class-name", "org.teiid.resource.adapter.ws.WSManagedConnectionFactory");
    p.setProperty("EndPoint", "{endpoint}");
    props.setProperty("max-pool-size", "4");
    admin.createDataSource("nowhere", "teiid-connector-ws.rar", p);

    assertEquals(
        "org.teiid.resource.adapter.ws.WSManagedConnectionFactory", p.getProperty("class-name"));
    assertEquals("4", p.getProperty("max-pool-size"));
    assertEquals("{endpoint}", p.getProperty("EndPoint"));

    admin.deleteDataSource("nowhere");
  }
  @Test
  public void testCreateConnectionFactory() throws Exception {
    String deployedName = "wsOne";

    assertFalse(admin.getDataSourceNames().contains(deployedName));

    Properties p = new Properties();
    p.setProperty("class-name", "org.teiid.resource.adapter.ws.WSManagedConnectionFactory");
    p.setProperty("EndPoint", "{endpoint}");
    admin.createDataSource(deployedName, "webservice", p);

    assertTrue(admin.getDataSourceNames().contains(deployedName));

    admin.deleteDataSource(deployedName);

    assertFalse(admin.getDataSourceNames().contains(deployedName));

    admin.createDataSource(deployedName, "webservice", p);

    assertTrue(admin.getDataSourceNames().contains(deployedName));

    admin.deleteDataSource(deployedName);
  }
  @Test
  public void testVDBDeployment() throws Exception {
    Collection<?> vdbs = admin.getVDBs();
    assertTrue(vdbs.isEmpty());

    Collection<String> dsNames = admin.getDataSourceNames();
    if (dsNames.contains("Oracle11_PushDS")) {
      admin.deleteDataSource("Oracle11_PushDS");
    }

    admin.deploy("bqt.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb")));

    vdbs = admin.getVDBs();
    assertFalse(vdbs.isEmpty());

    VDB vdb = admin.getVDB("bqt", 1);
    assertFalse(vdb.isValid());
    assertTrue(AdminUtil.waitForVDBLoad(admin, "bqt", 1, 3));
    assertFalse(vdb.isValid());

    Properties props = new Properties();
    props.setProperty("connection-url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");
    props.setProperty("user-name", "sa");
    props.setProperty("password", "sa");
    props.setProperty("connection-properties", "foo=bar,blah=blah");

    admin.createDataSource("Oracle11_PushDS", "h2", props);

    vdb = admin.getVDB("bqt", 1);
    assertTrue(vdb.isValid());
    assertTrue(vdb.getStatus().equals(Status.ACTIVE));

    dsNames = admin.getDataSourceNames();
    assertTrue(dsNames.contains("Oracle11_PushDS"));

    admin.deleteDataSource("Oracle11_PushDS");
    vdb = admin.getVDB("bqt", 1);
    assertFalse(vdb.isValid());
  }