Example usage for org.aspectj.lang JoinPoint.StaticPart getKind

List of usage examples for org.aspectj.lang JoinPoint.StaticPart getKind

Introduction

In this page you can find the example usage for org.aspectj.lang JoinPoint.StaticPart getKind.

Prototype

String getKind();

Source Link

Document

This string is guaranteed to be interned.

Usage

From source file:org.caesarj.compiler.aspectj.CaesarKindedPointcut.java

License:Open Source License

public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
    if (jpsp.getKind().equals(kind.getName())) {
        if (signature.matches(jpsp)) {
            return FuzzyBoolean.YES;
        }/*from  w  w  w. j a  v a 2  s.c  om*/
    }
    return FuzzyBoolean.NO;
}

From source file:org.cooperari.core.CYieldPointImpl.java

License:Apache License

@SuppressWarnings("javadoc")
private static String deriveSignature(JoinPoint.StaticPart jpsp) {
    String kind = jpsp.getKind(); // note that String is internalized
    if (kind == JoinPoint.SYNCHRONIZATION_LOCK) {
        return MONITOR_ENTER_SIGNATURE;
    }/*w  ww. j  a  v  a2  s .  c o m*/
    if (kind == JoinPoint.SYNCHRONIZATION_UNLOCK) {
        return MONITOR_EXIT_SIGNATURE;
    }
    String s = jpsp.getSignature().toString();
    s = s.substring(s.indexOf(' ') + 1);
    s = s.replace("java.lang.", "").replace('$', '.');
    if (kind == JoinPoint.METHOD_CALL) {
        return s;
    }
    return kind + '(' + s + ')';
}

From source file:org.failearly.ajunit.AjUnitAspectTest.java

License:Open Source License

private static JoinPoint.StaticPart joinpoint() throws NoSuchMethodException {
    final JoinPoint.StaticPart joinPointStaticPart = Mockito.mock(JoinPoint.StaticPart.class);
    Mockito.when(joinPointStaticPart.getKind()).thenReturn(JoinPoint.METHOD_EXECUTION);
    final MethodSignature methodSignature = getMethodSignature();
    Mockito.when(joinPointStaticPart.getSignature()).thenReturn(methodSignature);
    return joinPointStaticPart;
}

From source file:org.failearly.ajunit.aspect.AjJoinpointCollector.java

License:Open Source License

private void validateResult(JoinPoint.StaticPart joinPoint, List<AjJoinPoint> joinPoints) {
    final int numAssociatedJoinPoints = joinPoints.size();
    AjAssert.assertCondition(numAssociatedJoinPoints > 0, MessageBuilders
            .message("Assertion failed: No associated ajUnit join point found for AspectJ join point")
            .arg(joinPoint).line("Please add").arg(joinPoint.getSignature().getDeclaringTypeName())
            .part("to Test Fixtures.").line("Or the join point type").arg(joinPoint.getKind())
            .part("is not yet supported: Propose a feature request to https://github.com/loddar/ajunit/issues."));
    AjAssert.assertCondition(numAssociatedJoinPoints == 1, MessageBuilders
            .message("Assertion failed: Exactly one join point expected, got").arg(numAssociatedJoinPoints));

}

From source file:org.failearly.ajunit.internal.universe.AjJoinPointType.java

License:Open Source License

/**
 * resolve enum value from AspectJ join point.
 *//*from w  ww .jav  a2s .c  om*/
public static AjJoinPointType resolveFromJoinPoint(final JoinPoint.StaticPart joinPoint) {
    return EnumUtils.defaultIfNotFound(SUPPORTED_JOIN_POINT_TYPES, joinPoint.getKind(), _UNKNOWN);
}

From source file:org.failearly.ajunit.internal.universe.AjJoinPointType.java

License:Open Source License

/**
 * Returns {@code true} if {@link org.aspectj.lang.JoinPoint#getKind()} is equal to {@link #joinPointKind}.
 *///from  www  .j av a  2  s .c o  m
public boolean isSameKind(JoinPoint.StaticPart joinPoint) {
    return this.joinPointKind.equals(joinPoint.getKind());
}

From source file:org.failearly.ajunit.internal.universe.matcher.ConstructorJoinPointMatcherTest.java

License:Open Source License

private JoinPoint.StaticPart createAspectJoinPointMock(AjJoinPointType joinPointType,
        Class<?>... parameterClasses) {
    final JoinPoint.StaticPart joinPoint = mock(JoinPoint.StaticPart.class);
    final Signature constructorSignatureMock = createConstructorSignatureMock(parameterClasses);

    when(joinPoint.getKind()).thenReturn(joinPointType.getJoinPointKind());
    when(joinPoint.getSignature()).thenReturn(constructorSignatureMock);

    LOGGER.debug("JoinPoint Mock - getKind() => {}", joinPoint.getKind());
    LOGGER.debug("JoinPoint Mock - getSignature() => {}", joinPoint.getSignature());

    return joinPoint;
}

From source file:org.failearly.ajunit.internal.universe.matcher.FieldJoinPointMatcherTest.java

License:Open Source License

private JoinPoint.StaticPart createAspectJoinPointMock(AjJoinPointType joinPointType, String fieldName) {
    final JoinPoint.StaticPart joinPoint = mock(JoinPoint.StaticPart.class);
    final Signature fieldSignatureMock = createFieldSignatureMock(fieldName);

    when(joinPoint.getKind()).thenReturn(joinPointType.getJoinPointKind());
    when(joinPoint.getSignature()).thenReturn(fieldSignatureMock);

    LOGGER.debug("JoinPoint Mock - getKind() => {}", joinPoint.getKind());
    LOGGER.debug("JoinPoint Mock - getSignature() => {}", joinPoint.getSignature());

    return joinPoint;
}

From source file:org.failearly.ajunit.internal.universe.matcher.MethodJoinPointMatcherTest.java

License:Open Source License

private JoinPoint.StaticPart createAspectJoinPointMock(AjJoinPointType joinPointType, String methodName) {
    final JoinPoint.StaticPart joinPoint = mock(JoinPoint.StaticPart.class);
    final Signature methodSignatureMock = createMethodSignatureMock(methodName);

    when(joinPoint.getKind()).thenReturn(joinPointType.getJoinPointKind());
    when(joinPoint.getSignature()).thenReturn(methodSignatureMock);

    LOGGER.debug("JoinPoint Mock - getKind() => {}", joinPoint.getKind());
    LOGGER.debug("JoinPoint Mock - getSignature() => {}", joinPoint.getSignature());

    return joinPoint;
}