use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.
the class DefaultMultiPackageBasedMatcher method joinOr.
private MatcherOperand joinOr(List<String> basePackageNames) {
if (basePackageNames.isEmpty()) {
throw new IllegalArgumentException("basePackageNames must not be empty ");
}
MatcherOperand operandGroup = null;
for (String basePackageName : basePackageNames) {
if (operandGroup == null) {
operandGroup = new PackageInternalNameMatcherOperand(basePackageName);
} else {
// package OR ...
final MatcherOperand packageMatcherOperand = new PackageInternalNameMatcherOperand(basePackageName);
operandGroup = operandGroup.or(packageMatcherOperand);
}
}
return operandGroup;
}
use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand in project pinpoint by naver.
the class TransformerMatcherExecutionPlannerTest method findIndex.
@Test
public void findIndex() {
TransformerMatcherExecutionPlanner executionPlanner = new TransformerMatcherExecutionPlanner();
// and
MatcherOperand operand = new ClassInternalNameMatcherOperand("java/lang/String");
operand = operand.and(new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false));
operand = operand.and(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new PackageInternalNameMatcherOperand("java/lang"));
List<MatcherOperand> result = executionPlanner.findIndex(operand);
assertEquals(1, result.size());
// or
operand = new ClassInternalNameMatcherOperand("java/lang/String");
operand = operand.or(new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false));
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.or(new PackageInternalNameMatcherOperand("java/lang"));
result = executionPlanner.findIndex(operand);
assertEquals(2, result.size());
// not
operand = new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false);
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new PackageInternalNameMatcherOperand("javax").not());
result = executionPlanner.findIndex(operand);
assertEquals(0, result.size());
// none
operand = new InterfaceInternalNameMatcherOperand("java/lang/Comparable", false);
operand = operand.or(new AnnotationInternalNameMatcherOperand("java/lang/Override", false));
operand = operand.and(new SuperClassInternalNameMatcherOperand("java/lang/Object", true));
result = executionPlanner.findIndex(operand);
assertEquals(0, result.size());
}
Aggregations