Package org.apache.tapestry5.ioc.services

Examples of org.apache.tapestry5.ioc.services.ClassFactory


    }

    @Test
    public void get_method_location() throws Exception
    {
        ClassFactory factory = new ClassFactoryImpl();

        Class target = LineNumberBean.class;

        Method m = target.getMethod("fred");

        // 21 is the line containing the close brace

        Location l = factory.getMethodLocation(m);
        assertEquals(
                l.toString(),
                "org.apache.tapestry5.ioc.internal.services.LineNumberBean.fred() (at LineNumberBean.java:25)");
        assertEquals(l.getLine(), 25);

        m = target.getMethod("betty", String.class, int.class);

        // 25 is the line of the return statement

        assertEquals(
                factory.getMethodLocation(m).toString(),
                "org.apache.tapestry5.ioc.internal.services.LineNumberBean.betty(String, int) (at LineNumberBean.java:29)");

        m = target.getDeclaredMethod("wilma", int[].class, Double[][][].class);

        assertEquals(
                factory.getMethodLocation(m).toString(),
                "org.apache.tapestry5.ioc.internal.services.LineNumberBean.wilma(int[], Double[][][]) (at LineNumberBean.java:34)");
    }
View Full Code Here


    @Test
    public void get_constructor_location() throws Exception
    {
        Constructor cc = LineNumberBean.class.getConstructors()[0];

        ClassFactory factory = new ClassFactoryImpl();

        // Eclipse and Sun JDK don't agree on the line number, so we'll accept either.

        assertTrue(factory
                .getConstructorLocation(cc)
                .toString()
                .matches(
                "org.apache.tapestry5.ioc.internal.services.LineNumberBean\\(String, int\\) \\(at LineNumberBean.java:(19|20)\\)"));
    }
View Full Code Here

     * Import a class (or two) where the class is from a known and available class loader.
     */
    @Test
    public void import_ordinary_class()
    {
        ClassFactory factory = new ClassFactoryImpl();

        assertSame(factory.importClass(Object.class), Object.class);
        assertSame(factory.importClass(LocationImpl.class), LocationImpl.class);
    }
View Full Code Here

     * loader) is returned.
     */
    @Test
    public void import_proxy_class() throws Exception
    {
        ClassFactory alienFactory = new ClassFactoryImpl();

        Class<TargetBean> clazz = TargetBean.class;

        ClassFab cf = alienFactory.newClass(clazz.getName() + "$$Proxy", clazz);

        Class alienClass = cf.createClass();

        ClassFactory factory = new ClassFactoryImpl();

        assertSame(factory.importClass(alienClass), clazz);
    }
View Full Code Here

    @Primary
    private StackTraceElementAnalyzer frameAnalyzer;

    void setupRender()
    {
        ExceptionAnalysis analysis = analyzer.analyze(exception);

        stack = analysis.getExceptionInfos();

        toggleId = renderSupport.allocateClientId("toggleStack");
    }
View Full Code Here

    @Test
    public void unknown_validator_type()
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
        Map<String, Validator> map = newMap();
View Full Code Here

    @Test
    public void validator_with_no_constraint() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
View Full Code Here

    @Test
    public void component_messages_overrides_validator_messages() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
View Full Code Here

    @Test
    public void component_messages_overrides_validator_messages_per_form() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
        Messages containerMessages = mockMessages();
View Full Code Here

    @Test
    public void constraint_value_from_message_catalog_per() throws Exception
    {
        ValidationMessagesSource messagesSource = mockValidationMessagesSource();
        Validator validator = mockValidator();
        TypeCoercer coercer = mockTypeCoercer();
        FieldComponent field = newFieldComponent();
        Messages messages = mockMessages();
        MessageFormatter formatter = mockMessageFormatter();
        Object inputValue = new Object();
        ComponentResources resources = mockComponentResources();
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.services.ClassFactory

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.