protected ClientRequest newRequest(String uriString) { URI uri; try { uri = new URI(uriString); } catch (URISyntaxException e) { throw new RuntimeException("Malformed request URI was specified: '" + uriString + "'!", e); } if (TestConfig.isLocalServer()) { return new ClientRequest(uriString); } else { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials( new AuthScope(uri.getHost(), uri.getPort()), new UsernamePasswordCredentials(TestConfig.getUsername(), TestConfig.getPassword())); HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build(); ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(client); return new ClientRequest(uriString, executor); } }
protected static KieServicesConfiguration createKieServicesJmsConfiguration() { try { InitialContext context = TestConfig.getInitialRemoteContext(); Queue requestQueue = (Queue) context.lookup(TestConfig.getRequestQueueJndi()); Queue responseQueue = (Queue) context.lookup(TestConfig.getResponseQueueJndi()); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(TestConfig.getConnectionFactory()); KieServicesConfiguration jmsConfiguration = KieServicesFactory.newJMSConfiguration( connectionFactory, requestQueue, responseQueue, TestConfig.getUsername(), TestConfig.getPassword()); return jmsConfiguration; } catch (Exception e) { throw new RuntimeException("Failed to create JMS client configuration!", e); } }
protected static KieServicesConfiguration createKieServicesRestConfiguration() { return KieServicesFactory.newRestConfiguration( TestConfig.getHttpUrl(), TestConfig.getUsername(), TestConfig.getPassword()); }