public static boolean isMessageSource(ComponentModel componentModel) { return isOfType(componentModel, MessageSource.class) || componentModel.getComponentType().map(type -> type.equals(SOURCE)).orElse(false); }
/** * Defines if a location should be intercepted by the coverage interceptor * * @param location * @return false if the location should not be intercepted, true otherwise */ public static boolean shouldIntercept(ComponentLocation location) { if (isLocationInsideMunitTest(location)) { return false; } TypedComponentIdentifier identifier = location.getComponentIdentifier(); if (NON_INTERCEPTABLE_NAMESPACES.contains(identifier.getIdentifier().getNamespace())) { return false; } if (!OPERATION.equals(identifier.getType()) && !INTERCEPTING.equals(identifier.getType())) { return false; } return true; }
/** * Validates if the {@link ComponentLocation} allow to be spy or not. It works a black list, allowing spy for any component * location save those black listed. * * @return false if the {@link ComponentLocation} does not allow mocking, true otherwise */ public Boolean allowMocking() { ComponentType type = location.getComponentIdentifier().getType(); if (type.equals(FLOW) || type.equals(SOURCE) || type.equals(SCOPE) || type.equals(ROUTER) || type.equals(INTERCEPTING) || type.equals(ERROR_HANDLER) || type.equals(ON_ERROR) || type.equals(UNKNOWN)) { return false; } if (type.equals(OPERATION)) { if (NON_MOCKABLE_CORE_OPERATIONS.contains(location.getComponentIdentifier().getIdentifier().toString())) { return false; } } return true; }
@Override public boolean intercept(ComponentLocation location) { TypedComponentIdentifier identifier = location.getComponentIdentifier(); if (NON_INTERCEPTABLE_NAMESPACES.contains(identifier.getIdentifier().getNamespace())) { return false; } if (!OPERATION.equals(identifier.getType())) { return false; } if (isInsideMunitToolsSpy(location)) { return false; } return true; }
public String getPrintableType() { return StringUtils.capitalize(type.toString().toLowerCase().replaceAll("_", " ")); }
public static boolean isErrorHandler(ComponentModel componentModel) { return isOfType(componentModel, ErrorHandler.class) || componentModel.getComponentType().map(type -> type.equals(ERROR_HANDLER)).orElse(false); }
public static boolean isMessageSource(ComponentModel componentModel) { return isOfType(componentModel, MessageSource.class) || componentModel.getComponentType().map(type -> type.equals(SOURCE)).orElse(false); }
public static boolean isTemplateOnErrorHandler(ComponentModel componentModel) { return isOfType(componentModel, TemplateOnErrorHandler.class) || componentModel.getComponentType().map(type -> type.equals(ON_ERROR)).orElse(false); }
public static boolean isProcessor(ComponentModel componentModel) { return isOfType(componentModel, Processor.class) || isOfType(componentModel, InterceptingMessageProcessor.class) || componentModel.getComponentType().map(type -> type.equals(OPERATION)).orElse(false) || componentModel.getComponentType().map(type -> type.equals(ROUTER)).orElse(false) || componentModel.getComponentType().map(type -> type.equals(SCOPE)).orElse(false); }
@Override public int hashCode() { int result = getIdentifier().hashCode(); result = 31 * result + getType().hashCode(); return result; }
public static boolean isRouter(ComponentModel componentModel) { return isOfType(componentModel, Router.class) || isOfType(componentModel, AbstractSelectiveRouter.class) || ComponentLocationVisitor.BATCH_JOB_COMPONENT_IDENTIFIER.equals(componentModel.getIdentifier()) || ComponentLocationVisitor.BATCH_PROCESSS_RECORDS_COMPONENT_IDENTIFIER.equals(componentModel.getIdentifier()) || componentModel.getComponentType().map(type -> type.equals(ROUTER)).orElse(false); } }
public static boolean isProcessor(ComponentModel componentModel) { if (componentModel.getIdentifier().equals(REDELIVERY_POLICY_IDENTIFIER)) { return false; } return isOfType(componentModel, Processor.class) || isOfType(componentModel, InterceptingMessageProcessor.class) || componentModel.getComponentType().map(type -> type.equals(OPERATION)).orElse(false) || componentModel.getComponentType().map(type -> type.equals(ROUTER)).orElse(false) || componentModel.getComponentType().map(type -> type.equals(SCOPE)).orElse(false); }
public static boolean isRouter(ComponentModel componentModel) { return isOfType(componentModel, Router.class) || isOfType(componentModel, AbstractSelectiveRouter.class) || ComponentLocationVisitor.BATCH_JOB_COMPONENT_IDENTIFIER.equals(componentModel.getIdentifier()) || ComponentLocationVisitor.BATCH_PROCESSS_RECORDS_COMPONENT_IDENTIFIER.equals(componentModel.getIdentifier()) || componentModel.getComponentType().map(type -> type.equals(ROUTER)).orElse(false); } }
public static boolean isTemplateOnErrorHandler(ComponentModel componentModel) { return isOfType(componentModel, TemplateOnErrorHandler.class) || componentModel.getComponentType().map(type -> type.equals(ON_ERROR)).orElse(false); }
public static boolean isErrorHandler(ComponentModel componentModel) { return isOfType(componentModel, ErrorHandler.class) || componentModel.getComponentType().map(type -> type.equals(ERROR_HANDLER)).orElse(false); }