public void minimumRestBuilderExample() throws Exception { RemoteRestRuntimeEngineFactory factory = RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("user") .addPassword("pass") .addUrl(new URL("http://localhost:8080/business-central")) .build(); RuntimeEngine runtimeEngine = factory.newRuntimeEngine(); runtimeEngine.getTaskService().claim(23l, "user"); // This will throw a MissingRequiredInfoException because the deployment id is required here runtimeEngine.getKieSession().startProcess("org.test.process"); } }
@Test public void restRuntimeFactoryBuilderTest() throws MalformedURLException, InsufficientInfoToBuildException { org.kie.remote.client.api.RemoteRestRuntimeEngineFactory restRuntimeFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addProcessInstanceId(23l) RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addPassword("poffertje") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("A") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("E") RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("joke") .addPassword("stroop")
public static void main(String[] args) { if (args.length == 1 && ("-h".equals(args[0]) || "--help".equals(args[0]))) { System.out.println("In order to invoke this class, you should:"); System.out.println(" - Install the kie-wb-edition WAR file inside a JBoss7 (at standalone/deployments/kie-wb.war)"); System.out.println(" - Start the JBoss7 server with bin/standalone.sh --server-config=standalone-full.xml"); System.out.println(" - Deploy the HR project in the jbpm-playground default repository"); System.out.println(" - Then run this test"); System.exit(-1); } try { System.out.println("Creating REST Runtime Factory..."); RuntimeEngine engine = RemoteRestRuntimeEngineFactoryBuilderImpl.newBuilder(). addUrl(new URL("http://localhost:8080/kie-wb")). addDeploymentId("org.jbpm:HR:1.0"). addUserName("mariano").addPassword("mypass"). build().newRuntimeEngine(); engine.getKieSession().signalEvent("my-signal", null); } catch (Exception e) { System.out.println("An error has occurred: " + e.getMessage()); e.printStackTrace(System.out); } } }
@Test public void restRuntimeFactoryBuilderTest() throws MalformedURLException, InsufficientInfoToBuildException { RemoteRestRuntimeEngineFactory restRuntimeFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addProcessInstanceId(23l) RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addPassword("poffertje") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("A") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("E") RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("joke") .addPassword("stroop")
@Test public void notAceptedMethodTest() throws Exception { URL deploymentUrl = new URL( "http://localhost:8080/kie-wb/" ); RemoteRestRuntimeEngineFactory restSessionFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUrl(deploymentUrl) .addUserName("mary") .addPassword("pass") .build(); WorkItemHandler wih = new DoNothingWorkItemHandler(); try { restSessionFactory.newRuntimeEngine().getKieSession().getWorkItemManager().registerWorkItemHandler("test", wih); fail( "The above call should have failed."); } catch( UnsupportedOperationException uoe ) { assertEquals("The .registerWorkItemHandler(..) method is not supported on the remote api.", uoe.getMessage()); } }
@Test public void restRuntimeFactoryBuilderTest() throws MalformedURLException, InsufficientInfoToBuildException { RemoteRestRuntimeEngineFactory restRuntimeFactory = RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addProcessInstanceId(23l) RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addPassword("poffertje") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("A") RemoteRestRuntimeEngineFactory.newBuilder() .addDeploymentId("deployment") .addUserName("E") RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("joke") .addPassword("stroop")
@Test public void missingDeploymentIdTest() throws Exception { RemoteRestRuntimeEngineFactory factory = RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("user") .addPassword("pass") .buildFactory(); RemoteRuntimeEngine runtimeEngine = factory.newRuntimeEngine(); try { runtimeEngine.getTaskService().claim(23l, "user");
@Test public void missingDeploymentIdTest() throws Exception { RuntimeEngine runtimeEngine = RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("user") .addPassword("pass")
@Test public void missingDeploymentIdTest() throws Exception { RemoteRuntimeEngineFactory factory = RemoteRestRuntimeEngineFactory.newBuilder() .addUserName("user") .addPassword("pass")