Package org.apache.felix.ipojo.test

Examples of org.apache.felix.ipojo.test.MockBundle


    /**
     * Check that we don't create smart proxies for concrete and abstract classes.
     */
    public void testCannotProxyAbstractAndContreteClasses() {
        Bundle bundle = new MockBundle(Dependency.class.getClassLoader());

        BundleContext context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(bundle);
View Full Code Here


     * [ERROR] test : Cannot create the proxy object
     * java.lang.SecurityException: Prohibited package name: java.awt
     * </code>
     */
    public void testProxiesOfJavaClasses() {
        Bundle bundle = new MockBundle(Dependency.class.getClassLoader());

        BundleContext context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(bundle);
View Full Code Here

    public void setUp() {
        context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(new MockBundle(this.getClass().getClassLoader()));

        factory = (ComponentFactory) Mockito.mock(ComponentFactory.class);
        Mockito.when(factory.getBundleClassLoader()).thenReturn(ProvidedServiceHandler.class.getClassLoader());
        Mockito.when(factory.getLogger()).thenReturn(new Logger(context, "TEST", Logger.INFO));
View Full Code Here

    public void setUp() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(new MockBundle(this.getClass().getClassLoader()));

        factory = (ComponentFactory) Mockito.mock(ComponentFactory.class);
        Mockito.when(factory.getBundleClassLoader()).thenReturn(ProvidedServiceHandler.class.getClassLoader());
        logger = Mockito.spy(new Logger(context, "TEST", Logger.INFO));
        Mockito.when(factory.getLogger()).thenReturn(logger);
View Full Code Here

    /**
     * Check that we don't create smart proxies for concrete and abstract classes.
     */
    public void testCannotProxyAbstractAndConcreteClasses() {
        Bundle bundle = new MockBundle(Dependency.class.getClassLoader());

        BundleContext context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(bundle);
View Full Code Here

     * [ERROR] test : Cannot create the proxy object
     * java.lang.SecurityException: Prohibited package name: java.awt
     * </code>
     */
    public void testProxiesOfJavaClasses() {
        Bundle bundle = new MockBundle(Dependency.class.getClassLoader());

        BundleContext context = (BundleContext) Mockito.mock(BundleContext.class);
        Mockito.when(context.getProperty(DependencyHandler.PROXY_TYPE_PROPERTY)).thenReturn(null);
        Mockito.when(context.getProperty(Logger.IPOJO_LOG_LEVEL_PROP)).thenReturn(null);
        Mockito.when(context.getBundle()).thenReturn(bundle);
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.test.MockBundle

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.