Examples of DeviceIdentificationResult


Examples of com.volantis.devrep.repository.api.devices.DeviceIdentificationResult

        DefaultDevice device = null;
        if (headers != null) {
            try {
                RepositoryConnection connection = repository.connect();
                try {
                    final DeviceIdentificationResult identificationResult =
                        DevicesHelper.getDevice(
                            connection, headers, accessor, unknownDevicesLogger, defaultDeviceName);
                    device = identificationResult.getDevice();
                    if (device != null) {
                        device.setIdentificationHeaderNames(
                            identificationResult.getHeaderNamesUsed());
                    }
                } finally {
                    repository.disconnect(connection);
                }
            } catch (RepositoryException e) {
View Full Code Here

Examples of com.volantis.devrep.repository.api.devices.DeviceIdentificationResult

        // NN-profile header
        headers.addHeader("Opt",
            "http://www.w3.org/1999/06/24-CCPPexchange;ns=13");
        headers.addHeader("13-profile", "http://test.com");

        final DeviceIdentificationResult identificationResult =
            DevicesHelper.getDevice(connectionMock, headers, accessorMock, null);
        final Device device = identificationResult.getDevice();

        // right device is returned
        assertEquals("secondary device name", device.getName());
        // identificationResult.getHeaderNamesUsed() contains the headers used
        // for NN-profile check
        assertTrue(
            identificationResult.getHeaderNamesUsed().contains("13-profile"));
        assertTrue(
            identificationResult.getHeaderNamesUsed().contains("Opt"));
    }
View Full Code Here

Examples of com.volantis.devrep.repository.api.devices.DeviceIdentificationResult

        // initial user agent string
        headers.addHeader("User-Agent", "ua string");
        // NN-profile header
        headers.addHeader("13-profile", "http://test.com");

        final DeviceIdentificationResult identificationResult =
            DevicesHelper.getDevice(connectionMock, headers, accessorMock, null);
        final Device device = identificationResult.getDevice();

        // right device is returned
        assertEquals("secondary device name", device.getName());
        // identificationResult.getHeaderNamesUsed() contains the headers used
        // for NN-profile check
        assertTrue(
            identificationResult.getHeaderNamesUsed().contains("13-profile"));
        assertTrue(
            identificationResult.getHeaderNamesUsed().contains("Opt"));
    }
View Full Code Here

Examples of com.volantis.devrep.repository.api.devices.DeviceIdentificationResult

        headers.addHeader("Opt",
            "http://www.w3.org/1999/06/24-CCPPexchange;ns=19");
        headers.addHeader("13-profile", "http://test13.com");
        headers.addHeader("19-profile", "http://test19.com");

        final DeviceIdentificationResult identificationResult =
            DevicesHelper.getDevice(connectionMock, headers, accessorMock, null);
        final Device device = identificationResult.getDevice();

        // it doesn't matter which device is returned
        assertTrue(device == deviceMock2a || device == deviceMock2b);
        // identificationResult.getHeaderNamesUsed() contains the headers used
        // for NN-profile check
        final Collection headerNamesUsed =
            identificationResult.getHeaderNamesUsed();
        assertTrue(headerNamesUsed.contains("Opt"));
        // must contain at least one *-profile header
        String profileHeaderName = null;
        for (Iterator iter = headerNamesUsed.iterator(); iter.hasNext(); ) {
            final String headerName = (String) iter.next();
            if (headerName.endsWith("-profile")) {
                profileHeaderName = headerName;
            }
        }
        assertNotNull(profileHeaderName);
        assertTrue(profileHeaderName.equals("13-profile") ||
            profileHeaderName.equals("19-profile"));

        //now try it again with different Opt header order
        headers = HttpFactory.getDefaultInstance().createHTTPHeaders();
        // initial user agent string
        headers.addHeader("User-Agent", "ua string");
        // NN-profile header
        headers.addHeader("Opt",
            "http://www.w3.org/1999/06/24-CCPPexchange;ns=19");
        headers.addHeader("Opt",
            "http://www.w3.org/1999/06/24-CCPPexchange;ns=13");
        headers.addHeader("13-profile", "http://test13.com");
        headers.addHeader("19-profile", "http://test19.com");

        final DeviceIdentificationResult identificationResult2 =
            DevicesHelper.getDevice(connectionMock, headers, accessorMock, null);
        // identified the same device
        assertTrue(device.getName().equals(
            identificationResult2.getDevice().getName()));
        // used the same headers to identify the device
        assertEquals(
            headerNamesUsed, identificationResult2.getHeaderNamesUsed());
    }
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.