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

        if (proxy == null)
        {
            this.messagesSource = objectLocator.getService(ComponentMessagesSource.class);
            this.threadLocale = objectLocator.getService(ThreadLocale.class);

            ClassFactory classFactory = objectLocator.getService("ClassFactory", ClassFactory.class);

            proxy = classFactory.createProxy(Messages.class, new ApplicationMessagesObjectCreator(),
                    "<ApplicationMessagesProxy>");

            // Listen for invalidations; clear our cache of localized Messages bundles when
            // and invalidation occurs.
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

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

        TestService proxy = factory.createProxy(TestService.class, TestServiceImpl.class, new ObjectCreator()
        {
            public Object createObject()
            {
                return new TestServiceImpl();
            }
View Full Code Here

   
    @Test
    public void build_and_startup_registry_from_moduledef_and_modules()
    {
        Logger logger = LoggerFactory.getLogger(getClass());
        ClassFactory classFactory = new ClassFactoryImpl();

        ModuleDef module = new DefaultModuleDefImpl(ServiceBuilderModule.class, logger, classFactory);
       
        Registry r = RegistryBuilder.buildAndStartupRegistry(module, MasterModule.class);
       
View Full Code Here

    @Test
    public void handle_beans_from_unexpected_classloader() throws Exception
    {
        // First, create something that looks like a Hibernate proxy.

        ClassFactory factory = new ClassFactoryImpl();

        Class clazz = SimpleBean.class;

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

        cf.addInterface(Serializable.class);

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

    @Test
    public void handle_beans_from_unexpected_classloader() throws Exception
    {
        // First, create something that looks like a Hibernate proxy.

        ClassFactory factory = new ClassFactoryImpl();

        Class clazz = SimpleBean.class;

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

        cf.addInterface(Serializable.class);

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

    @Test
    public void handle_beans_from_unexpected_classloader() throws Exception
    {
        // First, create something that looks like a Hibernate proxy.

        ClassFactory factory = new ClassFactoryImpl();

        Class clazz = SimpleBean.class;

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

        cf.addInterface(Serializable.class);

        Class proxyClass = cf.createClass();
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.