@Test public void transportCommandShouldSendPostRequest() { final TransporterCommand command = new TransporterCommand(); final String postEndpoint = "http: final ResponseEntity<TransporterCommand> response = ResponseEntity.ok(command); when(kermossProperties.getHttpDestination(anyString())).thenReturn(postEndpoint); when(restTemplate.exchange(anyString(), same(HttpMethod.POST), any(HttpEntity.class), same(TransporterCommand.class))).thenReturn(response); restCommandTransporterStrategy.transportCommand(command); verify(restTemplate).exchange(same(postEndpoint), same(HttpMethod.POST), any(HttpEntity.class), same(TransporterCommand.class)); }
@Override public Boolean transportCommand(final TransporterCommand command) { try { final ResponseEntity<TransporterCommand> response = this.postCommand(command); if (response.getStatusCode().is2xxSuccessful()) { return true; } }catch (HttpClientErrorException hce) { if (hce.getStatusCode().equals(HttpStatus.CONFLICT)) { return true; } } catch (Exception e) { log.error(e.getMessage(), e); } return false; }
RestCommandTransporterStrategy implements CommandTransporterStrategy { @Override public Boolean transportCommand(final TransporterCommand command) { try { final ResponseEntity<TransporterCommand> response = this.postCommand(command); if (response.getStatusCode().is2xxSuccessful()) { return true; } }catch (HttpClientErrorException hce) { if (hce.getStatusCode().equals(HttpStatus.CONFLICT)) { return true; } } catch (Exception e) { log.error(e.getMessage(), e); } return false; } }
RestCommandTransporterStrategy implements CommandTransporterStrategy { @Override public Boolean transportCommand(final TransporterCommand command) { try { final ResponseEntity<TransporterCommand> response = this.postCommand(command); if (response.getStatusCode().is2xxSuccessful()) { return true; } }catch (HttpClientErrorException hce) { if (hce.getStatusCode().equals(HttpStatus.CONFLICT)) { return true; } } catch (Exception e) { log.error(e.getMessage(), e); } return false; } RestCommandTransporterStrategy(final RestTemplate restTemplate, 
    		KermossProperties kermossProperties); }
RestCommandTransporterStrategy implements CommandTransporterStrategy { @Override public Boolean transportCommand(final TransporterCommand command) { try { final ResponseEntity<TransporterCommand> response = this.postCommand(command); if (response.getStatusCode().is2xxSuccessful()) { return true; } }catch (HttpClientErrorException hce) { if (hce.getStatusCode().equals(HttpStatus.CONFLICT)) { return true; } } catch (Exception e) { log.error(e.getMessage(), e); } return false; } RestCommandTransporterStrategy(final RestTemplate restTemplate, 
    		KermossProperties kermossProperties); @Override Boolean transportCommand(final TransporterCommand command); @Override Boolean transportPrepareCommand(final TransporterCommand command); }
RestCommandTransporterStrategy implements CommandTransporterStrategy { @Override public Boolean transportCommand(final TransporterCommand command) { try { final ResponseEntity<TransporterCommand> response = this.postCommand(command); if (response.getStatusCode().is2xxSuccessful()) { return true; } }catch (HttpClientErrorException hce) { if (hce.getStatusCode().equals(HttpStatus.CONFLICT)) { return true; } } catch (Exception e) { log.error(e.getMessage(), e); } return false; } RestCommandTransporterStrategy(final RestTemplate restTemplate, 
    		KermossProperties kermossProperties); @Override Boolean transportCommand(final TransporterCommand command); @Override Boolean transportPrepareCommand(final TransporterCommand command);  }