org.jboss.arquillian.container.test.api.OperateOnDeployment Java Examples

The following examples show how to use org.jboss.arquillian.container.test.api.OperateOnDeployment. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedeployProcessClassloadingTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testRedeployClassloading() {
  // given
  org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeploymentQuery().singleResult();

  org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService
    .createDeployment()
    .nameFromDeployment(deployment.getId())
    .addDeploymentResources(deployment.getId())
    .deploy();

  // when
  String id = runtimeService.startProcessInstanceByKey("process").getId();

  // then
  Assert.assertTrue((Boolean) runtimeService.getVariable(id, "executed"));

  repositoryService.deleteDeployment(deployment2.getId(), true);
}
 
Example #2
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	LDP.class,
	HappyPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testNotAcceptable(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);
	HttpGet newRequest = HELPER.newRequest(MyApplication.ROOT_PERSON_RESOURCE_PATH,HttpGet.class);
	newRequest.setHeader("Accept","application/xml");
	newRequest.setHeader("Accept-Charset",Charsets.ISO_8859_1.displayName());
	Metadata response = HELPER.httpRequest(newRequest);
	assertThat(response.status,equalTo(Status.NOT_ACCEPTABLE.getStatusCode()));
	assertThat(response.contentType,startsWith("text/plain"));
	/**
	 * TODO: We should check that the vary, accepted-charsets, and accepted headers match.
	 */
	LOGGER.info("Completed {}",testName.getMethodName());
}
 
Example #3
Source File: PaLocalScriptEngineCallActivityConditionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void shouldEvaluateCondition() {
  // given
  runtimeService.startProcessInstanceByKey("callingProcessScriptConditionalFlow").getId();

  Task calledProcessTask = taskService.createTaskQuery().singleResult();

  // when the called process instance returns
  taskService.complete(calledProcessTask.getId());

  // then the conditional flow leaving the call activity has been taken
  Task afterCallActivityTask = taskService.createTaskQuery().singleResult();
  Assert.assertNotNull(afterCallActivityTask);
  Assert.assertEquals("afterCallActivityTask", afterCallActivityTask.getTaskDefinitionKey());
}
 
Example #4
Source File: CdiBeanResolutionTwoEnginesTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("engine1")
public void testResolveBean() throws Exception {
  //given
  final ProcessEngine processEngine1 = processEngineService.getProcessEngine("engine1");
  Assert.assertEquals("engine1", processEngine1.getName());
  createAuthorizations(processEngine1);

  //when we operate the process under authenticated user
  processEngine1.getIdentityService().setAuthentication("user1", Arrays.asList("group1"));

  processEngine1.getRuntimeService().startProcessInstanceByKey("testProcess");
  final List<Task> tasks = processEngine1.getTaskService().createTaskQuery().list();
  Assert.assertEquals(1, tasks.size());
  processEngine1.getTaskService().complete(tasks.get(0).getId());

  //then
  //identityService resolution respects the engine, on which the process is being executed
  final List<VariableInstance> variableInstances = processEngine1.getRuntimeService().createVariableInstanceQuery().variableName("changeInitiatorUsername")
    .list();
  Assert.assertEquals(1, variableInstances.size());
  Assert.assertEquals("user1", variableInstances.get(0).getValue());
}
 
Example #5
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testMixedQueriesNotAllowed(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpGet get = HELPER.newRequest(MyApplication.ROOT_PERSON_CONTAINER_PATH+"?ldp:constrainedBy=12312312321&param1=value1&param2=value2&param2=value3&param3",HttpGet.class);
	Metadata getResponse=HELPER.httpRequest(get);
	assertThat(getResponse.status,equalTo(HttpStatus.SC_BAD_REQUEST));
	assertThat(getResponse.body,equalTo("Mixed queries not allowed (ldp:constrainedBy=12312312321&param1=value1&param2=value2&param2=value3&param3=)"));
	assertThat(getResponse.contentType,startsWith("text/plain"));
	assertThat(getResponse.language,equalTo(Locale.ENGLISH));
}
 
