Package org.apache.camel.component.bean

Examples of org.apache.camel.component.bean.MethodNotFoundException


        Exchange exchange = createExchangeWithBody("Claus");

        Object result = exp.evaluate(exchange, Object.class);
        assertNull(result);
        assertNotNull(exchange.getException());
        MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
        assertSame(user, e.getBean());
        assertEquals("unknown", e.getMethodName());
    }
View Full Code Here


        Exchange exchange = createExchangeWithBody("Claus");

        Object result = exp.evaluate(exchange, Object.class);
        assertNull(result);
        assertNotNull(exchange.getException());
        MethodNotFoundException e = assertIsInstanceOf(MethodNotFoundException.class, exchange.getException());
        assertSame(context.getRegistry().lookup("foo"), e.getBean());
        assertEquals("cake", e.getMethodName());
    }
View Full Code Here

        try {
            template.requestBody("direct:start", "World", String.class);
            fail("Should have thrown exception");
        } catch (CamelExecutionException e) {
            RuntimeCamelException rce = assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
            MethodNotFoundException mnfe = assertIsInstanceOf(MethodNotFoundException.class, rce.getCause());
            assertEquals("getOther[xx", mnfe.getMethodName());
            ExpressionIllegalSyntaxException cause = assertIsInstanceOf(ExpressionIllegalSyntaxException.class, mnfe.getCause());
            assertEquals("Illegal syntax: getOther[xx", cause.getMessage());
            assertEquals("getOther[xx", cause.getExpression());
        }
    }
View Full Code Here

        try {
            assertExpression("${in.body.getLines[0]?.getRating}", "");
            fail("Should have thrown exception");
        } catch (RuntimeBeanExpressionException e) {
            MethodNotFoundException cause = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
            assertEquals("getRating", cause.getMethodName());
        }
    }
View Full Code Here

        try {
            assertExpression("${in.body.lines[0]?.rating}", "");
            fail("Should have thrown exception");
        } catch (RuntimeBeanExpressionException e) {
            MethodNotFoundException cause = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
            assertEquals("rating", cause.getMethodName());
        }
    }
View Full Code Here

            answer.setMethod(method);

            // check there is a method with the given name, and leverage BeanInfo for that
            BeanInfo info = new BeanInfo(routeContext.getCamelContext(), bean.getClass());
            if (!info.hasMethod(method)) {
                throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
            }
        }
        return answer;
    }
View Full Code Here

        }

        // if invalid OGNL then fail
        if (OgnlHelper.isInvalidValidOgnlExpression(method)) {
            ExpressionIllegalSyntaxException cause = new ExpressionIllegalSyntaxException(method);
            throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(bean, method, cause));
        }

        BeanInfo info = new BeanInfo(context, bean.getClass());
        if (!info.hasMethod(method)) {
            throw ObjectHelper.wrapRuntimeCamelException(new MethodNotFoundException(null, bean, method));
        }
    }
View Full Code Here

        try {
            template.requestBody("direct:start", "World", String.class);
            fail("Should have thrown exception");
        } catch (CamelExecutionException e) {
            RuntimeCamelException rce = assertIsInstanceOf(RuntimeCamelException.class, e.getCause());
            MethodNotFoundException mnfe = assertIsInstanceOf(MethodNotFoundException.class, rce.getCause());
            assertEquals("getOther[xx", mnfe.getMethodName());
            ExpressionIllegalSyntaxException cause = assertIsInstanceOf(ExpressionIllegalSyntaxException.class, mnfe.getCause());
            assertEquals("Illegal syntax: getOther[xx", cause.getMessage());
            assertEquals("getOther[xx", cause.getExpression());
        }
    }
View Full Code Here

        try {
            assertExpression("${in.body.getLines[0]?.getRating}", "");
            fail("Should have thrown exception");
        } catch (RuntimeBeanExpressionException e) {
            MethodNotFoundException cause = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
            assertEquals("getRating", cause.getMethodName());
        }
    }
View Full Code Here

        try {
            assertExpression("${in.body.lines[0]?.rating}", "");
            fail("Should have thrown exception");
        } catch (RuntimeBeanExpressionException e) {
            MethodNotFoundException cause = assertIsInstanceOf(MethodNotFoundException.class, e.getCause().getCause());
            assertEquals("rating", cause.getMethodName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.bean.MethodNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.