These aspects can be added individually for each unit test as required.
Change-Id: Ib8a6894239958593f88d91c4d8bcd91d3b7b845a
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/68947
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hudson CI
import java.io.InputStream;
import java.net.URL;
import java.util.Collection;
import java.io.InputStream;
import java.net.URL;
import java.util.Collection;
+import java.util.HashSet;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
private CustomXmlTrace fTrace;
private Collection<ITmfEventAspect> fAspects = TmfTrace.BASE_ASPECTS;
private CustomXmlTrace fTrace;
private Collection<ITmfEventAspect> fAspects = TmfTrace.BASE_ASPECTS;
+ private final Collection<ITmfEventAspect> fAdditionalAspects = new HashSet<>();
/**
* Constructor. Constructs the custom XML trace with the appropriate
/**
* Constructor. Constructs the custom XML trace with the appropriate
fieldsArray[i] = new TmfEventField(checkNotNull(fields[i]), val, null);
}
fieldsArray[i] = new TmfEventField(checkNotNull(fields[i]), val, null);
}
- /* Generate the aspects for this trace if it is the 'set_aspects' definition */
+ /*
+ * Generate the aspects for this trace if it is the 'set_aspects'
+ * definition
+ */
if (fTrace.getDefinition() != fDefinition) {
generateAspects(fieldsArray);
return null;
if (fTrace.getDefinition() != fDefinition) {
generateAspects(fieldsArray);
return null;
/* Add the big content aspect */
builder.add(ITmfEventAspect.BaseAspects.CONTENTS);
/* Add the big content aspect */
builder.add(ITmfEventAspect.BaseAspects.CONTENTS);
+ /* Add the additional aspects */
+ builder.addAll(fAdditionalAspects);
fAspects = builder.build();
}
fAspects = builder.build();
}
+ /**
+ * Adds a new event aspect to this type of trace. Since this trace type is
+ * used to build custom traces that mimic the behavior of real traces, the
+ * required aspects may be missing and this method allows to add them. This
+ * method should be called before calling
+ * {@link #initTrace(IResource, String, Class)} otherwise the additional
+ * aspects will not be picked up when generating the aspects.
+ *
+ * @param aspect
+ * The aspect to have
+ */
+ public void addEventAspect(ITmfEventAspect aspect) {
+ fAdditionalAspects.add(aspect);
+ }
+