Package com.volantis.mcs.eclipse.core

Examples of com.volantis.mcs.eclipse.core.DeviceRepositoryAccessorManager


        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new ODOMFactory(), false);

                // Test with two different regular expressions
                checkSelection(manager.selectHierarchyDevices(getTestRE(false)), false);
                checkSelection(manager.selectHierarchyDevices(getTestRE(true)), true);
            }
        });
    }
View Full Code Here


        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new ODOMFactory(), false);

                RE re = new RE("Moz*");
                String selection [] = manager.selectIdentityDevices(re);

                assertNotNull(selection);
                assertTrue(selection.length>0);
                // Ensure PC is in the list.
                boolean foundPC = false;
View Full Code Here

                TransformerMetaFactory transformerMetaFactory =
                        new TestTransformerMetaFactory();

                // 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
                DeviceRepositoryAccessorManager manager =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(), transformerMetaFactory,
                                jdomFactory, false);

                // Grab the accessor before anything is executed so that it can be
                // used for comparison after each static test
View Full Code Here

        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DeviceODOMElementFactory(), false);
                Shell shell = new Shell(Display.getDefault(), SWT.SHELL_TRIM);
                PolicyOriginSelector selector = new PolicyOriginSelector(
                        shell, SWT.NONE, deviceRAM, false);
                PolicyValueModifierFactory factory =
                        new PolicyValueModifierFactory(deviceRAM);

                final String policyName = "pixelsx";
                final String deviceName = "Web-Box";

                UndoRedoMementoOriginator orig =
                        new UndoRedoMementoOriginator() {
                    public UndoRedoMemento takeSnapshot() {
                        return null;
                    }

                    public void restoreSnapshot(UndoRedoInfo undoRedoInfo) {
                    }
                };

                DeviceEditorContext context =
                        DeviceEditorContext.createDeviceEditorContext(
                                new MockFile("name"),
                                orig, deviceRAM);
                final PolicyValueModifier modifier =
                        factory.createPolicyValueModifier(shell, SWT.NONE,
                                policyName);
                controller = new PolicyController(policyName, selector,
                        modifier, null, context);

                final ResolvedDevicePolicy rdpOriginal =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // WebBox falls back to pixelsx from TV.
                assertEquals("WebBox does not inherit pixelsx from TV",
                        "TV", rdpOriginal.deviceName);

                controller.setDeviceName(deviceName);

                // Simulate changing from fallback to override by invoking the private
                // PolicyController#handleOverrideSelection method.
                try {
                    PrivateAccessor.invoke(controller,
                            "handleOverrideSelection", null, null);
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }

                // Retrieve the updated policy.
                final ResolvedDevicePolicy rdpOverride =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx is now overridden by Web-Box.
                assertEquals("WebBox does not override pixelsx from TV",
                        deviceName, rdpOverride.deviceName);
            }
View Full Code Here

        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DeviceODOMElementFactory(), false);
                Shell shell = new Shell(Display.getDefault(), SWT.SHELL_TRIM);
                PolicyOriginSelector selector = new PolicyOriginSelector(
                        shell, SWT.NONE, deviceRAM, false);
                PolicyValueModifierFactory factory =
                        new PolicyValueModifierFactory(deviceRAM);

                final String policyName = "pixelsx";
                final String deviceName = "Microsoft-WebTV";

                UndoRedoMementoOriginator orig =
                        new UndoRedoMementoOriginator() {
                    public UndoRedoMemento takeSnapshot() {
                        return null;
                    }

                    public void restoreSnapshot(UndoRedoInfo undoRedoInfo) {
                    }
                };

                DeviceEditorContext context =
                        DeviceEditorContext.createDeviceEditorContext(
                                new MockFile("name"),
                                orig, deviceRAM);

                final PolicyValueModifier modifier =
                        factory.createPolicyValueModifier(shell, SWT.NONE, policyName);
                controller = new PolicyController(policyName, selector,
                        modifier, null, context);

                final ResolvedDevicePolicy rdpOriginal =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx is overridden by Microsoft-WebTV.
                assertEquals("Microsoft-WebTV does not override pixelsx",
                        deviceName, rdpOriginal.deviceName);

                controller.setDeviceName(deviceName);

                // Simulate changing from override to fallback by invoking the private
                // PolicyController#handleFallbackSelection method.
                try {
                    PrivateAccessor.invoke(controller,
                            "handleFallbackSelection", null, null);
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }

                // Retrieve the updated policy.
                final ResolvedDevicePolicy rdpFallback =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx was overridden by Microsoft-WebTV but now falls back to TV.
                assertEquals("Microsoft-WebTV does not inherit pixelsx from TV",
                        "TV", rdpFallback.deviceName);
            }
