Package com.volantis.mcs.devices

Examples of com.volantis.mcs.devices.DeviceRepository


                URL deviceRepositoryUrl = file.toURL();

                // Try getting the value from a device repository with the
                // experimental policies non-accessible
                {
                    DeviceRepository repository = getDeviceRepository(deviceRepositoryUrl, false);

                    PolicyDescriptor descriptor = repository.getPolicyDescriptor(
                            "x-experimental-policy", Locale.getDefault());
                    assertNull("Policy descriptor should not be found", descriptor);
                }

                // Try getting the value from a device repository with the
                // experimental policies accessible
                {
                    DeviceRepository repository = getDeviceRepository(deviceRepositoryUrl, true);

                    PolicyDescriptor descriptor = repository.getPolicyDescriptor(
                            "x-experimental-policy", Locale.getDefault());
                    assertNotNull("Policy descriptor should be found", descriptor);
                }
            }
        });
View Full Code Here


            public void execute(File file) throws Exception {

                DeviceRepositoryFactory factory =
                            DeviceRepositoryFactory.getDefaultInstance();
                URL deviceRepositoryUrl = file.toURL();
                DeviceRepository repository = factory.getDeviceRepository(
                        deviceRepositoryUrl, null);

                // Test match pattern*
                String pattern = "Nokia-3*";
                List actual = repository.getDevices(pattern);

                // Create expected values based on the pattern
                String[] expected = new String[] {
//                    "Nokia-3280",
//                    "Nokia-3589i",
                    "Nokia-3350",
                    "Nokia-3410",
//                    "Nokia-3510",
//                    "Nokia-3510_m",
//                    "Nokia-3510i",
//                    "Nokia-3510i_m",
//                    "Nokia-3530",
//                    "Nokia-3530_m",
//                    "Nokia-3585i",
//                    "Nokia-3610",
                    "Nokia-3330",
                    "Nokia-3360",
//                    "Nokia-3620",
//                    "Nokia-3620_m",
//                    "Nokia-3650",
//                    "Nokia-3650-Opera6",
//                    "Nokia-3650_m",
//                    "Nokia-3660",
//                    "Nokia-3660_m",
//                    "Nokia-3600",
//                    "Nokia-3600_m",
//                    "Nokia-3100",
//                    "Nokia-3100_m",
//                    "Nokia-3108",
//                    "Nokia-3108_m",
//                    "Nokia-3200",
//                    "Nokia-3200_m",
//                    "Nokia-3300",
//                    "Nokia-3300-1",
//                    "Nokia-3300-2",
//                    "Nokia-3300_m",
//                    "Nokia-3560",
//                    "Nokia-3590",
//                    "Nokia-3590_m",
//                    "Nokia-3595",
//                    "Nokia-3595_m",
//                    "Nokia-3520"
                };

                // Check success of test
                assertNotNull("Should be some devices (1)", actual);
                // NOTE: convert to set so order is not relied on.
                assertEquals("Actual and expected arrays should match (1)",
                            Arrays.asList(expected), actual);

                // Test match *pattern
                pattern = "*400";
                actual = repository.getDevices(pattern);

                // Create expected values based on the pattern
                expected = new String[] {
//                    "LG-G5400",
                    "Samsung-SPH-A400",
//                    "Samsung-SGH-T400",
//                    "Samsung-SGH-P400",
                    "Samsung-SGH-A400",
                    "Samsung-SGH-N400",
//                    "Sanyo-SCP-5400",
//                    "Sanyo-SCP-6400",
//                    "Motorola-V400",
//                    "Samsung-SPH-N400"
                };

                // Check success of test
                assertNotNull("Should be some devices (2)", actual);
                // NOTE: convert to set so order is not relied on.
                assertEquals("Actual and expected arrays should match (2)",
                           Arrays.asList(expected), actual);

                // Test match pattern (no wildcards)
                pattern = "Master";
                actual = repository.getDevices(pattern);

                // Create expected values based on the pattern
                expected = new String[] {
                    "Master"
                };
View Full Code Here

            public void execute(File file) throws Exception {

                DeviceRepositoryFactory factory =
                            DeviceRepositoryFactory.getDefaultInstance();
                URL deviceRepositoryUrl = file.toURL();
                DeviceRepository repository = factory.getDeviceRepository(
                        deviceRepositoryUrl, null);

                String deviceName = "Master";

                Device device = repository.getDevice(deviceName);
                assertEquals("Name should match: ", deviceName, device.getName());

                PolicyValue value = device.getRealPolicyValue("realvidinpage");
                assertNotNull(value);
            }
View Full Code Here

                "latest-devices.mdpr",
                DeviceRepositoryConstants.REPOSITORY_EXTENSION);

        URL deviceRepositoryUrl = deviceRepositoryFile.toURL();

        DeviceRepository deviceRepository =
                factory.getDeviceRepository(deviceRepositoryUrl, null);

        List devicesWithXWAPProfileSecondaryIDs = new ArrayList();
        devicesWithXWAPProfileSecondaryIDs.add("Palm-Blazer");
        devicesWithXWAPProfileSecondaryIDs.add("Blazer-3_0");
        devicesWithXWAPProfileSecondaryIDs.add("XHTML-Handset");
        devicesWithXWAPProfileSecondaryIDs.add("Samsung-SprintPCS");

        List devices = deviceRepository.getDevices("*");
        for (int i = 0; i < devices.size(); i++) {
            DefaultDevice device = (DefaultDevice) deviceRepository.getDevice(
                    (String)devices.get(i));
            if (device.getSecondaryIDHeaderName() != null) {
                if (DevicesHelper.X_WAP_PROFILE.equals(
                        device.getSecondaryIDHeaderName())) {
                    assertTrue("Secondary device ID should match",
View Full Code Here

        // No device in the session, so we need to ID it.
        if(device == null) {

            // Use the device repository to retrieve the device.
            DeviceRepository deviceRepository;
            try {
                deviceRepository = getRuntimeDeviceRepository();

                HttpHeaders headers = servletFactory.getHTTPHeaders(request);
                String defaultDeviceName = volantisBean.getDevicesConfiguration().getDefaultDeviceName();

                // null value of defaultDeviceName is OK, it means that
                // we let DeviceRepository subsystem use its own default               
                device = (DefaultDevice) deviceRepository
                        .getDevice(headers, defaultDeviceName);
            }
            catch(DeviceRepositoryException e) {
                throw new RepositoryException(e);
            }
View Full Code Here

            Project project = createProject(destinationRepository,
                    repositoryString);

            printValue(cmd, DEVICE_REPOSITORY);
            String deviceRepositoryString = cmd.getOptionValue(DEVICE_REPOSITORY);
            DeviceRepository deviceRepository = createDeviceRepository(
                    deviceRepositoryString);

            // Now create the asset loader since we have the minimum
            // requirements.
View Full Code Here

        final XMLDeviceRepositoryConfiguration configuration =
            repositoryFactory.createXMLDeviceRepositoryConfiguration();
        try {
            configuration.setRepositoryURL(
                new File(deviceRepositoryFileName).toURL());
            final DeviceRepository deviceRepository =
                repositoryFactory.createDeviceRepository(configuration);
            return deviceRepository;
        } catch (MalformedURLException e) {
            throw new RepositoryException(e);
        } catch (DeviceRepositoryException e) {
View Full Code Here

TOP

Related Classes of com.volantis.mcs.devices.DeviceRepository

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.