Package org.apache.cayenne.di

Examples of org.apache.cayenne.di.Injector


                binder.bind(ConfigurationNameMapper.class).to(
                        DefaultConfigurationNameMapper.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        // create and initialize loader instance to test
        XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
        injector.injectMembers(loader);

        String testConfigName = "testConfig1";

        URL url = getClass().getResource("cayenne-" + testConfigName + ".xml");
        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));
View Full Code Here


                binder.bind(ConfigurationNameMapper.class).to(
                        DefaultConfigurationNameMapper.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        // create and initialize loader instance to test
        XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
        injector.injectMembers(loader);

        try {
            loader.load(new URLResource(new URL("file:///no_such_resource")));
            fail("No exception was thrown on bad absent config name");
        }
View Full Code Here

                binder.bind(ConfigurationNameMapper.class).to(
                        DefaultConfigurationNameMapper.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        // create and initialize loader instance to test
        XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
        injector.injectMembers(loader);

        String testConfigName = "testConfig2";
        URL url = getClass().getResource("cayenne-" + testConfigName + ".xml");

        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));
View Full Code Here

                binder.bind(ConfigurationNameMapper.class).to(
                        DefaultConfigurationNameMapper.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        // create and initialize loader instance to test
        XMLDataChannelDescriptorLoader loader = new XMLDataChannelDescriptorLoader();
        injector.injectMembers(loader);

        String testConfigName = "testConfig3";
        URL url = getClass().getResource("cayenne-" + testConfigName + ".xml");

        ConfigurationTree<DataChannelDescriptor> tree = loader.load(new URLResource(url));
View Full Code Here

                        mock(RuntimeProperties.class));
                binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        DelegatingDataSourceFactory factoryLoader = new DelegatingDataSourceFactory();
        injector.injectMembers(factoryLoader);

        DataSourceFactory factory = factoryLoader.getDataSourceFactory(nodeDescriptor);
        assertNotNull(factory);
        assertTrue(factory instanceof XMLPoolingDataSourceFactory);
    }
View Full Code Here

                        mock(RuntimeProperties.class));
                binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        DelegatingDataSourceFactory factoryLoader = new DelegatingDataSourceFactory();
        injector.injectMembers(factoryLoader);

        DataSourceFactory factory = factoryLoader.getDataSourceFactory(nodeDescriptor);
        assertNotNull(factory);
        assertTrue(factory instanceof MockDataSourceFactory1);
        assertSame(
View Full Code Here

                binder.bind(RuntimeProperties.class).toInstance(properties);
                binder.bind(JdbcEventLogger.class).to(CommonsJdbcEventLogger.class);
            }
        };

        Injector injector = DIBootstrap.createInjector(testModule);

        DelegatingDataSourceFactory factoryLoader = new DelegatingDataSourceFactory();
        injector.injectMembers(factoryLoader);

        DataSourceFactory factory = factoryLoader.getDataSourceFactory(nodeDescriptor);
        assertNotNull(factory);
        assertTrue(factory instanceof PropertyDataSourceFactory);
View Full Code Here

public class CAY_743Test extends TestCase {

    public void testLoad2MapsWithCrossMapInheritance() throws Exception {

        Injector injector = DIBootstrap.createInjector(new ServerModule(
                "cay743/cayenne-domain.xml"));

        try {
            DataDomain domain = injector.getInstance(DataDomain.class);
            assertEquals(2, domain.getDataMaps().size());

            DataMap m1 = domain.getDataMap("map1");
            DataMap m2 = domain.getDataMap("map2");

            ObjEntity oe11 = m1.getObjEntity("Entity11");
            ObjEntity oe12 = m1.getObjEntity("Entity12");

            ObjEntity oe21 = m2.getObjEntity("Entity21");
            ObjEntity oe22 = m2.getObjEntity("Entity22");

            // this causes StackOverflow per CAY-743
            ObjEntity oe21Super = oe21.getSuperEntity();
            ObjEntity oe12Super = oe12.getSuperEntity();

            assertSame(oe12Super, oe22);
            assertSame(oe21Super, oe11);
        }
        finally {
            injector.shutdown();
        }
    }
View Full Code Here

    @Inject
    protected ClientCaseProperties clientCaseProperties;

    public ClientRuntime get() throws ConfigurationException {
        Injector serverInjector = serverRuntimeProvider.get().getInjector();
        return new ClientLocalRuntime(serverInjector, clientCaseProperties
                .getRuntimeProperties(), new ClientExtraModule(serverInjector));
    }
View Full Code Here

                                return new MockObjectContext();
                            }
                        });
            }
        };
        Injector injector = DIBootstrap.createInjector(module);
        SessionContextRequestHandler handler = new SessionContextRequestHandler();
        injector.injectMembers(handler);

        MockHttpSession session = new MockHttpSession();

        BaseContext.bindThreadObjectContext(null);
View Full Code Here

TOP

Related Classes of org.apache.cayenne.di.Injector

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.