Package org.osgi.service.device

Examples of org.osgi.service.device.Driver


    }


    private Driver tstCreateDriver( Properties p ) throws Exception
    {
        Driver driver = Mockito.mock( Driver.class );
       
        ServiceReference ref = m_osgi.registerService(
            new String[]{ Driver.class.getName() }, driver, p );

        MatchAnswer answer = new MatchAnswer( ref );

        Mockito.when( driver.match( Mockito.isA( ServiceReference.class ) ) )
          .thenAnswer( answer );
       
        Bundle bundle = m_osgi.getBundle( ref );
        Mockito.when( bundle.getLocation() )
          .thenReturn(
View Full Code Here


        Bundle bundle = Mockito.mock( Bundle.class, "driverBundle" );
        Mockito.when( m_context.installBundle(
            Mockito.eq( "_DD_" + driverId ), Mockito.eq( in ) ) )
            .thenReturn( bundle );

        final Driver driver = tstCreateDriver( driverId, match );
        final ServiceReference driverRef = m_osgi.getReference( driver );

        Answer<Object> answer = new Answer<Object>()
        {
         
View Full Code Here

          .thenAnswer( answer );

        int i = 0;
        for ( String driverId : driverIds )
        {
            Driver driver = tstExpectInstallDriverBundle( driverId, matches[i], streams.get( driverId ) );
            drivers.put( driverId, driver );
            i++;
        }

        return drivers;
View Full Code Here

     */
    @Test
    public void DriverAdded() throws Exception
    {

        Driver driver = tstCreateDriver( "org.apache.felix.driver-1.0", 1 );

        m_manager.driverAdded( m_osgi.getReference( driver ), driver );

    }
View Full Code Here

     */
    @Test
    public void DriverRemoved() throws Exception
    {

        Driver driver = tstCreateDriver( "org.apache.felix.driver-1.0", 1 );

        ServiceReference ref = m_osgi.getReference( driver );

        m_manager.driverAdded( ref, driver );
        m_manager.driverRemoved( ref );
View Full Code Here

    @Test
    public void DeviceAddedNoDriverLocatorSuccessfulAttach() throws Exception
    {

        Device device = tstCreateDevice( new String[] { "org.apache.felix" } );
        Driver driver = tstCreateDriver( "org.apache.felix.driver-1.0", 1 );

        CountDownLatch attachLatch = tstExpectAttach( driver, device );

        m_manager.driverAdded( m_osgi.getReference( driver ), driver );
        m_manager.deviceAdded( m_osgi.getReference( device ), device );
View Full Code Here

    @Test
    public void DeviceAddedNoDriverLocatorAttachFails() throws Exception
    {

        Device device = tstCreateDevice( new String[] { "org.apache.felix" } );
        Driver driver = tstCreateDriver( "org.apache.felix.driver-1.0", Device.MATCH_NONE );

        CountDownLatch attachLatch = tstExpectNoDriverFound( device );

        m_manager.driverAdded( m_osgi.getReference( driver ), driver );
        m_manager.deviceAdded( m_osgi.getReference( device ), device );
View Full Code Here

        Map<String, Driver> drivers = tstExpectDriverLocatorFor( locator,
        new String[] { driverId1, driverId2 },
        new int[] { 30, 3 } );

        Driver noMatcher = tstCreateDriver( notMatchingButLoadedDriverId, 100 );

        Device device = tstCreateDevice( new String[]{ "org.apache.felix" } );

        final CountDownLatch attachLatch = tstExpectAttach( drivers.get( driverId1 ), device );
View Full Code Here

        Map<String, Driver> drivers = tstExpectDriverLocatorFor( locator,
        new String[] { driverId1, driverId2 },
        new int[] { 30, 3 } );

        Driver noMatcher = tstCreateDriver( notMatchingButLoadedDriverId, 100 );

        Device device = tstCreateDevice( new String[]{ "org.apache.felix" } );

        final CountDownLatch attachLatch = tstExpectAttach( drivers.get( driverId1 ), device );
View Full Code Here

        Mockito.when( m_context.installBundle(
            Mockito.anyString(),
            Mockito.isA( InputStream.class ) ) )
          .thenThrow(new BundleException( "test exception" ) );

        Driver matched = drivers.get( "org.apache.felix.driver-1.0" );

        final CountDownLatch latch = new CountDownLatch( 1 );

        Answer<String> driver10_attach = new Answer<String>()
        {
            public String answer(InvocationOnMock invocation) throws Throwable
            {
              System.out.println("driver10_attach()");
                latch.countDown();
                return referredDriver;
            }
        };

        Device device = tstCreateDevice( new String[]{ "org.apache.felix" } );
       

        Mockito.when( matched.match( m_osgi.getReference( device ) ) ).thenReturn( 10 );

        Mockito.when( matched.attach( Mockito.isA( ServiceReference.class ) ) )
          .thenAnswer( driver10_attach );

//        for ( String driverId : driverIds )
//        {
//            Driver driver = drivers.get( driverId );
View Full Code Here

TOP

Related Classes of org.osgi.service.device.Driver

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.