private String format(final IExecutionNode node) { // TODO - no way of knowing of this is an impl or not..? return Strings.repeat(this.indentString, node.getDepth()) + node.getDescription() + " from " + node.getFilename(); }
@Override public String toDebugString() { List<String> debugLines = Lists.newArrayList(super.toDebugString()); if (children != null) { for (CHILD_TYPE child : children) { if (child != null) { debugLines.add(child.toDebugString()); } } } return Joiner.on("\n").join(debugLines); }
/** * @param node */ private void addToCallHierarchy(final IExecutionNode node) { final ExecutionNodeUsage usage = new ExecutionNodeUsage(node); log.trace("building usage for desc: " + node.getDescription() + " line: " + node.getLine()); List<ExecutionNodeUsage> immediateParents = callerHierarchy.get(usage); if (immediateParents == null) { log.trace("no uses already for node..."); immediateParents = new ArrayList<ExecutionNodeUsage>(); callerHierarchy.put(usage, immediateParents); } log.trace("adding used by descr: " + node.getParent().getDescription() + " line: " + node.getParent().getLine()); immediateParents.add(new ExecutionNodeUsage(node.getParent())); }
private void addDetailsForChildren(JsonObject json, List<? extends IExecutionNode> childNodes) { JsonArray children = new JsonArray(); json.add("children", children); for (IExecutionNode childNode : childNodes) { JsonObject childObject = new JsonObject(); childObject.addProperty("result", childNode.getResult().getResult().toString()); childObject.addProperty("description", StringEscapeUtils.escapeHtml4(childNode.getDescription())); children.add(childObject); } }
private static String getBuildInfoString(final String msg, final List<List<IExecutionNode>> failures) { final StringBuilder buf = new StringBuilder(); if (failures != null && !failures.isEmpty()) { buf.append("\n"); buf.append(msg); for (List<IExecutionNode> failurePath : failures) { buf.append("\n\n"); IExecutionNode lastNode = failurePath.get(failurePath.size() - 1); ThrowableInfo throwableInfo = lastNode.getResult().getFailure().getThrowableInfo(); if (throwableInfo != null && throwableInfo.getMessage() != null) { buf.append(throwableInfo.getMessage() + "\n"); } buf.append("Trace:\n\n"); for (IExecutionNode node : failurePath) { buf.append(node.getId() + ":"); buf.append(Strings.repeat(" ", node.getDepth())); buf.append(node.getDescription() + "\n"); } } } return buf.toString(); }
public JsonObject createBasicDetails(String nodeType, IExecutionNode node) { JsonObject thisNode = new JsonObject(); thisNode.addProperty("nodetype", nodeType); thisNode.addProperty("filename", node.getFilename()); thisNode.addProperty("result", node.getResult().getResult().toString()); thisNode.addProperty("id", node.getId()); thisNode.addProperty("emessage", getExceptionMessage(node)); thisNode.addProperty("stacktrace", getStackTrace(node)); thisNode.addProperty("runningDurationMillis", node.getResult().getRunningDuration()); thisNode.addProperty("runningDurationString", convert(node.getResult().getRunningDuration())); String description = node.getDescription() == null ? null : node.getDescription().trim(); String descriptionEscaped = replaceNewLines(StringEscapeUtils.escapeHtml4(description)); thisNode.addProperty("description", descriptionEscaped); return thisNode; }
log.debug("rootNode.toDebugString():\n" + rootNode.toDebugString()); thisDescription = descriptionMap.get(Long.valueOf(rootNode.getId())); notifier = new JunitNotifier();
private void doNotification(final IExecutionNode node) { final Notification n = new Notification("ExNode", SubstepsServerMBean.SUBSTEPS_JMX_MBEAN_NAME, this.notificationSequenceNumber); this.notificationSequenceNumber++; n.setUserData(getBytes(node.getResult())); this.log.trace("sending notification for node id: " + node.getId() + " sequence: " + this.notificationSequenceNumber); sendNotification(n); }
private String getStackTrace(IExecutionNode node) { String stackTrace = ""; if (node.getResult().getThrown() != null) { final StackTraceElement[] stackTraceElements = node.getResult().getThrown().getStackTrace(); final StringBuilder buf = new StringBuilder(); for (final StackTraceElement e : stackTraceElements) { buf.append(StringEscapeUtils.escapeHtml4(e.toString().trim())).append("<br/>"); } stackTrace = buf.toString(); } return stackTrace; }
private void processChildrenForCallHierarchy(final List children) { for (final Object obj : children) { final IExecutionNode node = (IExecutionNode) obj; addToCallHierarchy(node); log.trace("looking at node description: " + node.getDescription() + " line: " + node.getLine()); if (NodeWithChildren.class.isAssignableFrom(node.getClass())) { final NodeWithChildren nodeWithChildren = (NodeWithChildren) node; log.trace("proccessing children..."); processChildrenForCallHierarchy(nodeWithChildren.getChildren()); } } }
private boolean beforeExecute(final NODE_TYPE node, final RootNodeExecutionContext context) { boolean shouldContinue = true; // node.getResult().setStarted(); if (node.hasError()) { context.getNotificationDistributor().onNodeFailed(node, node.getResult().getThrown()); context.addFailure(new SubstepExecutionFailure(node.getResult().getThrown(), node)); shouldContinue = false; } else { node.getResult().setStarted(); context.getNotificationDistributor().onNodeStarted(node); shouldContinue = runSetup(node, context); } if (!shouldContinue) { log.debug("shouldContinue = false for {}", node); } return shouldContinue; }
public String getIndexStringForNode(final IExecutionNode node) { // is this the first time at this depth? if (node.getDepth() > indexlist.size()) { // add a new Int indexlist.add(new MutableInteger()); } if (node.getDepth() < indexlist.size()) { final List<MutableInteger> delete = new ArrayList<MutableInteger>(); for (int i = node.getDepth(); i < indexlist.size(); i++) { delete.add(indexlist.get(i)); } indexlist.removeAll(delete); } final MutableInteger last = indexlist.get(node.getDepth() - 1); // increment the last one at this depth last.increment(); final StringBuilder buf = new StringBuilder(); boolean first = true; for (int i = 0; i < node.getDepth(); i++) { if (!first) { buf.append("-"); } buf.append(indexlist.get(i).count); first = false; } return buf.toString(); }
public String getDescription() { return theNode.getDescription(); }
public boolean isApplicable(final IExecutionNode node) { return node.dispatch(this); }
log.debug("rootNode.toDebugString():\n" + rootNode.toDebugString()); thisDescription = descriptionMap.get(Long.valueOf(rootNode.getId())); notifier = new JunitNotifier();
private void doNotification(final IExecutionNode node) { final Notification n = new Notification("ExNode", SubstepsServerMBean.SUBSTEPS_JMX_MBEAN_NAME, this.notificationSequenceNumber); this.notificationSequenceNumber++; n.setUserData(getBytes(node.getResult())); log.trace("sending notification for node id: " + node.getId() + " sequence: " + this.notificationSequenceNumber); sendNotification(n); }
/** * @param node */ private void addToCallHierarchy(final IExecutionNode node) { final ExecutionNodeUsage usage = new ExecutionNodeUsage(node); log.trace("building usage for desc: " + node.getDescription() + " line: " + node.getLine()); List<ExecutionNodeUsage> immediateParents = callerHierarchy.get(usage); if (immediateParents == null){ log.trace("no uses already for node..."); immediateParents = new ArrayList<ExecutionNodeUsage>(); callerHierarchy.put(usage, immediateParents); } else { log.trace("got existing usages of node: "); for (final ExecutionNodeUsage u : immediateParents){ log.trace("already found: " + u.toString()); } } log.trace("adding used by descr: " + node.getParent().getDescription() + " line: " + node.getParent().getLine()); immediateParents.add(new ExecutionNodeUsage(node.getParent())); }
/** * @param cause the cause of the failure * @param node the node that failed execution * @param result the execution result */ public SubstepExecutionFailure(final Throwable cause, final IExecutionNode node, final ExecutionResult result) { this(cause, node); node.getResult().setResult(result); }