private void checkExecutionResult(DestinationAction command) throws Exception { if (isCreateCommand(command)) { String fullMessage = output.toString(); System.out.println("output: " + fullMessage); assertTrue(fullMessage, fullMessage.contains("successfully")); assertTrue(checkBindingExists(command, null)); } else { if (command.getName().equals("jmsQueue1") || command.getName().equals("coreQueue2") || command.getName().equals("jmsTopic1")) { String fullMessage = output.toString(); System.out.println("output: " + fullMessage); assertTrue(fullMessage, fullMessage.contains("successfully")); assertFalse(checkBindingExists(command, null)); } else { String errorMessage = error.toString(); System.out.println("error: " + errorMessage); assertTrue(errorMessage, errorMessage.contains("Failed to")); assertFalse(checkBindingExists(command, null)); } } }
private boolean checkBindingExists(DestinationAction command, String filter) { String bindingKey = command.getName(); if (isJms(command)) { if (isTopic(command)) { bindingKey = "jms.topic." + bindingKey; } else { bindingKey = "jms.queue." + bindingKey; } } Map<SimpleString, Binding> bindings = server.getPostOffice().getAllBindings(); System.out.println("bindings: " + bindings); Binding binding = bindings.get(new SimpleString(bindingKey)); System.out.println("got binding: " + binding); if (binding == null) { System.out.println("No bindings for " + bindingKey); return false; } if (filter != null) { Filter bindingFilter = binding.getFilter(); assertNotNull(bindingFilter); assertEquals(filter, bindingFilter.getFilterString().toString()); } return true; }
private boolean isTopic(DestinationAction command) { String destType = command.getDestType(); return DestinationAction.JMS_TOPIC.equals(destType); }
private boolean isJms(DestinationAction command) { String destType = command.getDestType(); return !DestinationAction.CORE_QUEUE.equals(destType); }