@Override public ServiceResponse<KieContainerResourceList> listContainers() { if( config.isRest() ) { return makeHttpGetRequestAndCreateServiceResponse( baseURI + "/containers", KieContainerResourceList.class ); } else { CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand) new ListContainersCommand() ) ); return (ServiceResponse<KieContainerResourceList>) executeJmsCommand( script ).getResponses().get( 0 ); } }
@Test public void testUnmarshallListContainersCommandWithNoFilter() { String commandString = "<list-containers/>"; Marshaller marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.XSTREAM, getClass().getClassLoader()); ListContainersCommand command = marshaller.unmarshall(commandString, ListContainersCommand.class); // the default ACCEPT_ALL filter should be set Assertions.assertThat(command.getKieContainerResourceFilter()).isEqualTo(KieContainerResourceFilter.ACCEPT_ALL); }
responses.add(this.kieServer.getInfo()); } else if (command instanceof ListContainersCommand) { responses.add(this.kieServer.listContainers(((ListContainersCommand)command).getKieContainerResourceFilter())); } else if (command instanceof CallContainerCommand) { ServiceResponse response = callContainer(((CallContainerCommand) command).getContainerId(), ((CallContainerCommand) command).getPayload(), marshallingFormat, classType, true);
@Override public ServiceResponse<KieContainerResourceList> listContainers(KieContainerResourceFilter containerFilter) { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new ListContainersCommand(containerFilter))); ServiceResponse<KieContainerResourceList> response = (ServiceResponse<KieContainerResourceList>) sendCommand(script, new WebSocketServiceResponse(true, (message) -> { ServiceResponsesList list = WebSocketUtils.unmarshal(message, ServiceResponsesList.class); return list.getResponses().get(0); })).getResponses().get(0); return response; }
@Override public ServiceResponse<KieContainerResourceList> listContainers(KieContainerResourceFilter containerFilter) { if (config.isRest()) { String queryParams = containerFilter.toURLQueryString(); String uri = loadBalancer.getUrl() + "/containers" + (queryParams.isEmpty() ? "" : "?" + queryParams); return makeHttpGetRequestAndCreateServiceResponse(uri, KieContainerResourceList.class); } else { CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new ListContainersCommand(containerFilter))); ServiceResponse<KieContainerResourceList> response = (ServiceResponse<KieContainerResourceList>) executeJmsCommand(script).getResponses().get(0); return getResponseOrNullIfNoResponse(response); } }
private static ListContainersCommand createListContainersCommand() { return new ListContainersCommand(createKieContainerResourceFilter()); }