Examples of MockBundleContext


Examples of org.apache.felix.cm.MockBundleContext

    }


    public void testLogSetup()
    {
        final MockBundleContext bundleContext = new MockBundleContext();
        ConfigurationManager configMgr = createConfigurationManager( null );

        // ensure the configuration data goes to target
        bundleContext.setProperty( "felix.cm.dir", "target/config" );

        // default value is 2
        bundleContext.setProperty( "felix.cm.loglevel", null );
        configMgr.start( bundleContext );
        assertEquals( 2, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        // illegal number yields default value
        bundleContext.setProperty( "felix.cm.loglevel", "not-a-number" );
        configMgr.start( bundleContext );
        assertEquals( 2, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        bundleContext.setProperty( "felix.cm.loglevel", "-100" );
        configMgr.start( bundleContext );
        assertEquals( -100, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        bundleContext.setProperty( "felix.cm.loglevel", "4" );
        configMgr.start( bundleContext );
        assertEquals( 4, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );
    }
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

        try
        {
            Field field = configMgr.getClass().getDeclaredField( "logTracker" );
            field.setAccessible( true );
            field.set( configMgr, new ServiceTracker( new MockBundleContext(), "", null )
            {
                public Object getService()
                {
                    return logService;
                }
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    }


    Bundle createBundle( final String symbolicName, final Version version, final String location )
    {
        BundleContext ctx = new MockBundleContext();
        return new MockBundle( ctx, location )
        {
            public String getSymbolicName()
            {
                return symbolicName;
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    {

        // ensure there is no file
        bindingsFile.delete();

        final BundleContext ctx = new MockBundleContext();
        final DynamicBindings dm = new DynamicBindings( ctx, persistenceManager );
        final Dictionary bindings = getBindings( dm );

        assertNotNull( bindings );
        assertTrue( bindings.isEmpty() );
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    public void test_store_bindings() throws IOException
    {
        // ensure there is no file
        bindingsFile.delete();

        final BundleContext ctx = new MockBundleContext();
        final DynamicBindings dm = new DynamicBindings( ctx, persistenceManager );

        dm.putLocation( PID1, LOCATION1 );
        assertEquals( LOCATION1, dm.getLocation( PID1 ) );
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    {
        // ensure there is no file
        bindingsFile.delete();

        // preset bindings
        final DynamicBindings dm0 = new DynamicBindings( new MockBundleContext(), persistenceManager );
        dm0.putLocation( PID1, LOCATION1 );

        // check bindings
        final BundleContext ctx = new DMTestMockBundleContext();
        final DynamicBindings dm = new DynamicBindings( ctx, persistenceManager );
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    {
        // ensure there is no file
        bindingsFile.delete();

        // preset bindings
        final DynamicBindings dm0 = new DynamicBindings( new MockBundleContext(), persistenceManager );
        dm0.putLocation( PID1, LOCATION1 );

        // check bindings
        final DynamicBindings dm = new DynamicBindings( new MockBundleContext(), persistenceManager );

        // API check
        assertNull( dm.getLocation( PID1 ) );

        // low level check
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

    }


    public void testLogSetup()
    {
        final MockBundleContext bundleContext = new MockBundleContext();
        ConfigurationManager configMgr = createConfigurationManager( null );

        // ensure the configuration data goes to target
        bundleContext.setProperty( "felix.cm.dir", "target/config" );
       
        // default value is 2
        bundleContext.setProperty( "felix.cm.loglevel", null );
        configMgr.start( bundleContext );
        assertEquals( 2, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        // illegal number yields default value
        bundleContext.setProperty( "felix.cm.loglevel", "not-a-number" );
        configMgr.start( bundleContext );
        assertEquals( 2, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        bundleContext.setProperty( "felix.cm.loglevel", "-100" );
        configMgr.start( bundleContext );
        assertEquals( -100, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );

        bundleContext.setProperty( "felix.cm.loglevel", "4" );
        configMgr.start( bundleContext );
        assertEquals( 4, getLogLevel( configMgr ) );
        configMgr.stop( bundleContext );
    }
View Full Code Here

Examples of org.apache.felix.cm.MockBundleContext

        try
        {
            Field field = configMgr.getClass().getDeclaredField( "logTracker" );
            field.setAccessible( true );
            field.set( configMgr, new ServiceTracker( new MockBundleContext(), "", null )
            {
                public Object getService()
                {
                    return logService;
                }
View Full Code Here

Examples of org.apache.felix.metatype.MockBundleContext


    protected void setUp() throws Exception
    {
        super.setUp();
        bundleContext = new MockBundleContext( 10, "org.apache.felix.metatype.Mock" );
        bundleContext.getBundle().start();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.