Package com.volantis.mcs.repository

Examples of com.volantis.mcs.repository.RepositoryEnumeration


                             boolean removeChildren)
            throws RepositoryException {

        if (removeChildren) {

            RepositoryEnumeration children = enumerateDevicesChildren(connection,
                                                                      deviceName);
            try {
                while (children.hasNext()) {
                    String childName = (String) children.next();
                    removeDevice(connection, childName, removeChildren);
                }
            } finally {
                children.close();
            }
        }
        // Remove it from the repository first.
        removeDeviceImpl(connection, deviceName);
View Full Code Here


        // Build the regular expression to use
        Pattern expression = Pattern.compile(regexp);

        // Retrieve all the device names
        RepositoryEnumeration enumeration = enumerateDeviceNames(connection);

        // Check each device name returned against the expression and
        // store those that match to be returned
        while (enumeration.hasNext()) {
            String name = (String) enumeration.next();
            if (allDevices || expression.matcher(name).matches()) {
                deviceNames.add(name);
            }
        }
View Full Code Here

        String deviceName;
        String fallbackName;

        // Enumerate all the devices and their fallbacks and populate the hash
        // table.
        RepositoryEnumeration e = enumerateDeviceFallbacks(connection);
        try {
            while (e.hasNext()) {
                String[] pair = (String[]) e.next();
                deviceName = pair[0];
                fallbackName = pair[1];
                deviceToFallback.put(deviceName, fallbackName);
            }
        } finally {
            e.close();
        }

        // Now enumerate through the table finding any devices whose fallback is
        // not in the table and add them to the list.
        List orphaned = new ArrayList();
View Full Code Here

            throws RepositoryException {
        Map cache = null;
        synchronized (this) {
            if (tacCache == null) {
                cache = new HashMap();
                RepositoryEnumeration deviceTACPairs =
                        enumerateDeviceTACs(connection);
                while (deviceTACPairs.hasNext()) {
                    DeviceTACPair pair = (DeviceTACPair) deviceTACPairs.next();
                    cache.put(new TACValue(pair.getTAC()),
                              pair.getDeviceName());
                }
                tacCache = cache;
            } else {
View Full Code Here

                AbstractDeviceRepositoryAccessor accessor =
                        createAccessor(deviceRepositoryFile);

                Set expectedPatterns = getExpectedDevicePatterns();

                RepositoryEnumeration actualEnum =
                    accessor.enumerateDevicePatterns(createConnection());

                Set actualPatterns = new HashSet();

                while (actualEnum.hasNext()) {
                    String[] pair = (String[])actualEnum.next();
                    actualPatterns.add(new StringPair(pair[0], pair[1]));
                }

                assertEquals("the pattern enumeration is not as",
                             expectedPatterns,
View Full Code Here

                        createAccessor(deviceRepositoryFile);

                // Create a test connection
                RepositoryConnection connection = createConnection();

                RepositoryEnumeration enumeration = accessor.enumeratePolicyNames(connection);

                // Check successful operation of the enumeration
                assertNotNull("Enumeration over retrieved items should exist", enumeration);
                assertTrue("Should be items in the enumeration", enumeration.hasNext());

                // Create a list of returned results
                List results = new ArrayList();
                while (enumeration.hasNext()) {
                    results.add(enumeration.next());
                }

                // Expected results
                String[] expected = new String[] {
                    "java",
View Full Code Here

                        createAccessor(deviceRepositoryFile);

                // Create a test connection
                final RepositoryConnection connection = createConnection();

                final RepositoryEnumeration enumeration =
                    accessor.enumerateCategoryNames(connection);

                // Check successful operation of the enumeration
                assertNotNull("Enumeration over retrieved items should exist", enumeration);
                assertTrue("Should be items in the enumeration", enumeration.hasNext());

                // Create a list of returned results
                final List results = new ArrayList();
                while (enumeration.hasNext()) {
                    results.add(enumeration.next());
                }

                // Expected results
                final String[] expected =
                    new String[] {"system", "browser", "protocol", "custom"};
View Full Code Here

                AbstractDeviceRepositoryAccessor accessor =
                        createAccessor(deviceRepositoryFile);

                RepositoryConnection connection = createConnection();

                RepositoryEnumeration enumeration = accessor.enumerateDeviceTACs(connection);
                assertTrue("Enumeration should contain elements", enumeration.hasNext());
                DeviceTACPair dtp = (DeviceTACPair) enumeration.next();
                assertEquals("First device name should match 'Nokia-6210'",
                        "Nokia-6210", dtp.getDeviceName());
                assertEquals("First device TAC should match '350612'",
                        350612, dtp.getTAC());
                int deviceTacCount = 1;
                while (enumeration.hasNext()) {
                    enumeration.next();
                    deviceTacCount += 1;
                }
                assertEquals("Repository should contain expected number of TACs", 3,
                        deviceTacCount);
            }
View Full Code Here

                AbstractDeviceRepositoryAccessor accessor =
                        createAccessor(deviceRepositoryFile);

                RepositoryConnection connection = createConnection();

                RepositoryEnumeration enumeration = accessor.enumerateDeviceTACs(connection);
                assertFalse("With no TAC data, enumeration should be empty",
                        enumeration.hasNext());
            }
        });
    }
View Full Code Here

                        createAccessor(deviceRepositoryFile);

                // Create a test connection
                RepositoryConnection connection = createConnection();

                RepositoryEnumeration enumeration = accessor.enumeratePolicyNames(connection,
                                                                           "system");

                // Check successful operation of the enumeration
                assertNotNull("Enumeration over retrieved items should exist", enumeration);
                assertTrue("Should be items in the enumeration", enumeration.hasNext());

                // Create a list of returned results
                List results = new ArrayList();
                while (enumeration.hasNext()) {
                    results.add(enumeration.next());
                }

                // Expected results
                String[] expected = new String[] {
                    "java"
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.RepositoryEnumeration

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.