View Full Code Here

        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DeviceODOMElementFactory(), false);
                Shell shell = new Shell(Display.getDefault(), SWT.SHELL_TRIM);
                PolicyOriginSelector selector = new PolicyOriginSelector(
                        shell, SWT.NONE, deviceRAM, false);
                PolicyValueModifierFactory factory =
                        new PolicyValueModifierFactory(deviceRAM);

                final String policyName = "pixelsx";
                final String deviceName = "Microsoft-WebTV";

                UndoRedoMementoOriginator orig =
                        new UndoRedoMementoOriginator() {
                    public UndoRedoMemento takeSnapshot() {
                        return null;
                    }

                    public void restoreSnapshot(UndoRedoInfo undoRedoInfo) {
                    }
                };

                DeviceEditorContext context =
                        DeviceEditorContext.createDeviceEditorContext(
                                new MockFile("name"),
                                orig, deviceRAM);

                final PolicyValueModifier modifier =
                        factory.createPolicyValueModifier(shell, SWT.NONE, policyName);
                controller = new PolicyController(policyName, selector,
                        modifier, null, context);

                final ResolvedDevicePolicy rdpOriginal =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx is overridden by Microsoft-WebTV.
                assertEquals("Microsoft-WebTV does not override pixelsx",
                        deviceName, rdpOriginal.deviceName);

                controller.setDeviceName(deviceName);

                // Simulate changing from override to fallback by invoking the private
                // PolicyController#handleFallbackSelection method.
                try {
                    PrivateAccessor.invoke(controller,
                            "handleFallbackSelection", null, null);
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }

                // Retrieve the updated policy.
                final ResolvedDevicePolicy rdpFallback =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx was overridden by Microsoft-WebTV but now falls back to TV.
                assertEquals("Microsoft-WebTV does not inherit pixelsx from TV",
                        "TV", rdpFallback.deviceName);

                // Simulate a Restore by invoking the private
                // PolicyController#handleRestoreSelection method.
                try {
                    PrivateAccessor.invoke(controller,
                            "handleRestoreSelection", null, null);
                } catch (Throwable throwable) {
                    throw new Exception(throwable);
                }

                // Retrieve the updated policy.
                final ResolvedDevicePolicy rdpRestore =
                        deviceRAM.resolvePolicy(deviceName, policyName);

                // pixelsx has now been restored and should be overridden by
                // Microsoft-WebTV.
                assertEquals("Microsoft-WebTV does not override pixelsx",
                        deviceName, rdpRestore.deviceName);
View Full Code Here

        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                JDOM_FACTORY, false);

                final Element policiesElement = JDOM_FACTORY.element(
View Full Code Here

    /**
     * Create the categoriesComposite for this section.
     */
    private void createDisplayArea(String title, String message) {
        DeviceRepositoryAccessorManager dram =
                context.getDeviceRepositoryAccessorManager();
        try {
            context.addRootElement((ODOMElement) dram.
                    getDeviceDefinitionsDocument().getRootElement(),
                    DeviceRepositorySchemaConstants.DEFINITIONS_ELEMENT_NAME);
        } catch (SAXException e) {
            EclipseCommonPlugin.handleError(ABPlugin.getDefault(), e);
        } catch (ParserErrorException e) {
View Full Code Here

        TemporaryFileManager tempFileMgr = new TemporaryFileManager(
                new TestDeviceRepositoryCreator());
        tempFileMgr.executeWith(new TemporaryFileExecutor() {
            public void execute(File repository) throws Exception {

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                PolicyValueModifier pvMod = composition.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.eclipse.core.DeviceRepositoryAccessorManager

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.