Package org.osgi.service.io

Examples of org.osgi.service.io.ConnectorService.open()


        Dictionary props = new Hashtable();
        props.put(ConnectionFactory.IO_SCHEME, "file");
        ServiceRegistration registration = registerConnectionFactory(connFactory, props);
        ConnectorService service = getConnectorService();

        Connection connection = service.open("file://test.txt");
        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);
View Full Code Here


        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);

        connection = service.open("file://test.txt", ConnectorService.READ);
        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);
View Full Code Here

        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);

        connection = service.open("file://test.txt", ConnectorService.WRITE);
        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);
View Full Code Here

        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);

        connection = service.open("file://test.txt", ConnectorService.READ, true);
        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ, connFactory.getMode());
        assertEquals(true, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);
View Full Code Here

        assertEquals(true, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);

        try
        {
            connection = service.open("http://test.txt", ConnectorService.READ);
            fail("Connection shouldn't be created");
        } catch (ConnectionNotFoundException e)
        {
            // "expected"
        }
View Full Code Here

            // "expected"
        }

        try
        {
            service.open("file.txt");
            fail("Illegal format of uri");
        } catch (IllegalArgumentException e)
        {
            // expected
        }
View Full Code Here

        props.put(Constants.SERVICE_RANKING, new Integer(Integer.MAX_VALUE));
        registerConnectionFactory(connFactory2, props);

        ConnectorService service = getConnectorService();

        Connection connection = service.open("file://test.txt");
        assertEquals("uri checks for lowest ranking service", null, connFactory.getName());
        assertEquals("file://test.txt", connFactory2.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory2.getMode());
        assertEquals(false, connFactory2.isTimeout());
        assertNotNull("Connection should be created", connection);
View Full Code Here

        ConnectionFactoryMock connFactory2 = new ConnectionFactoryMock();
        ServiceRegistration registration2 = registerConnectionFactory(connFactory2, props);

        ConnectorService service = getConnectorService();

        Connection connection = service.open("file://test.txt");
        assertEquals("uri checks for highest service.id", null, connFactory2.getName());
        assertEquals("uri checks for lowest service.id", "file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned Connection", connection);
View Full Code Here

        props.put(ConnectionFactory.IO_SCHEME, new String[]
        { "file", "http", "sms" });
        ServiceRegistration registration = registerConnectionFactory(connFactory, props);
        ConnectorService service = getConnectorService();

        Connection connection = service.open("file://test.txt");
        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned connection", connection);
View Full Code Here

        assertEquals("file://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ_WRITE, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned connection", connection);

        connection = service.open("http://test.txt", ConnectorService.READ);
        assertEquals("http://test.txt", connFactory.getName());
        assertEquals(ConnectorService.READ, connFactory.getMode());
        assertEquals(false, connFactory.isTimeout());
        assertNotNull("checks returned connection", connection);
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.