Package com.volantis.devrep.repository.accessors

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


    public void notestRenameDevice() throws Exception {
        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);
                try {
                    accessor.renameDevice(null, null);
                    fail("Expected an IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    // success
                }

                try {
                    accessor.renameDevice("PC", null);
                    fail("Expected an IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    // success
                }

                try {
                    accessor.renameDevice("xxx", "WP");
                    fail("RepositoryException expected");
                } catch (RepositoryException e) {
                    // success
                }

                accessor.renameDevice("PC", "PeeCee");
                assertFalse("PC should not be found",
                        accessor.deviceExists("PC"));
                assertTrue("PeeCee should be found",
                        accessor.deviceExists("PeeCee"));

                accessor.renameDevice("WAP-Handset", "WP");
                assertFalse("WAP-Handset should not be found",
                        accessor.deviceExists("WAP-Handset"));
                assertTrue("WP should be found",
                        accessor.deviceExists("WP"));

                // Save the repository contents.
                writeRepository(accessor);

                // Read the contents back to verify them.
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);
                try {
                    accessor.removeDevice(null);
                    fail("Expected an IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    // expected
                }

                try {
                    accessor.removeDevice("xxx");
                    fail("Expected an RepositoryException");
                } catch (RepositoryException e) {
                    // expected
                }

                try {
                    accessor.removeDevice("PC");
                } catch (RepositoryException e) {
                    fail("Did not expect a RepositoryException");
                    e.printStackTrace();
                }
View Full Code Here

    /**
     * Test the exists method.
     */
    public void testExists() throws Exception {
        try {
            new EclipseDeviceRepository(null,
                    transformerMetaFactory, jdomFactory, null);
            fail("Illegal Argument Exception should've been thrown");
        } catch (IllegalArgumentException e) {
            // success
        }

        try {
            new EclipseDeviceRepository(null,
                    jdomFactory);
            fail("Illegal Argument Exception should've been thrown");
        } catch (IllegalArgumentException e) {
            // success
        }
View Full Code Here

                new ResourceTemporaryFileCreator(this.getClass(),
                        "repository_empty.zip"));
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                try {
                    new EclipseDeviceRepository(repository.getPath(),
                            transformerMetaFactory, jdomFactory, null);
                    fail("Expected Repository Exception (ZipExcepiton)");
                } catch (RepositoryException e) {
                    // success
                }
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, false, true, null);
                // Create a list of all policy names.
                List propsList = new ArrayList();
                Properties props = accessor.getProperties();
                Enumeration propsEnum = props.propertyNames();
                while (propsEnum.hasMoreElements()) {
                    propsList.add(propsEnum.nextElement());
                }
View Full Code Here

                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File file) throws Exception {
                MDPRArchiveAccessor archiveAccessor = new MDPRArchiveAccessor(
                        file.getPath(), transformerMetaFactory);
                EclipseDeviceRepository accessor =
                        new EclipseDeviceRepository(archiveAccessor,
                                jdomFactory,
                                false,
                                true,
                                null);
                try {
View Full Code Here

        try {
            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, false, true, null);

                    accessor.moveDevice(null, "parent");
                    fail("IllegalArgumentException was not thrown for null device");
                }
            });
        } catch (IllegalArgumentException e) {
            // expected
View Full Code Here

        try {
            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, false, true, null);

                    accessor.moveDevice("device", null);
                    fail("IllegalArgumentException was not thrown for null parent");
                }
            });
        } catch (IllegalArgumentException e) {
            // expected
View Full Code Here

        try {
            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, false, true, null);

                    accessor.moveDevice("doesNotExistDevice", "parent");
                    fail("RepositoryException was not thrown for non existent device");
                }
            });
        } catch (RepositoryException e) {
            // expected
View Full Code Here

        try {
            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, false, true, null);

                    accessor.moveDevice("Master", "doesNotExistDevice");
                    fail("RepositoryException was not thrown for non existent parent");
                }
            });
        } catch (RepositoryException e) {
            // expected
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.