Top Description Fields Constructors Methods
org.opentest4j.reporting.tooling.core.converter

public Class DefaultConverter

extends Object
implements Converter
Class Inheritance
All Implemented Interfaces
org.opentest4j.reporting.tooling.core.converter.Converter
Annotations
@API
status:EXPERIMENTAL
since:0.1.0
Imports
org.apiguardian.api.API, org.opentest4j.reporting.events.core.Infrastructure, org.opentest4j.reporting.events.root.Event, .Finished, .Reported, .Started, org.opentest4j.reporting.schema.Namespace, .QualifiedName, org.w3c.dom.Document, .Element, .Node, .NodeList, javax.xml.parsers.DocumentBuilderFactory, javax.xml.transform.OutputKeys, .Transformer, .TransformerFactory, javax.xml.transform.dom.DOMSource, javax.xml.transform.stream.StreamResult, java.nio.file.Path, java.time.Duration, .Instant, java.util.HashMap, .Map, .Optional, .Set, java.util.function.BiPredicate, java.util.stream.Stream

Default implementation of Converter.
Since
0.1.0

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final Set<String>
private static final String
private final DocumentBuilderFactory
private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public
DefaultConverter()

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
convert(Path
the source file
eventsXmlFile
,
Path
the target file
hierarchicalXmlFile
)

Implements org.opentest4j.reporting.tooling.core.converter.Converter.convert.

Convert the supplied event-based report into the hierarchical format.

public Document

Returns:

the converted document
convert
(Node
the root of the source document
sourceRoot
)

Convert the supplied event-based report into the hierarchical format.

private void
copyAttributes(Node sourceNode, Node targetNode, BiPredicate<String, String> filter)

private void
copyChildren(Node sourceElement, Node targetElement)

private void
createRootElement(Node sourceRoot, Document targetDocument, Namespace targetNamespace)

private static Namespace
private Optional<Node>
findNode(NodeList nodes, String name)

private void
finished(Map<String, Element> nodeById, Element sourceElement)

private void
infrastructure(Document targetDocument, Element sourceElement)

private void
mergeChildren(Node sourceElement, Node targetElement)

private void
moveChildrenToEnd(Element targetElement)

private void
reported(Map<String, Element> nodeById, Element sourceElement)

private void
started(Document targetDocument, Map<String, Element> nodeById, Element sourceElement, Namespace targetNamespace)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHILD_NODE_NAMEback to summary
private static final String CHILD_NODE_NAME
DURATION_ATTRIBUTE_NAMEback to summary
private static final String DURATION_ATTRIBUTE_NAME
EVENT_ONLY_ATTRIBUTESback to summary
private static final Set<String> EVENT_ONLY_ATTRIBUTES
EXECUTION_NODE_NAMEback to summary
private static final String EXECUTION_NODE_NAME
factoryback to summary
private final DocumentBuilderFactory factory
HIERARCHY_PREFIXback to summary
private static final String HIERARCHY_PREFIX
ROOT_NODE_NAMEback to summary
private static final String ROOT_NODE_NAME
START_ATTRIBUTE_NAMEback to summary
private static final String START_ATTRIBUTE_NAME

Constructor Detail

DefaultConverterback to summary
public DefaultConverter()

Create a new instance.

Method Detail

convertback to summary
public void convert(Path eventsXmlFile, Path hierarchicalXmlFile) throws Exception

Implements org.opentest4j.reporting.tooling.core.converter.Converter.convert.

Doc from org.opentest4j.reporting.tooling.core.converter.Converter.convert.

Convert the supplied event-based report into the hierarchical format.

Parameters
eventsXmlFile:Path

the source file

hierarchicalXmlFile:Path

the target file

Annotations
@Override
Exceptions
Exception:
if an error occurs converting or writing to the target file
convertback to summary
public Document convert(Node sourceRoot) throws Exception

Convert the supplied event-based report into the hierarchical format.

Parameters
sourceRoot:Node

the root of the source document

Returns:Document

the converted document

Exceptions
Exception:
if an error occurs during the conversion
copyAttributesback to summary
private void copyAttributes(Node sourceNode, Node targetNode, BiPredicate<String, String> filter)
copyChildrenback to summary
private void copyChildren(Node sourceElement, Node targetElement)
createRootElementback to summary
private void createRootElement(Node sourceRoot, Document targetDocument, Namespace targetNamespace)
determineTargetNamespaceback to summary
private static Namespace determineTargetNamespace(Node sourceRoot)
findNodeback to summary
private Optional<Node> findNode(NodeList nodes, String name)
finishedback to summary
private void finished(Map<String, Element> nodeById, Element sourceElement)
infrastructureback to summary
private void infrastructure(Document targetDocument, Element sourceElement)
mergeChildrenback to summary
private void mergeChildren(Node sourceElement, Node targetElement)
moveChildrenToEndback to summary
private void moveChildrenToEnd(Element targetElement)
reportedback to summary
private void reported(Map<String, Element> nodeById, Element sourceElement)
startedback to summary
private void started(Document targetDocument, Map<String, Element> nodeById, Element sourceElement, Namespace targetNamespace)