Examples of ClassTransformation


Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(EventHandlerTarget.class, logger);

        OnEvent annotation = ct.getMethodAnnotation(new TransformMethodSignature("handler"), OnEvent.class);

        // Check that the attributes of the annotation match the expectation.

        assertEquals(annotation.value(), "fred");
        assertEquals(annotation.component(), "alpha");
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(MethodIdentifier.class, logger);

        List<TransformMethodSignature> sigs = ct.findMethodsWithAnnotation(OnEvent.class);

        assertEquals(sigs.size(), 1);

        TransformMethodSignature sig = sigs.get(0);

        assertEquals(
                ct.getMethodIdentifier(sig),
                "org.apache.tapestry5.internal.transform.pages.MethodIdentifier.makeWaves(java.lang.String, int[]) (at MethodIdentifier.java:24)");

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

            {
                return true;
            }
        };

        ClassTransformation ct = createClassTransformation(SimpleBean.class, logger);

        List<TransformMethodSignature> methods = ct.findMethods(filter);

        assertFalse(methods.isEmpty());

        for (TransformMethodSignature sig : methods)
        {
            assertFalse(ct.isMethodOverride(sig));
        }

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(SimpleBean.class, logger);

        TransformMethodSignature sig = new TransformMethodSignature("methodDoesNotExist");

        try
        {
            ct.isMethodOverride(sig);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

        parentTransform.finish();

        CtClass childClass = findCtClass(SimpleBeanSubclass.class);

        ClassTransformation childTransform = parentTransform.createChildTransformation(childClass,
                stubMutableComponentModel(logger));

        assertFalse(childTransform.isMethodOverride(new TransformMethodSignature("notOverridden")));

        assertTrue(childTransform.isMethodOverride(new TransformMethodSignature(Modifier.PUBLIC, "void", "setAge",
                new String[]
                { "int" }, null)));
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(SimpleBean.class, logger);

        TransformMethodSignature sig = new TransformMethodSignature("methodDoesNotExist");

        try
        {
            ct.isMethodOverride(sig);
            unreachable();
        }
        catch (IllegalArgumentException ex)
        {
            assertEquals(ex.getMessage(),
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

        parentTransform.finish();

        CtClass childClass = findCtClass(SimpleBeanSubclass.class);

        ClassTransformation childTransform = parentTransform.createChildTransformation(childClass,
                                                                                       stubMutableComponentModel(
                                                                                               logger));

        assertFalse(childTransform.isMethodOverride(new TransformMethodSignature("notOverridden")));

        assertTrue(childTransform.isMethodOverride(
                new TransformMethodSignature(Modifier.PUBLIC, "void", "setAge", new String[] { "int" }, null)));
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(ParentClass.class, logger);

        assertEquals(ct.newMemberName("fred"), "_$fred");
        assertEquals(ct.newMemberName("fred"), "_$fred_0");

        // Here we're exposing a bit of the internal algorithm, which strips
        // off '$' and '_' before tacking "_$" in front.

        assertEquals(ct.newMemberName("_fred"), "_$fred_1");
        assertEquals(ct.newMemberName("_$fred"), "_$fred_2");
        assertEquals(ct.newMemberName("__$___$____$_fred"), "_$fred_3");

        // Here we're trying to force conflicts with existing declared
        // fields and methods of the class.

        assertEquals(ct.newMemberName("_parentField"), "_$parentField");
        assertEquals(ct.newMemberName("conflictField"), "_$conflictField_0");
        assertEquals(ct.newMemberName("conflictMethod"), "_$conflictMethod_0");

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(ParentClass.class, logger);

        assertEquals(ct.newMemberName("prefix", "fred"), "_$prefix_fred");
        assertEquals(ct.newMemberName("prefix", "fred"), "_$prefix_fred_0");

        // Here we're exposing a bit of the internal algorithm, which strips
        // off '$' and '_' before tacking "_$" in front.

        assertEquals(ct.newMemberName("prefix", "_fred"), "_$prefix_fred_1");
        assertEquals(ct.newMemberName("prefix", "_$fred"), "_$prefix_fred_2");
        assertEquals(ct.newMemberName("prefix", "__$___$____$_fred"), "_$prefix_fred_3");

        verify();
    }
View Full Code Here

Examples of org.apache.tapestry5.services.ClassTransformation

    {
        Logger logger = mockLogger();

        replay();

        ClassTransformation ct = createClassTransformation(ParentClass.class, logger);

        try
        {
            ct.getFieldAnnotation("unknownField", Retain.class);
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(ex.getMessage(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.