Package org.eclipse.microprofile.lra.tck.participant.api

# Class LraCancelOnResource

java.lang.Object
org.eclipse.microprofile.lra.tck.participant.api.LraCancelOnResource

@ApplicationScoped @Path("lraresource-cancelon") public class LraCancelOnResource extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CANCEL_FROM_REMOTE_CALL`
`static final String`
`CANCEL_ON_301`
`static final String`
`CANCEL_ON_FAMILY_3XX`
`static final String`
`CANCEL_ON_FAMILY_DEFAULT_4XX`
`static final String`
`CANCEL_ON_FAMILY_DEFAULT_5XX`
`static final String`
`LRA_CANCEL_ON_RESOURCE_PATH`
`static final String`
`NOT_CANCEL_ON_FAMILY_5XX`

## Constructor Summary

Constructors
Constructor
Description
`LraCancelOnResource()`

## Method Summary

Modifier and Type
Method
Description
`jakarta.ws.rs.core.Response`
`cancelFromRemoteCall(URI lraId, jakarta.ws.rs.core.UriInfo uriInfo)`
Returning `200` thus the LRA should be closed but beforehand it makes a remote REST call which returns 5xx which is the default for the cancelling and so the whole LRA should be cancelled.
`jakarta.ws.rs.core.Response`
`cancelOn301(URI lraId)`
Cancel on is set to `301`.
`jakarta.ws.rs.core.Response`
`cancelOnFamily3xx(URI lraId)`
Cancel on family is set to `3xx`.
`jakarta.ws.rs.core.Response`
`cancelOnFamilyDefault4xx(URI lraId)`
Default return status for cancelling LRA is `4xx` and `5xx`
`jakarta.ws.rs.core.Response`
`cancelOnFamilyDefault5xx(URI lraId)`
Default return status for cancelling LRA is `4xx` and `5xx`
`jakarta.ws.rs.core.Response`
`compensateWork(URI lraId)`
`jakarta.ws.rs.core.Response`
`completeWork(URI lraId)`
`jakarta.ws.rs.core.Response`
`notCancelOnFamily5xx(URI lraId)`
Cancel on family is set to `4xx`, the code from other families (e.g.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### LRA_CANCEL_ON_RESOURCE_PATH

public static final String LRA_CANCEL_ON_RESOURCE_PATH

See Also:
  - Constant Field Values

### CANCEL_ON_FAMILY_DEFAULT_4XX

public static final String CANCEL_ON_FAMILY_DEFAULT_4XX

See Also:
  - Constant Field Values

### CANCEL_ON_FAMILY_DEFAULT_5XX

public static final String CANCEL_ON_FAMILY_DEFAULT_5XX

See Also:
  - Constant Field Values

### CANCEL_ON_FAMILY_3XX

public static final String CANCEL_ON_FAMILY_3XX

See Also:
  - Constant Field Values

### CANCEL_ON_301

public static final String CANCEL_ON_301

See Also:
  - Constant Field Values

### NOT_CANCEL_ON_FAMILY_5XX

public static final String NOT_CANCEL_ON_FAMILY_5XX

See Also:
  - Constant Field Values

### CANCEL_FROM_REMOTE_CALL

public static final String CANCEL_FROM_REMOTE_CALL

See Also:
  - Constant Field Values

## Constructor Details

### LraCancelOnResource

public LraCancelOnResource()

## Method Details

### cancelOnFamilyDefault4xx

@GET @Path("cancelOnFamilyDefault4xx") public jakarta.ws.rs.core.Response cancelOnFamilyDefault4xx(@HeaderParam("Long-Running-Action") URI lraId)
Default return status for cancelling LRA is `4xx` and `5xx`

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

### cancelOnFamilyDefault5xx

@GET @Path("cancelOnFamilyDefault5xx") public jakarta.ws.rs.core.Response cancelOnFamilyDefault5xx(@HeaderParam("Long-Running-Action") URI lraId)
Default return status for cancelling LRA is `4xx` and `5xx`

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

### cancelOnFamily3xx

@GET @Path("cancelOnFamily3xx") public jakarta.ws.rs.core.Response cancelOnFamily3xx(@HeaderParam("Long-Running-Action") URI lraId)
Cancel on family is set to `3xx`. The `3xx` return code has to cancel the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

### cancelOn301

@GET @Path("cancelOn301") public jakarta.ws.rs.core.Response cancelOn301(@HeaderParam("Long-Running-Action") URI lraId)
Cancel on is set to `301`. The `301` return code has to cancel the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

### notCancelOnFamily5xx

@GET @Path("notCancelOnFamily5xx") public jakarta.ws.rs.core.Response notCancelOnFamily5xx(@HeaderParam("Long-Running-Action") URI lraId)
Cancel on family is set to `4xx`, the code from other families (e.g. for `5xx` should not cancel but should go with close the LRA.

Parameters:
  `lraId` - The LRA id generated for this action
Returns:
  JAX-RS response

### cancelFromRemoteCall

@GET @Path("cancelFromRemoteCall") public jakarta.ws.rs.core.Response cancelFromRemoteCall(@HeaderParam("Long-Running-Action") URI lraId, @Context jakarta.ws.rs.core.UriInfo uriInfo)

Returning `200` thus the LRA should be closed but beforehand it makes a remote REST call which returns 5xx which is the default for the cancelling and so the whole LRA should be cancelled.

The remote REST call invokes the same resource class `LraCancelOnResource` That assumes the call to the representative of the same LRA participant as it's already enlisted by the method `cancelFromRemoteCall(java.net.URI, jakarta.ws.rs.core.UriInfo)` invoked by the test. Because the specification mandates that the same participant can be enlisted only once per LRA instance then the `Compensate` method `compensateWork(URI)` will be called only once for the test invocation.

Parameters:
  `lraId` - The LRA id generated for this action
  `uriInfo` - as context provided by JAX-RS to find base service URI
Returns:
  JAX-RS response

### completeWork

@PUT @Path("/complete") public jakarta.ws.rs.core.Response completeWork(@HeaderParam("Long-Running-Action") URI lraId)

### compensateWork

@PUT @Path("/compensate") public jakarta.ws.rs.core.Response compensateWork(@HeaderParam("Long-Running-Action") URI lraId)