protected KieSession initKieSession() throws CoreException { RuntimeEngine restSessionFactory; try { restSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId(bpmConfig.getDeploymentId()) .addUrl(new URL(bpmConfig.getBpmInstanceUrl())) .addUserName(bpmConfig.getUsername()) .addPassword(bpmConfig.getPassword()) .addTimeout(AUTHENTICATION_TIMEOUT_S) .build(); } catch (Exception e) { throw new CoreException("Could not initialize connection to BPM server at '" + bpmConfig.getBpmInstanceUrl() + "' check that the URL is correct.", e); } return restSessionFactory.getKieSession(); }
@Test public void notAceptedMethodTest() throws Exception { URL deploymentUrl = new URL( "http://localhost:8080/kie-wb/" ); RemoteRestRuntimeEngineFactory restSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId("deployment") .addUrl(deploymentUrl) .addUserName("mary") .addPassword("pass") .buildFactory(); WorkItemHandler wih = new DoNothingWorkItemHandler(); try { restSessionFactory.newRuntimeEngine().getKieSession().getWorkItemManager().registerWorkItemHandler("test", wih); fail( "The above call should have failed."); } catch( UnsupportedOperationException uoe ) { assertTrue("Incorrect error message: " + uoe.getMessage(), uoe.getMessage().contains("not supported on the Remote Client instance.")); } }
.addDeploymentId("deploymentId") .addUrl(new URL("http://localhost:" + port + "/" )) .build(); .addDeploymentId("deploymentId") .addUrl(new URL("http://localhost:" + port + "/" )) .addHeader(NOT_SENT_HEADER_NAME, String.valueOf(random.nextLong()))
.addDeploymentId(deploymentId) .addUrl(deploymentUrl) .addUserName(userId)
org.kie.remote.client.api.RemoteRestRuntimeEngineFactory restRuntimeFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addProcessInstanceId(23l) .addUserName("S") .addDeploymentId("deployment") .addPassword("poffertje") .addUrl(new URL("http://localhost:8080/kie-wb")) .addDeploymentId("deployment") .addUserName("A") .addUrl(new URL("http://localhost:8080/kie-wb")) .addDeploymentId("deployment") .addUserName("E") .addPassword("suiker")
.addDeploymentId(deploymentId) .addUserName(user) .addPassword(password)
RemoteRestRuntimeEngineFactory restRuntimeFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addProcessInstanceId(23l) .addUserName("S") .addDeploymentId("deployment") .addPassword("poffertje") .addUrl(new URL("http://localhost:8080/kie-wb")) .addDeploymentId("deployment") .addUserName("A") .addUrl(new URL("http://localhost:8080/kie-wb")) .addDeploymentId("deployment") .addUserName("E") .addPassword("suiker")
@Test public void setHeaderFields() throws Exception { RuntimeEngine runtimeEngine = RemoteRuntimeEngineFactory.newRestBuilder() .addUserName("user") .addPassword("pass") .addUrl(new URL("http://localhost:8080/business-central")) .addHeader("HEADER-NAME", "header-value") .clearHeaderFields() .addCorrelationProperties() .addDeploymentId("dep-id") .build(); try { runtimeEngine.getTaskService().claim(23l, "user"); fail( "This should have failed because there's no server running... "); } catch( org.kie.remote.client.api.exception.RemoteCommunicationException rce ) { // expected } } }
public void multipleDifferentRuntimeExamples(String deploymentId, URL deploymentUrl, boolean useFormBasedAuth) throws Exception { RemoteRestRuntimeEngineBuilder runtimeEngineBuilder = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId(deploymentId) .addUrl(deploymentUrl); RuntimeEngine krisRemoteEngine = runtimeEngineBuilder .addUserName(KRIS_USER) .addPassword(KRIS_PASSWORD) .build(); RuntimeEngine maryRemoteEngine = runtimeEngineBuilder .addUserName(MARY_USER) .addPassword(MARY_PASSWORD) .build(); RuntimeEngine johnRemoteEngine = runtimeEngineBuilder .addUserName(JOHN_USER) .addPassword(JOHN_PASSWORD) .build(); }
public void javaRemoteApiRestExample(String deploymentId, URL baseUrl, String user, String password) { .addDeploymentId(deploymentId) .addUrl(baseUrl) .addUserName(user)