Example #6
Source File: CallActivityContextSwitchTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("mainDeployment")
public void testNoWaitState() {

  // this test makes sure the delegate invoked by the called process can be resolved (context switch necessary).

  // we cannot load the class
  try {
    new CalledProcessDelegate();
    Assert.fail("exception expected");
  }catch (NoClassDefFoundError e) {
    // expected
  }

  // our bean manager does not know this bean
  Set<Bean< ? >> beans = beanManager.getBeans("calledProcessDelegate");
  Assert.assertEquals(0, beans.size());

  // but when we execute the process, we perform the context switch to the corresponding deployment
  // and there the class can be resolved and the bean is known.
  Map<String, Object> processVariables = new HashMap<String, Object>();
  processVariables.put("calledElement", "calledProcessSyncNoWait");
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("mainProcessSyncNoWait", processVariables);

  Assert.assertNull(runtimeService.createProcessInstanceQuery().processDefinitionId(pi.getId()).singleResult());
}
 
Example #7
Source File: PublicKeyAsJWKLocationURLTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@RunAsClient
@OperateOnDeployment("testApp")
@Test(groups = TEST_GROUP_CONFIG, dependsOnMethods = { "validateLocationUrlContents" },
    description = "Validate specifying the mp.jwt.verify.publickey.location as remote URL to a JWKS key")
public void testKeyAsLocationUrl() throws Exception {
    Reporter.log("testKeyAsLocationUrl, expect HTTP_OK");

    PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey4k.pem");
    String kid = "publicKey4k";
    HashMap<String, Long> timeClaims = new HashMap<>();
    String token = TokenUtils.generateTokenString(privateKey, kid, "/Token1.json", null, timeClaims);

    String uri = baseURL.toExternalForm() + "jwks/endp/verifyKeyLocationAsJWKSUrl";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
        .target(uri)
        .queryParam("kid", kid)
        ;
    Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer "+token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
Example #8
Source File: PublicKeyAsPEMLocationTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@RunAsClient()
@OperateOnDeployment("testApp")
@Test(groups = TEST_GROUP_CONFIG,
        description = "Validate the http://localhost:8080/pem/endp/publicKey4k PEM endpoint")
public void validateLocationUrlContents() throws Exception {
    URL locationURL = new URL(baseURL, "pem/endp/publicKey4k");
    Reporter.log("Begin validateLocationUrlContents");

    StringWriter content = new StringWriter();
    try(BufferedReader reader = new BufferedReader(new InputStreamReader(locationURL.openStream()))) {
        String line = reader.readLine();
        while(line != null) {
            content.write(line);
            content.write('\n');
            line = reader.readLine();
        }
    }
    Reporter.log("Received: "+content);
    String expected = TokenUtils.readResource("/publicKey4k.pem");
    Assert.assertEquals(content.toString(), expected);
}
 
Example #9
Source File: PublicKeyAsPEMLocationTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@RunAsClient
@OperateOnDeployment("testApp")
@Test(groups = TEST_GROUP_CONFIG, dependsOnMethods = { "validateLocationUrlContents" },
        description = "Validate specifying the mp.jwt.verify.publickey.location as remote URL to a PEM key")
public void testKeyAsLocationUrl() throws Exception {
    Reporter.log("testKeyAsLocationUrl, expect HTTP_OK");

    PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey4k.pem");
    String kid = "/privateKey4k.pem";
    HashMap<String, Long> timeClaims = new HashMap<>();
    String token = TokenUtils.generateTokenString(privateKey, kid, "/Token1.json", null, timeClaims);

    String uri = baseURL.toExternalForm() + "pem/endp/verifyKeyLocationAsPEMUrl";
    WebTarget echoEndpointTarget = ClientBuilder.newClient()
                                                .target(uri)
            ;
    Response response = echoEndpointTarget.request(APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
    Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
    String replyString = response.readEntity(String.class);
    JsonReader jsonReader = Json.createReader(new StringReader(replyString));
    JsonObject reply = jsonReader.readObject();
    Reporter.log(reply.toString());
    Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
 
Example #10
Source File: CdiDelegateBeanResolutionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testResolveBean() {
  try {
    // assert that we cannot resolve the bean here:
    ProgrammaticBeanLookup.lookup("exampleDelegateBean");
    Assert.fail("exception expected");
  }catch (Throwable e) {
    // expected
  }

  Assert.assertEquals(0, runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count());
  // but the process engine can:
  runtimeService.startProcessInstanceByKey("testResolveBean");

  Assert.assertEquals(0,runtimeService.createProcessInstanceQuery().processDefinitionKey("testResolveBean").count());
}
 
Example #11
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testConstraintReportNotFound(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpGet get = HELPER.newRequest(MyApplication.ROOT_PERSON_CONTAINER_PATH+"?ldp:constrainedBy=12312312321",HttpGet.class);
	Metadata getResponse=HELPER.httpRequest(get);
	assertThat(getResponse.status,equalTo(HttpStatus.SC_NOT_FOUND));
	assertThat(getResponse.body,equalTo("Unknown constraint report '12312312321'"));
	assertThat(getResponse.contentType,startsWith("text/plain"));
	assertThat(getResponse.language,equalTo(Locale.ENGLISH));
}
 
Example #12
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testPostPostconditionFailure(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpPost post = HELPER.newRequest(TestingApplication.ROOT_BAD_RESOURCE_PATH,HttpPost.class);
	post.setEntity(
		new StringEntity(
				TEST_SUITE_BODY,
			ContentType.create("text/turtle", "UTF-8"))
	);
	Metadata response=HELPER.httpRequest(post);
	assertThat(response.status,equalTo(HttpStatus.SC_INTERNAL_SERVER_ERROR));
	assertThat(response.body,notNullValue());
	assertThat(response.contentType,startsWith("text/plain"));
	assertThat(response.language,equalTo(Locale.ENGLISH));

}
 
Example #13
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testQueryPostConditionFailure(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpGet get = HELPER.newRequest(TestingApplication.ROOT_BAD_RESOURCE_PATH+"?exampleQuery=parameter",HttpGet.class);
	Metadata getResponse=HELPER.httpRequest(get);
	assertThat(getResponse.status,equalTo(HttpStatus.SC_INTERNAL_SERVER_ERROR));
	assertThat(getResponse.body,notNullValue());
	assertThat(getResponse.contentType,startsWith("text/plain"));
	assertThat(getResponse.language,equalTo(Locale.ENGLISH));

}
 
Example #14
Source File: SimpleTransformDomainTestCase.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("dep1")
@TargetsContainer("master:server-one")
public void shouldRunInContainer1() throws Exception {

    try (CamelContext camelctx = new DefaultCamelContext()) {

        camelctx.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start").transform(body().prepend("Hello "));
            }
        });

        camelctx.start();

        ProducerTemplate producer = camelctx.createProducerTemplate();
        String result = producer.requestBody("direct:start", "Kermit", String.class);
        Assert.assertEquals("Hello Kermit", result);
    }
}
 
