Examples of EclipseDeviceRepository


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

    public void testMoveDeviceToInvalidChild() throws Throwable {
        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);

                Element pc = null;
                try {
                    pc = (Element) PrivateAccessor.invoke(
                            accessor,
                            "getHierarchyDeviceElement",
                            new Class[]{String.class},
                            new String[]{"PC"});
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }

                assertNotNull("PC device does not exist");
                Element pcParent = pc.getParent();
                try {
                    // try to move the master so that it is a child of PC. This should
                    // throw an IllegalAddException
                    accessor.moveDevice("Master", "PC");
                    fail("RepositoryException was not thrown when moving a device " +
                            "whose parent is a child of the device being moved");
                } catch (IllegalArgumentException e) {
                    // expected
                }
View Full Code Here

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

    public void testMoveDevice() throws Throwable {
        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);

                // move the PC device to TV
                Element pc = null;
                try {
                    pc = (Element) PrivateAccessor.invoke(
                            accessor,
                            "getHierarchyDeviceElement",
                            new Class[]{String.class},
                            new String[]{"PC"});
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }
                // check that the TV device is not already the parent of the PC
                assertNotEquals(pc.getParent().getAttributeValue(
                        DeviceRepositorySchemaConstants.
                        DEVICE_NAME_ATTRIBUTE),
                        "TV");
                // do the move
                accessor.moveDevice("PC", "TV");
                // check that the TV device is the new parent of the PC device
                assertEquals("Device was not moved",
                        "TV",
                        pc.getParent().getAttributeValue(
                                DeviceRepositorySchemaConstants.
View Full Code Here

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

                new TestDeviceRepositoryCreator());
        manager.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {
                // Don't need a test instance for the static test but to test that
                // the static test hasn't altered any state an instance is required
                EclipseDeviceRepository originalRepository = new
                        EclipseDeviceRepository(repository.getPath(),
                                transformerMetaFactory, jdomFactory, false,
                                true, null);

                // Grab the originalDocument before anything is executed so that it can
View Full Code Here

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

        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);
                // Grab the document
                Document document = accessor.getDeviceTACIdentificationDocument();
                assertNotNull("TAC identification document should be non-null",
                        document);
                Element rootEl = document.getRootElement();
                assertEquals("Root element must have expected number of children",
                        5, rootEl.getChildren().size());
View Full Code Here

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

        }

        XMLFilter xmlFilter = isAdminProject ?
                EclipseDeviceRepository.STANDARD_ELEMENT_FILTER : null;

        accessor = new EclipseDeviceRepository(deviceRepository,
                transformerMetaFactory, jdomFactory, false, false, xmlFilter);

        deviceRepositoryName = deviceRepository;
    }
View Full Code Here

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

                    "deviceRepository");
        }
        if (factory == null) {
            throw new IllegalArgumentException("factory cannot be null");
        }
        accessor = new EclipseDeviceRepository(deviceRepository, factory,
                false, false, null);

        deviceRepositoryName = deviceRepository.getArchiveFileName();
        this.factory = factory;
    }
View Full Code Here

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

    private static EclipseDeviceRepository updateHierarchy(
            InputStream inputHierarchy,
            String filename,
            XMLFilter filter) throws Exception {

        EclipseDeviceRepository accessor =
                new EclipseDeviceRepository(filename,
                        transformerMetaFactory, jdomFactory, true, true,
                        filter);

        Document document = accessor.createNewDocument(inputHierarchy);
        PrivateAccessor.setField(
                accessor, "xmlHierarchyDocument", document);
        return accessor;
    }
View Full Code Here

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

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

                assertEquals("Root device name should match",
                        "Master",
                        accessor.getRootDeviceName());

                assertEquals("Root device number of children should match", 6,
                        accessor.getChildDeviceNames("Master").size());
            }
        });
    }
View Full Code Here

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

        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());

                writeRepository(accessor);

                // Verify that the hierarchy is what we expect.
View Full Code Here

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

        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
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.