Examples of DriverLocator


Examples of org.osgi.service.device.DriverLocator

    public void findDriversWithDriverLocators()
    {

        List<DriverLocator> locators = new ArrayList<DriverLocator>();

        DriverLocator dl1 = tstExpectDriverIdsFor(
            new String[]{ "org.apache.felix.driver-1.0", "org.apache.felix.driver-1.1" } );
        locators.add( dl1 );
       
        DriverLocator dl2 = tstExpectDriverIdsFor(
            new String[]{ "org.apache.felix.driver-1.2", "org.apache.felix.driver-1.3" } );
        locators.add( dl2 );
       
        DriverLocator dl3 = tstExpectDriverIdsFor( null );
        locators.add( dl3 );

       
        Properties dict = new Properties();
        Set<String> driverIds = m_loader.findDrivers( locators, dict );
View Full Code Here

Examples of org.osgi.service.device.DriverLocator

    {

        Properties dict = new Properties();
        List<DriverLocator> locators = new ArrayList<DriverLocator>();

        DriverLocator dl = Mockito.mock( DriverLocator.class, "dl" );
        locators.add( dl );

        Mockito.when( dl.findDrivers( Mockito.eq( dict ) ) ).thenThrow( new RuntimeException( "test exception" ) );

        Set<String> driverIds = m_loader.findDrivers( locators, dict );

        Assert.assertTrue( "should be an empty list", driverIds.size() == 0 );
View Full Code Here

Examples of org.osgi.service.device.DriverLocator

    public void loadDrivers() throws IOException, BundleException
    {

        List<DriverLocator> locators = new ArrayList<DriverLocator>();

        DriverLocator dl = Mockito.mock( DriverLocator.class, "dl" );
        locators.add( dl );

        String[] driverIds = new String[]
            { "org.apache.felix.driver-1.0", "org.apache.felix.driver-1.1", };

        for ( String string : driverIds )
        {
            Mockito.when( dl.loadDriver( Mockito.eq( string ) ) ).thenReturn( null );
            Bundle bundle = Mockito.mock( Bundle.class );
           
            Mockito.when( m_context.installBundle( "_DD_" + string, null ) ).thenReturn( bundle );
            bundle.start();
           
View Full Code Here

Examples of org.osgi.service.device.DriverLocator

    public void loadDrivers_LoadFails() throws IOException, BundleException
    {

        List<DriverLocator> locators = new ArrayList<DriverLocator>();

        DriverLocator dl = Mockito.mock( DriverLocator.class, "dl" );
        locators.add( dl );

        String[] driverIds = new String[]
            { "org.apache.felix.driver-1.0", "org.apache.felix.driver-1.1", };

        for ( String string : driverIds )
        {
            Mockito.when( dl.loadDriver( string ) ).thenThrow( new IOException( "test exception" ) );
        }

        List<ServiceReference> refs = m_loader.loadDrivers( locators, driverIds );

        Assert.assertEquals( "", 0, refs.size() );
View Full Code Here

Examples of org.osgi.service.device.DriverLocator

    public void loadDrivers_InstallFails() throws IOException, BundleException
    {

        List<DriverLocator> locators = new ArrayList<DriverLocator>();

        DriverLocator dl = Mockito.mock( DriverLocator.class, "dl" );
        locators.add( dl );

        String[] driverIds = new String[]
            { "org.apache.felix.driver-1.0", "org.apache.felix.driver-1.1", };

        for ( String string : driverIds )
        {
          Mockito.when( dl.loadDriver( string ) ).thenReturn( null );
          Mockito.when( m_context.installBundle( DriverLoader.DRIVER_LOCATION_PREFIX + string, null ) )
            .thenThrow(new BundleException( "test exception" ) );
        }

        List<ServiceReference> refs = m_loader.loadDrivers( locators, driverIds );
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.