Example #15
Source File: IndependentJobExecutionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@OperateOnDeployment("pa1")
@Test
public void testDeploymentUnawareJobAcquisition() {
  JobExecutor defaultJobExecutor = processEngineConfiguration.getJobExecutor();

  ProcessInstance instance1 = engine1.getRuntimeService().startProcessInstanceByKey("archive1Process");
  ProcessInstance instance2 = processEngine.getRuntimeService().startProcessInstanceByKey("archive2Process");

  Job job1 = managementService.createJobQuery().processInstanceId(instance1.getId()).singleResult();
  Job job2 = managementService.createJobQuery().processInstanceId(instance2.getId()).singleResult();

  // the deployment unaware configuration should return both jobs
  CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
  processEngineConfiguration.setJobExecutorDeploymentAware(false);
  try {
    AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd(defaultJobExecutor));

    Assert.assertEquals(2, acquiredJobs.size());
    Assert.assertTrue(acquiredJobs.contains(job1.getId()));
    Assert.assertTrue(acquiredJobs.contains(job2.getId()));
  } finally {
    processEngineConfiguration.setJobExecutorDeploymentAware(true);
  }
}
 
Example #16
Source File: OIDCAdapterClusterTest.java    From keycloak with Apache License 2.0 6 votes vote down vote up
@Test
public void testSuccessfulLoginAndProgrammaticLogout(@ArquillianResource
                                                    @OperateOnDeployment(value = SessionPortalDistributable.DEPLOYMENT_NAME) URL appUrl) {
    String proxiedUrl = getProxiedUrl(appUrl);
    driver.navigate().to(proxiedUrl);
    assertCurrentUrlStartsWith(loginPage);
    loginPage.form().login("[email protected]", "password");
    assertCurrentUrlEquals(proxiedUrl);
    assertSessionCounter(NODE_2_NAME, NODE_2_URI, NODE_1_URI, proxiedUrl, 2);
    assertSessionCounter(NODE_1_NAME, NODE_1_URI, NODE_2_URI, proxiedUrl, 3);
    assertSessionCounter(NODE_2_NAME, NODE_2_URI, NODE_1_URI, proxiedUrl, 4);

    String logoutUri = proxiedUrl + "/logout";
    driver.navigate().to(logoutUri);
    Retry.execute(() -> {
        driver.navigate().to(proxiedUrl);
        assertCurrentUrlStartsWith(loginPage);
    }, 10, 300);
}
 
