/** * Cannot test this without using a C server as unadvertise checks for a running server * * @throws ConnectionException */ public void xtest() throws ConnectionException, ConfigurationException { processStompCommand("tpadvertise,foo,FOOTest,0,queue,5.0.2.Final-SNAPSHOT,", 1); try { connection.tpacall("FOOTest", null, Connection.TPNOREPLY); } catch (ConnectionException e) { fail("Was not able to send the request : " + e.getMessage()); } processDomainCommand("unadvertise,foo,FOOTest,", 1); try { connection.tpcall("FOOTest", null, Connection.TPNOREPLY); fail("Was able to send the request"); } catch (ConnectionException e) { // EXPECTED } processStompCommand("tpadvertise,foo,FOOTest,0,queue,5.0.2.Final-SNAPSHOT,", 1); try { connection.tpacall("FOOTest", null, Connection.TPNOREPLY); } catch (ConnectionException e) { fail("Was not able to send the request : " + e.getMessage()); } processDomainCommand("unadvertise,foo,FOOTest,", 1); }
private void processDomainCommand(String command, int expectation) throws ConnectionException, ConfigurationException { byte[] toSend = command.getBytes(); X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null); buffer.setByteArray(toSend); Response response = connection.tpcall("BTDomainAdmin", buffer, 0); byte[] responseData = ((X_OCTET) response.getBuffer()).getByteArray(); assertEquals(expectation, responseData[0]); }
public void tearDown() throws ConnectionException, ConfigurationException { connection.close(); }