Commit 1bc41ffcc38f7457e72dc1b08f172f77d81fa98c
Add an isConnected method to connection provided by Luis Costa
| |   |
| 7 | 7 | Thomas Fricke <libvirt@thomasfricke.de> |
| 8 | 8 | David Lively <dlively@virtualiron.com> |
| 9 | 9 | Bryan Kearney <bkearney@redhat.com> |
| Luis Carlos Moreira da Costa <tcljava@gmail.com> |
| |   |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| * the native virConnectPtr. |
| * The native virConnectPtr. |
| 134 | 134 | */ |
| 135 | 135 | protected ConnectionPointer VCP; |
| 136 | 136 | |
| … | … | |
| 1565 | 1565 | processError(); |
| 1566 | 1566 | return new Stream(this, sPtr); |
| 1567 | 1567 | } |
| |
| /** |
| * Verify the connect is active. |
| * |
| * @return boolean The true connected, or false not. |
| * @throws LibvirtException |
| */ |
| public boolean isConnected() throws LibvirtException { |
| return ( ( VCP != null ) ? true : false ); |
| } |
| 1568 | 1578 | } |
| |   |
| 50 | 50 | assertEquals("nodeInfo.threads", 2, nodeInfo.threads); |
| 51 | 51 | // These are basically no-exception tests |
| 52 | 52 | assertTrue("conn.getCellsFreeMemory", conn.getCellsFreeMemory(0, 10) > 0); |
| assertTrue("conn.isConnectd", conn.isConnected()); |
| 53 | 54 | // Test Hypervisor does not support this. |
| 54 | 55 | // assertTrue("conn.getFreeMemory", conn.getFreeMemory() > 0); |
| 55 | 56 | } |
| … | … | |
| 190 | 190 | public void testAccessAfterClose() throws Exception { |
| 191 | 191 | Connect conn = new Connect("test:///default", false); |
| 192 | 192 | conn.close(); |
| assertTrue("conn.isConnected should be false", !conn.isConnected()); |
| 193 | 194 | try { |
| 194 | 195 | conn.getHostName(); |
| 195 | 196 | } catch (LibvirtException e) { |