Example #17
Source File: SpringRetryConfigurationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testResolveRetryConfigBean() {
  // given
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testRetry");

  JobQuery query = managementService
      .createJobQuery()
      .processInstanceId(processInstance.getId());

  Job job = query.singleResult();

  // when job fails
  try {
    managementService.executeJob(job.getId());
  } catch (Exception e) {
    // ignore
  }

  // then
  job = query.singleResult();
  Assert.assertEquals(6, job.getRetries());
}
 
Example #18
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowErrorInSignalParallelMultiInstance() {
  String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI").getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").list().get(3);
  assertNotNull(serviceTask);

  runtimeService.setVariables(pi, throwError());
  runtimeService.signal(serviceTask.getId());

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskError", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}
 
Example #19
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testGetPostconditionFailure(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpGet get = HELPER.newRequest(TestingApplication.ROOT_BAD_RESOURCE_PATH,HttpGet.class);
	Metadata getResponse=HELPER.httpRequest(get);
	assertThat(getResponse.status,equalTo(HttpStatus.SC_INTERNAL_SERVER_ERROR));
	assertThat(getResponse.body,notNullValue());
	assertThat(getResponse.contentType,startsWith("text/plain"));
	assertThat(getResponse.language,equalTo(Locale.ENGLISH));

}
 
