public abstract class OpenTracingBaseTests
extends org.jboss.arquillian.testng.Arquillian
Modifier and Type | Field and Description |
---|---|
protected URL |
deploymentURL
Server app URL for the client tests.
|
static String |
JAXRS_COMPONENT |
Constructor and Description |
---|
OpenTracingBaseTests() |
Modifier and Type | Method and Description |
---|---|
protected void |
assertEqualErrorTrees(ConsumableTree<TestSpan> returnedTree,
ConsumableTree<TestSpan> expectedTree)
This wrapper method allows for potential post-processing, such as removing tags that we don't care to compare in
returnedTree . |
protected void |
assertEqualTrees(ConsumableTree<TestSpan> returnedTree,
ConsumableTree<TestSpan> expectedTree)
This wrapper method allows for potential post-processing, such as removing tags that we don't care to compare in
returnedTree . |
protected void |
beforeEachTest()
Before each test method, clear the tracer.
|
static org.jboss.shrinkwrap.api.spec.WebArchive |
createDeployment()
Deploy the apps to test.
|
protected void |
executeNested(String path,
int uniqueId,
int nestDepth,
int nestBreadth,
boolean failNest,
boolean async)
Execute the nested web service.
|
protected jakarta.ws.rs.core.Response |
executeRemoteWebServiceRaw(String service,
String relativePath,
Map<String,Object> queryParameters,
jakarta.ws.rs.core.Response.Status expectedStatus)
Execute a remote web service and return the content.
|
protected jakarta.ws.rs.core.Response |
executeRemoteWebServiceRaw(String service,
String relativePath,
jakarta.ws.rs.core.Response.Status expectedStatus)
Execute a remote web service and return the content.
|
protected TestSpanTree |
executeRemoteWebServiceTracerTree()
Execute a remote web service and return the span tree.
|
protected Method |
getEndpointMethod(Class<?> clazz,
String mapping)
Get REST endpoint java method based on the mapping value in
Path annotation. |
protected TestSpan |
getExpectedNestedServerSpan(String path,
String spanKind,
int uniqueId,
int nestDepth,
int nestBreadth,
boolean failNest,
boolean isFailed,
boolean async)
The expected nested span layout.
|
protected Map<String,Object> |
getExpectedSpanTags(String spanKind,
String httpMethod,
String service,
String relativePath,
Map<String,Object> queryParameters,
int httpStatus,
String component)
Create a tags collection for expected span tags.
|
protected Map<String,Object> |
getExpectedSpanTagsForError(String service,
String spanKind)
Create a tags collection for expected span tags with an error.
|
protected Map<String,Object> |
getNestedQueryParameters(int uniqueId,
int nestDepth,
int nestBreadth,
boolean failNest,
boolean async) |
protected String |
getOperationName(String spanKind,
String httpMethod,
Class<?> clazz,
Method method)
Get operation name depending on the
spanKind . |
protected int |
getRandomNumber()
Get a random integer.
|
protected String |
getWebServiceURL(String service,
String relativePath)
Create web service URL.
|
protected String |
getWebServiceURL(String service,
String relativePath,
Map<String,Object> queryParameters)
Create web service URL.
|
protected void |
testMultithreadedNestedSpans(String path,
int numberOfCalls,
int nestDepth,
int nestBreadth,
boolean failNest,
boolean async) |
protected void |
testNestedSpans(String path,
int nestDepth,
int nestBreadth,
int uniqueId,
boolean failNest,
boolean async)
Do the actual testing and assertion of a nested call.
|
public static final String JAXRS_COMPONENT
@ArquillianResource protected URL deploymentURL
public static org.jboss.shrinkwrap.api.spec.WebArchive createDeployment()
@BeforeMethod protected void beforeEachTest()
protected String getWebServiceURL(String service, String relativePath)
service
- Web service pathrelativePath
- Web service endpointprotected String getWebServiceURL(String service, String relativePath, Map<String,Object> queryParameters)
service
- Web service pathrelativePath
- Web service endpointqueryParameters
- Query parameters.protected jakarta.ws.rs.core.Response executeRemoteWebServiceRaw(String service, String relativePath, jakarta.ws.rs.core.Response.Status expectedStatus)
service
- Web service pathrelativePath
- Web service endpointexpectedStatus
- Expected HTTP status.protected jakarta.ws.rs.core.Response executeRemoteWebServiceRaw(String service, String relativePath, Map<String,Object> queryParameters, jakarta.ws.rs.core.Response.Status expectedStatus)
service
- Web service pathrelativePath
- Web service endpointqueryParameters
- Query parameters.expectedStatus
- Expected HTTP status.protected TestSpanTree executeRemoteWebServiceTracerTree()
protected void assertEqualTrees(ConsumableTree<TestSpan> returnedTree, ConsumableTree<TestSpan> expectedTree)
returnedTree
. This method removes error related keys.returnedTree
- The returned tree from the web service.expectedTree
- The simulated tree that we expect.protected void assertEqualErrorTrees(ConsumableTree<TestSpan> returnedTree, ConsumableTree<TestSpan> expectedTree)
returnedTree
. This method keeps the error related keys.returnedTree
- The returned tree from the web service.expectedTree
- The simulated tree that we expect.protected int getRandomNumber()
protected Method getEndpointMethod(Class<?> clazz, String mapping)
Path
annotation.clazz
- class of the endpoint.mapping
- endpoint mapping.protected String getOperationName(String spanKind, String httpMethod, Class<?> clazz, Method method)
spanKind
.spanKind
- The type of span.httpMethod
- HTTP methodclazz
- resource classmethod
- method of the REST endpointprotected Map<String,Object> getExpectedSpanTags(String spanKind, String httpMethod, String service, String relativePath, Map<String,Object> queryParameters, int httpStatus, String component)
spanKind
- Value for Tags.SPAN_KIND
httpMethod
- Value for Tags.HTTP_METHOD
service
- First parameter to getWebServiceURL(String, String)
relativePath
- Second parameter to getWebServiceURL(String, String)
queryParameters
- Query parameters.httpStatus
- Value for Tags.HTTP_STATUS
protected Map<String,Object> getExpectedSpanTagsForError(String service, String spanKind)
service
- REST service.spanKind
- Value for Tags.SPAN_KIND
protected void testNestedSpans(String path, int nestDepth, int nestBreadth, int uniqueId, boolean failNest, boolean async)
uniqueId
- Some unique ID.nestDepth
- How deep to nest the calls.nestBreadth
- Breadth of first level of nested calls.failNest
- Whether to fail the nested call.async
- Whether to execute nested requests asynchronously.protected void testMultithreadedNestedSpans(String path, int numberOfCalls, int nestDepth, int nestBreadth, boolean failNest, boolean async) throws InterruptedException, ExecutionException
numberOfCalls
- Number of total web requests.nestDepth
- How deep to nest the calls.nestBreadth
- Breadth of first level of nested calls.failNest
- Whether to fail the nested call.async
- Whether to execute nested requests asynchronously.InterruptedException
- Problem executing web service.ExecutionException
- Thread pool problem.protected void executeNested(String path, int uniqueId, int nestDepth, int nestBreadth, boolean failNest, boolean async)
uniqueId
- Some unique ID.nestDepth
- How deep to nest the calls.nestBreadth
- Breadth of first level of nested calls.failNest
- Whether to fail the nested call.async
- Whether to execute nested requests asynchronously.protected Map<String,Object> getNestedQueryParameters(int uniqueId, int nestDepth, int nestBreadth, boolean failNest, boolean async)
uniqueId
- Some unique ID.nestDepth
- How deep to nest the calls.nestBreadth
- Breadth of first level of nested calls.failNest
- Whether to fail the nested call.async
- Whether to execute nested requests asynchronously.protected TestSpan getExpectedNestedServerSpan(String path, String spanKind, int uniqueId, int nestDepth, int nestBreadth, boolean failNest, boolean isFailed, boolean async)
spanKind
- Span kinduniqueId
- The unique ID of the request.nestDepth
- Nest depthnestBreadth
- Nest breadthfailNest
- Whether to fail the nested call.isFailed
- Whether this request is expected to fail.async
- Whether to execute asynchronously.Copyright © 2017 – 2021 Eclipse Foundation. All rights reserved.
Use is subject to license terms.