Package org.apache.tapestry.ioc.services

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


    }

    @Test
    public void new_class_with_name_and_base_class() throws Exception
    {
        ClassFactory factory = new ClassFactoryImpl();
        String name = ClassFabUtils.generateClassName(Runnable.class);

        ClassFab cf = factory.newClass(name, Object.class);
        cf.addInterface(Runnable.class);

        addRunMethod(cf);

        Class newClass = cf.createClass();
View Full Code Here


    }

    @Test
    public void new_class_with_non_object_base_class() throws Exception
    {
        ClassFactory factory = new ClassFactoryImpl();
        String name = ClassFabUtils.generateClassName(Runnable.class);

        ClassFab cf = factory.newClass(name, BaseClass.class);
        cf.addInterface(Runnable.class);

        Class newClass = cf.createClass();

        Runnable instance = (Runnable) newClass.newInstance();
View Full Code Here

    }

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

        ClassFab cf = factory.newClass(Runnable.class);

        addRunMethod(cf);

        Class newClass = cf.createClass();
View Full Code Here

    }

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

        Class target = LineNumberBean.class;

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

        // 21 is the line containing the close brace

        assertEquals(factory.getMethodLineNumber(m), 21);

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

        // 25 is the line of the return statement

        assertEquals(factory.getMethodLineNumber(m), 25);

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

        assertEquals(factory.getMethodLineNumber(m), 30);
    }
View Full Code Here

    @Test
    public void get_service_by_id_exists()
    {
        InternalRegistry registry = newInternalRegistry();
        Log log = newLog();
        ClassFactory factory = new ClassFactoryImpl();

        ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log, null);

        Module module = new ModuleImpl(registry, moduleDef, log);
View Full Code Here

    public void too_many_public_constructors_on_module_builder_class()
    {
        InternalRegistry registry = newInternalRegistry();
        Log log = newLog();
        ModuleDef def = new DefaultModuleDefImpl(ExtraPublicConstructorsModule.class, log, null);
        ClassFactory factory = newMock(ClassFactory.class);
        Module module = new ModuleImpl(registry, def, log);

        log.warn(contains("contains more than one public constructor"));

        train_expandSymbols(registry, "ClassFactory", "ClassFactory");
View Full Code Here

    }

    @Test
    public void new_class_with_name_and_base_class() throws Exception
    {
        ClassFactory factory = new ClassFactoryImpl();
        String name = ClassFabUtils.generateClassName(Runnable.class);

        ClassFab cf = factory.newClass(name, Object.class);
        cf.addInterface(Runnable.class);

        addRunMethod(cf);

        Class newClass = cf.createClass();
View Full Code Here

    }

    @Test
    public void new_class_with_non_object_base_class() throws Exception
    {
        ClassFactory factory = new ClassFactoryImpl();
        String name = ClassFabUtils.generateClassName(Runnable.class);

        ClassFab cf = factory.newClass(name, BaseClass.class);
        cf.addInterface(Runnable.class);

        Class newClass = cf.createClass();

        Runnable instance = (Runnable) newClass.newInstance();
View Full Code Here

    }

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

        ClassFab cf = factory.newClass(Runnable.class);

        addRunMethod(cf);

        Class newClass = cf.createClass();
View Full Code Here

    }

    @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

        assertEquals(
                factory.getMethodLocation(m).toString(),
                "org.apache.tapestry.ioc.internal.services.LineNumberBean.fred() (at LineNumberBean.java:21)");

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

        // 25 is the line of the return statement

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

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

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

TOP

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