Example #20
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowExceptionInDelegateExpressionSignal() {
  String pi = runtimeService.startProcessInstanceByKey("testProcess").getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();
  assertNotNull(serviceTask);

  runtimeService.setVariables(pi, throwException());
  runtimeService.signal(serviceTask.getId());

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskException", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}
 
Example #21
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 6 votes vote down vote up
@Test
@Category({
	ExceptionPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testQueryFailure$badValue(@ArquillianResource final URL url) throws Exception {
	LOGGER.info("Started {}",testName.getMethodName());
	HELPER.base(url);
	HELPER.setLegacy(false);

	HttpGet get = HELPER.newRequest(MyApplication.ROOT_QUERYABLE_RESOURCE_PATH+"?"+QueryableResourceHandler.FAILURE+"=unknown",HttpGet.class);
	Metadata getResponse=HELPER.httpRequest(get);
	assertThat(getResponse.status,equalTo(HttpStatus.SC_BAD_REQUEST));
	assertThat(getResponse.body,notNullValue());
	assertThat(getResponse.contentType,startsWith("text/plain"));
	assertThat(getResponse.language,equalTo(Locale.ENGLISH));
}
 
Example #22
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowErrorInExecuteParallelMultiInstance() {
  String pi = runtimeService.startProcessInstanceByKey("testProcessParallelMI", throwError()).getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskError", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}
 
Example #23
Source File: JobPrioritizationFailureTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("dummy-client")
public void testGracefulDegradationOnMissingBean() {
  // when
  processInstance = runtimeService.startProcessInstanceByKey("priorityProcess");

  // then the job was created successfully and has the default priority on bean evaluation failure
  Job job = managementService.createJobQuery().singleResult();
  Assert.assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE, job.getPriority());
}
 
Example #24
Source File: TestWarDeploymentIsDeployChangedOnly.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment(value=PA2)
public void testDeployProcessArchive() {
  Assert.assertNotNull(processEngine);
  RepositoryService repositoryService = processEngine.getRepositoryService();
  long count = repositoryService.createProcessDefinitionQuery()
    .processDefinitionKey("testDeployProcessArchive")
    .count();

  Assert.assertEquals(1, count);

  // validate registrations:
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
  boolean resumedRegistrationFound = false;
  for (String paName : processApplicationNames) {
    ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
    List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
    if(deploymentInfo.size() == 2) {
      if(resumedRegistrationFound) {
        Assert.fail("Cannot have two registrations");
      }
      resumedRegistrationFound = true;
    }
  }
  Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);

}
 
Example #25
Source File: ManagedDomainTestCase.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("dep1")
@TargetsContainer("master:server-one")
public void shouldRunInContainer1() throws Exception {
    // Get the logger path which should contain the name of the server
    final String logDir = System.getProperty("jboss.server.log.dir");
    Assert.assertNotNull("Could not determine the jboss.server.log.dir property", logDir);
    Assert.assertTrue("Log dir should contain server-one: " + logDir, logDir.contains("server-one"));
}
 
Example #26
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowExceptionInExecuteSequentialMultiInstance() {
  String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI", throwException()).getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskException", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}
 
Example #27
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowErrorInDelegateExpressionSignalSequentialMultiInstance() {
  String pi = runtimeService.startProcessInstanceByKey("testProcessSequentialMI").getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  // signal 2 times to execute first sequential behaviors
  runtimeService.setVariables(pi, leaveExecution());
  runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId());
  runtimeService.setVariables(pi, leaveExecution());

  runtimeService.signal(runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult().getId());
  Execution serviceTask = runtimeService.createExecutionQuery().processInstanceId(pi).activityId("serviceTask").singleResult();
  assertNotNull(serviceTask);

  runtimeService.setVariables(pi, throwError());
  runtimeService.signal(serviceTask.getId());

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertTrue((Boolean) runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskError", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}
 
Example #28
Source File: SpinClassloadingTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("client-app")
public void testDeserialization() {

  String serializedValue = "<?xml version=\"1.0\" encoding=\"utf-8\"?><xmlserializable><property>value</property></xmlserializable>";

  runtimeService.startProcessInstanceByKey("testProcess",
    createVariables()
      .putValueTyped("xmlSerializable",
          serializedObjectValue(serializedValue)
            .serializationDataFormat(SerializationDataFormats.XML)
            .objectTypeName("org.camunda.bpm.integrationtest.functional.spin.XmlSerializable")
          .create()));

}
 
Example #29
Source File: ServerFrontendITest.java    From ldp4j with Apache License 2.0 5 votes vote down vote up
@Test
@Category({
	HappyPath.class
})
@OperateOnDeployment(DEPLOYMENT)
public void testQueryResponsesHaveSpecificLinkHeader(@ArquillianResource final URL url) throws Exception {
	String pName = testName.getMethodName();
	LOGGER.info("Started {}",pName);
	String resource = "ldp4j/api/"+MyApplication.ROOT_QUERYABLE_RESOURCE_PATH;
	String path = resource+"?method="+testName.getMethodName();
	String link =
		Deencapsulation.invoke(
			EndpointControllerUtils.class,
			"createQueryOfLink",
			url+resource,
			QueryBuilder.
				newInstance().
					withParameter("method", testName.getMethodName()).
					build());
	Response response =
		given().
			accept(TEXT_TURTLE).
			baseUri(url.toString()).
		expect().
			statusCode(OK).
			contentType(TEXT_TURTLE).
		when().
			get(path);
	assertThat(response.getHeader("Link"),containsString(link));
	LOGGER.info("Completed {}",pName);
}
 
Example #30
Source File: CatchErrorFromProcessApplicationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment("clientDeployment")
public void testThrowExceptionInExecute() {
  String pi = runtimeService.startProcessInstanceByKey("testProcess", throwException()).getId();

  assertTrue((Boolean) runtimeService.getVariable(pi, "executed"));
  assertNull(runtimeService.getVariable(pi, "signaled"));

  Task userTask = taskService.createTaskQuery().processInstanceId(pi).singleResult();
  assertNotNull(userTask);
  assertEquals("userTaskException", userTask.getTaskDefinitionKey());

  taskService.complete(userTask.getId());
}