Search in sources :

Example 6 with PackageInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand in project pinpoint by naver.

the class DefaultPackageBasedMatcherTest method getMatcherOperandWithPackageNameAndAdditionalIsNull.

@Test
public void getMatcherOperandWithPackageNameAndAdditionalIsNull() {
    // check unusual pattern.
    PackageBasedMatcher classMatcher = new DefaultPackageBasedMatcher("java.lang", null);
    MatcherOperand operand = classMatcher.getMatcherOperand();
    assertTrue(operand instanceof PackageInternalNameMatcherOperand);
    PackageInternalNameMatcherOperand annotationInternalNameMatcherOperand = (PackageInternalNameMatcherOperand) operand;
    assertEquals("java/lang", annotationInternalNameMatcherOperand.getPackageInternalName());
}
Also used : MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) Test(org.junit.Test)

Example 7 with PackageInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand 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;
}
Also used : MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand)

Example 8 with PackageInternalNameMatcherOperand

use of com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand 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());
}
Also used : InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) MatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand) AnnotationInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) InterfaceInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand) AnnotationInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand) PackageInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) SuperClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand) ClassInternalNameMatcherOperand(com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand) Test(org.junit.Test)

Aggregations

MatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.MatcherOperand)8 PackageInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.PackageInternalNameMatcherOperand)8 Test (org.junit.Test)6 InterfaceInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.InterfaceInternalNameMatcherOperand)5 ClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.ClassInternalNameMatcherOperand)3 AnnotationInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.AnnotationInternalNameMatcherOperand)2 SuperClassInternalNameMatcherOperand (com.navercorp.pinpoint.bootstrap.instrument.matcher.operand.SuperClassInternalNameMatcherOperand)2 AndMatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.AndMatcherOperator)1 OrMatcherOperator (com.navercorp.pinpoint.bootstrap.instrument.matcher.operator.OrMatcherOperator)1 InternalClassMetadata (com.navercorp.pinpoint.profiler.instrument.classreading.InternalClassMetadata)1 DefaultInstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig)1 InstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig)1 InputStream (java.io.InputStream)1