@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()); }
@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); }