Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.ClassTransformation


    {
        Log log = mockLog();

        replay();

        ClassTransformation ct = createClassTransformation(CheckFieldType.class, log);

        assertEquals(ct.getFieldModifiers("_privateField"), Modifier.PRIVATE);
        assertEquals(ct.getFieldModifiers("_map"), Modifier.PRIVATE + Modifier.FINAL);
    }
View Full Code Here


    {
        Log log = mockLog();

        replay();

        ClassTransformation ct = createClassTransformation(CheckFieldType.class, log);

        assertTrue(ct.isField("_privateField"));
        assertFalse(ct.isField("_doesNotExist"));

        verify();
    }
View Full Code Here

    {
        Log log = mockLog();

        replay();

        ClassTransformation ct = createClassTransformation(FindFieldClass.class, log);

        ct.claimField("_booleanValue", this);

        checkFindFields(ct, "boolean");

        verify();
    }
View Full Code Here

    {
        Log log = mockLog();

        replay();

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

        ct.claimField("_annotatedField", this);

        List<String> fields = ct.findFieldsWithAnnotation(Retain.class);

        assertTrue(fields.isEmpty());

        verify();
    }
View Full Code Here

    {
        Log log = mockLog();

        replay();

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

        List<String> fields = ct.findFieldsWithAnnotation(Documented.class);

        assertTrue(fields.isEmpty());

        verify();
    }
View Full Code Here

    {
        Log log = mockLog();

        replay();

        ClassTransformation ct = createClassTransformation(ClaimedFields.class, log);

        List<String> unclaimed = ct.findUnclaimedFields();

        assertEquals(unclaimed, asList("_field1", "_field4", "_zzfield"));

        ct.claimField("_field4", "Fred");

        unclaimed = ct.findUnclaimedFields();

        assertEquals(unclaimed, asList("_field1", "_zzfield"));

        try
        {
            ct.claimField("_field4", "Barney");
            unreachable();
        }
        catch (RuntimeException ex)
        {
            assertEquals(
View Full Code Here

    public void annotation_has_value()
    {
        ObjectProvider provider = mockObjectProvider();
        ObjectLocator locator = mockObjectLocator();
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        Request injected = mockRequest();

        train_findFieldsWithAnnotation(ct, Inject.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", Inject.class, annotation);

        train_getFieldType(ct, "myfield", WEBREQUEST_CLASS_NAME);
        train_toClass(ct, WEBREQUEST_CLASS_NAME, Request.class);

        expect(provider.provide(eq(Request.class), isA(AnnotationProvider.class), eq(locator)))
                .andReturn(injected);

        ct.injectField("myfield", injected);

        ct.claimField("myfield", annotation);

        replay();

        InjectWorker worker = new InjectWorker(provider, locator);
View Full Code Here

    public void provide_object_fails()
    {
        ObjectProvider provider = mockObjectProvider();
        ObjectLocator locator = mockObjectLocator();
        Inject annotation = newMock(Inject.class);
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        Throwable cause = new RuntimeException("Injection failed.");

        train_findFieldsWithAnnotation(ct, Inject.class, "myfield");
        train_getFieldAnnotation(ct, "myfield", Inject.class, annotation);
View Full Code Here

public class ComponentLifecycleMethodWorkerTest extends TapestryTestCase
{
    @Test
    public void no_methods_with_annotation()
    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        MethodSignature sig = new MethodSignature("someRandomMethod");

        train_findMethods(tf, sig);
View Full Code Here

    }

    @Test
    public void added_lifecycle_method_is_ignored()
    {
        ClassTransformation tf = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

        train_findMethods(tf, TransformConstants.SETUP_RENDER_SIGNATURE);

        replay();
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.ClassTransformation

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.