Package com.volantis.devrep.repository.accessors

Examples of com.volantis.devrep.repository.accessors.EclipseDeviceRepository$DeviceRepositoryQuery


        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                // Create a temporary repository which will be deleted later.
                EclipseDeviceRepository accessor = updateHierarchy(
                        getHierarchy(), repository.getPath());

                // Should write the repository atomically (preserve original if
                // write fails).
                writeRepository(accessor);
View Full Code Here


        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                // Create a temporary repository which will be deleted later.
                EclipseDeviceRepository accessor = updateHierarchy(
                        getHierarchy(), repository.getPath());

                // Should write the repository atomically (preserve original if
                // write fails).
                writeRepository(accessor);
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                // Create a temporary repository which will be deleted later.
                EclipseDeviceRepository accessor = updateHierarchy(
                        getHierarchy(), repository.getPath());

                // Ensure the file is READ ONLY.
                repository.setReadOnly();
View Full Code Here

        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                MDPRArchiveAccessor archiveAccessor = new MDPRArchiveAccessor(
                        repository.getPath(), transformerMetaFactory);
                final EclipseDeviceRepository writeRepository =
                        new EclipseDeviceRepository(archiveAccessor,
                                jdomFactory,
                                false,
                                true,
                                null);

                // There should not be a pre-existing custom policy properties
                // file.
                boolean existsBefore =
                        archiveAccessor.getArchive().exists(customPolicyProps);
                assertFalse("Custom policies.properties should not exist",
                        existsBefore);

                // Set the custom properties on the accessor.
                PrivateAccessor.setField(writeRepository, "properties", properties);

                // Write out the properties, standard and custom, and save the
                // repository.
                writeRepository.writeProperties();

                if (logger.isDebugEnabled()) {
                    // Print out details about the original repository archive
                    // and copy it to /tmp/r1.zip. This was added to help debug
                    // problems with committing VBM:2004110904.
                    dumpFile(repository, new File("/tmp/r1.zip"));
                }

                writeRepository.saveRepositoryArchive();

                if (logger.isDebugEnabled()) {
                    // Print out details about the modifed repository archive
                    // and copy it to /tmp/r2.zip. This was added to help debug
                    // problems with committing VBM:2004110904.
                    dumpFile(repository, new File("/tmp/r2.zip"));
                }

                // Create a brand new accessor to read the saved modified
                // repository. This ensures starting from a "clean slate".
                final EclipseDeviceRepository readRepository =
                        new EclipseDeviceRepository(archiveAccessor,
                                jdomFactory,
                                false,
                                true,
                                null);

                // The custom policy properties file should now exist, and be the
                // "default".
                boolean existsAfter =
                        archiveAccessor.getArchive().exists(customPolicyProps);
                assertTrue("Custom policies.properties should exist",
                        existsAfter);

                // Check that the customPropertiesPath field is set correctly.
                String actualPath =
                        (String) PrivateAccessor.getField(readRepository,
                                "customPropertiesPath");
                assertEquals("Custom properties file should be the default",
                        customPolicyProps,
                        actualPath);

                final Properties propertiesRead = readRepository.getProperties();

                // Check the custom policy's name is read back
                String name = (String) propertiesRead.get(customNameKey);
                assertEquals("Custom name should be the same",
                        customNameValue, name);
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true, true, null);

                assertEquals("Fallback should match",
                        null,
                        accessor.getFallbackDeviceName(null));

                assertEquals("Fallback should match",
                        "Master",
                        accessor.getFallbackDeviceName("Voice"));

                assertEquals("Fallback should match",
                        null,
                        accessor.getFallbackDeviceName("xxx"));

                assertEquals("Fallback should match",
                        "WAP-Handset",
                        accessor.getFallbackDeviceName("Nokia-WAP"));
            }
        });
    }
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true, true, null);
                // Master should exist
                assertTrue(accessor.deviceExists("Master"));

                // xxx shoudn't exist
                assertFalse(accessor.deviceExists("xxx"));

                // null shouldn't exist
                assertFalse(accessor.deviceExists(null));
            }
        });
    }
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true, true, null);

                // Retrieve the identification using a device that has one.
                Element identification =
                        accessor.retrieveDeviceIdentificationElement("PC");

                assertEquals("The retrieved identication element is not for the" +
                        "PC device.", "PC",
                        identification.getAttributeValue("name"));
            }
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true, true, null);

                // Retrieve the identification using a device that has one.
                Element identification =
                        accessor.retrieveTACDeviceElement("Nokia-6210");

                assertEquals("The retrieved identication element is not for the" +
                        "Nokia-6210 device.", "Nokia-6210",
                        identification.getAttributeValue("name"));
            }
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true, true, null);
                assertEquals("Root device name should match",
                        "Master",
                        accessor.getRootDeviceName());

                accessor = updateHierarchy(getHierarchy("hierarchy-root.xml"));
                assertEquals("Root device name should match",
                        "root",
                        accessor.getRootDeviceName());
            }
        });
    }
View Full Code Here

        TemporaryFileManager manager = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, true,
                                true, null);
                List children;
                children = accessor.getChildDeviceNames(null);
                assertEquals("Child device names should match",
                        null,
                        children);

                children = accessor.getChildDeviceNames("xxx");
                assertEquals("Child device names should match",
                        null,
                        children);

                verifyHierarchy(accessor);

                children = accessor.getChildDeviceNames("NoChildrenDevice");
                assertNull("No children should exist", children);
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.volantis.devrep.repository.accessors.EclipseDeviceRepository$DeviceRepositoryQuery

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.