@Test public void testVDBConnectionType() throws Exception { admin.deploy("bqt.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt.vdb"))); VDB vdb = admin.getVDB("bqt", 1); Model model = vdb.getModels().get(0); admin.updateSource("bqt", 1, "Source", "h2", "java:jboss/datasources/ExampleDS"); try { // should not be able to remove from non-multisource admin.removeSource("bqt", 1, model.getName(), "Source"); fail(); } catch (AdminException e) { } assertEquals(ConnectionType.BY_VERSION, vdb.getConnectionType()); Connection conn = TeiidDriver.getInstance() .connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null); conn.close(); admin.changeVDBConnectionType("bqt", 1, ConnectionType.NONE); try { TeiidDriver.getInstance() .connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null); fail("should have failed to connect as no new connections allowed"); } catch (Exception e) { // pass } admin.deploy("bqt2.vdb", new FileInputStream(UnitTestUtil.getTestDataFile("bqt2.vdb"))); admin.updateSource("bqt", 2, "Source", "h2", "java:jboss/datasources/ExampleDS"); conn = TeiidDriver.getInstance() .connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null); conn.close(); admin.changeVDBConnectionType("bqt", 2, ConnectionType.ANY); conn = TeiidDriver.getInstance() .connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null); conn.close(); vdb = admin.getVDB("bqt", 2); model = vdb.getModels().get(0); assertEquals(model.getSourceConnectionJndiName("Source"), "java:jboss/datasources/ExampleDS"); assertEquals(model.getSourceTranslatorName("Source"), "h2"); assertEquals(ConnectionType.ANY, vdb.getConnectionType()); }