Package org.apache.felix.ipojo

Examples of org.apache.felix.ipojo.InstanceManager


        Assert.assertTrue(found);

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        InstanceManager im = Mockito.mock(InstanceManager.class);
        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[]{im});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);
        Method method = cl.getMethod("doSomething", new Class[0]);
View Full Code Here


        Assert.assertFalse(manipulator.getInnerClasses().isEmpty());
        // We should have found only 2 inner classes.
        assertThat(manipulator.getInnerClasses().size()).isEqualTo(3);

        // Check that all inner classes are manipulated.
        InstanceManager im = Mockito.mock(InstanceManager.class);
        Constructor constructor = clazz.getDeclaredConstructor(InstanceManager.class);
        constructor.setAccessible(true);
        Object pojo = constructor.newInstance(im);
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);
View Full Code Here

        Assert.assertFalse(manipulator.getInnerClasses().isEmpty());
        // We should have found only 2 inner classes.
        assertThat(manipulator.getInnerClasses().size()).isEqualTo(3);

        // Check that all inner classes are manipulated.
        InstanceManager im = Mockito.mock(InstanceManager.class);
        Constructor constructor = clazz.getDeclaredConstructor(InstanceManager.class);
        constructor.setAccessible(true);
        Object pojo = constructor.newInstance(im);
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);
View Full Code Here

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {new InstanceManager()});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);

        Method method = cl.getMethod("doSomething", new Class[0]);
        Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue());
View Full Code Here

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {new InstanceManager()});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);

        Method method = cl.getMethod("getS1", new Class[0]);
        Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue());
View Full Code Here

        Assert.assertTrue(found);

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        InstanceManager im = (InstanceManager) Mockito.mock(InstanceManager.class);
        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {im});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);
View Full Code Here

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));


        // Creation using cst
        InstanceManager im = (InstanceManager) Mockito.mock(InstanceManager.class);
        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {im});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);
View Full Code Here

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {new InstanceManager()});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);

    }
View Full Code Here

        // Check the POJO interface
        Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class));

        cst.setAccessible(true);
        Object pojo = cst.newInstance(new Object[] {new InstanceManager()});
        Assert.assertNotNull(pojo);
        Assert.assertTrue(pojo instanceof Pojo);

        Method method = cl.getMethod("start", new Class[0]);
        Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue());
View Full Code Here

        Mockito.when(context.getBundle()).thenReturn(bundle);

        ComponentFactory factory = (ComponentFactory) Mockito.mock(ComponentFactory.class);
        Mockito.when(factory.getBundleClassLoader()).thenReturn(Dependency.class.getClassLoader());

        InstanceManager im = (InstanceManager) Mockito.mock(InstanceManager.class);
        Mockito.when(im.getContext()).thenReturn(context);
        Mockito.when(im.getFactory()).thenReturn(factory);

        DependencyHandler handler = (DependencyHandler) Mockito.mock(DependencyHandler.class);
        Mockito.when(handler.getInstanceManager()).thenReturn(im);
        Logger logger = new Logger(context, "test", Logger.INFO);
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.InstanceManager

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.