Package org.apache.tapestry5.services

Examples of org.apache.tapestry5.services.ClassTransformation


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

        TransformMethodSignature sig = new TransformMethodSignature("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

    {
        return new ComponentClassTransformWorker2()
        {
            public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model)
            {
                ClassTransformation ct = new BridgeClassTransformation(plasticClass, support, model);

                oldStyleWorker.transform(ct, model);
            }
        };
    }
View Full Code Here

  @Test
  public void anonymous_injection() {
    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);

    train_matchFields(ct, field);
View Full Code Here

  @Test
  public void anonymous_injection_not_provided() {
    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);

    train_matchFields(ct, field);
View Full Code Here

  @Test
  public void injection_provider_threw_exception() {
    ObjectLocator locator = mockObjectLocator();
    InjectionProvider ip = newMock(InjectionProvider.class);
    Inject annotation = newInject();
    ClassTransformation ct = mockClassTransformation();
    MutableComponentModel model = mockMutableComponentModel();
    TransformField field = newMock(TransformField.class);
    RuntimeException failure = new RuntimeException("Oops.");

    train_matchFields(ct, field);
View Full Code Here

    public void anonymous_injection()
    {
        ObjectLocator locator = mockObjectLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newInject();
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

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

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

        train_provideInjection(ip, "myfield", Request.class, locator, ct, model, true);

        ct.claimField("myfield", annotation);

        replay();

        ComponentClassTransformWorker worker = new InjectWorker(locator, ip, new QuietOperationTracker());
View Full Code Here

    public void anonymous_injection_not_provided()
    {
        ObjectLocator locator = mockObjectLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newInject();
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();

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

    public void injection_provider_threw_exception()
    {
        ObjectLocator locator = mockObjectLocator();
        InjectionProvider ip = newMock(InjectionProvider.class);
        Inject annotation = newInject();
        ClassTransformation ct = mockClassTransformation();
        MutableComponentModel model = mockMutableComponentModel();
        RuntimeException failure = new RuntimeException("Oops.");

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

    {
        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

TOP

Related Classes of org.apache.tapestry5.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.