Package com.volantis.testtools.mocks

Examples of com.volantis.testtools.mocks.MockFile


    /**
     * Test findProblemMarkers.
     */
    public void testFindProblemMarkers() throws Exception {
        IResource resource = new MockFile(POLICY_FILE);

        XPath root = new XPath("/");
        XPath aPath1 = new XPath("/aone");
        XPath aPath2 = new XPath("/aone/atwo");

        XPath bPath1 = new XPath("/bone");
        XPath bPath2 = new XPath("/bone/btwo");

        IMarker marker1 = resource.createMarker(IMarker.PROBLEM);
        marker1.setAttribute(XPath.class.getName(), aPath2.getExternalForm());
        IMarker marker2 = resource.createMarker(IMarker.PROBLEM);
        marker2.setAttribute(XPath.class.getName(), aPath1.getExternalForm());
        IMarker marker3 = resource.createMarker(IMarker.PROBLEM);
        marker3.setAttribute(XPath.class.getName(), bPath2.getExternalForm());
        IMarker marker4 = resource.createMarker(IMarker.MESSAGE);
        marker4.setAttribute(XPath.class.getName(), bPath1.getExternalForm());

        IMarker markers [];

        markers = PolicyUtils.findProblemMarkers(resource, root);
View Full Code Here


//                                repository.getPath(),
//                                new TestTransformerMetaFactory(),
//                                new DefaultJDOMFactory(), false);
//                IResource resource = new MockFile(
//                        deviceRAM.getDeviceRepositoryName());
                IResource resource = new MockFile(repository.getPath());

                // Create a tree for the dialog.
                LPDMODOMFactory factory = new LPDMODOMFactory();


                // Create first subtree
                Element parent1 = factory.element("parent1");
                Element child1a = factory.element("child1a");
                child1a.setAttribute("attr1", "value1");
                child1a.setAttribute("attr2", "value2");
                Element child1b = factory.element("child1b");
                parent1.addContent(child1a);
                parent1.addContent(child1b);

                // Create second subtree
                Element parent2 = factory.element("parent2");
                parent2.setAttribute("attr1", "value1");
                parent2.setAttribute("attr2", "value2");
                parent2.setAttribute("attr3", "value3");
                parent2.setAttribute("attr4", "value4");
                Element child2a = factory.element("child2a");
                Element child2b = factory.element("child2b");

                parent2.addContent(child2a);
                parent2.addContent(child2b);

                // Create the root element and add content
                Element rootNode = factory.element("root");
                rootNode.addContent(parent1);
                rootNode.addContent(parent2);

                XPath rootPath = new XPath(rootNode);
                XPath parent1Path = new XPath(parent1);
                XPath child1aPath = new XPath(child1a);
                XPath child1bPath = new XPath(child1b);

                XPath parent2Path = new XPath(parent2);
                XPath child2aPath = new XPath(child2a);
                XPath child2bPath = new XPath(child2b);


                IMarker marker0 = resource.createMarker(IMarker.PROBLEM);
                marker0.setAttribute(XPath.class.getName(),
                        rootPath.getExternalForm());
                marker0.setAttribute(Element.class.getName(), rootNode.getName());

                IMarker marker1 = resource.createMarker(IMarker.PROBLEM);
                marker1.setAttribute(XPath.class.getName(),
                        parent1Path.getExternalForm());
                marker1.setAttribute(Element.class.getName(), rootNode.getName());

                IMarker marker2 = resource.createMarker(IMarker.PROBLEM);
                marker2.setAttribute(XPath.class.getName(),
                        child1aPath.getExternalForm());
                marker2.setAttribute(Element.class.getName(), child1a.getName());

                IMarker marker3 = resource.createMarker(IMarker.PROBLEM);
                marker3.setAttribute(XPath.class.getName(),
                        child1bPath.getExternalForm());
                marker3.setAttribute(Element.class.getName(), child1b.getName());

                IMarker marker4 = resource.createMarker(IMarker.PROBLEM);
                marker4.setAttribute(XPath.class.getName(),
                        parent2Path.getExternalForm());
                marker4.setAttribute(Element.class.getName(), parent2.getName());

                IMarker marker5 = resource.createMarker(IMarker.PROBLEM);
                marker5.setAttribute(XPath.class.getName(),
                        child2aPath.getExternalForm());
                marker5.setAttribute(Element.class.getName(), parent2.getName());

                IMarker marker6 = resource.createMarker(IMarker.PROBLEM);
                marker6.setAttribute(XPath.class.getName(),
                        child2bPath.getExternalForm());
                marker6.setAttribute(Element.class.getName(), parent2.getName());

                // Find markers associated with parent2
View Full Code Here

                    }
                };

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

                // Create the PolicyValueModifier and controller for
                // UAProf.CcppAccept.
                ListPolicyValueModifier listModifier = (ListPolicyValueModifier)
View Full Code Here

     * Test the behviour of the getXPath(XPath) method.
      * @throws Exception
     */
    public void testGetXPath() throws Exception {

        resource = new MockFile(POLICY_FILE);


        // set up a number of paths for the test
        XPath root = new XPath("/");
        XPath aPath1 = new XPath("/aone");
View Full Code Here

                    }
                };

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

                    }
                };

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

                final PolicyValueModifier modifier =
                        factory.createPolicyValueModifier(shell, SWT.NONE, policyName);
                controller = new PolicyController(policyName, selector,
View Full Code Here

                    }
                };

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

                final PolicyValueModifier modifier =
                        factory.createPolicyValueModifier(shell, SWT.NONE, policyName);
                controller = new PolicyController(policyName, selector,
View Full Code Here

    public void testConstructor() throws Exception {

        ODOMEditorContextManager manager = new ODOMEditorContextManager(
                new ODOMEditorContextCreator() {
            public ODOMEditorContext create() throws Exception {
                return new ODOMEditorContext(new MockFile(POLICY_FILE),
                        NULL_UR_MEMENTO_ORIGINATOR,
                                  createRootElement(), null);
            }
        });
View Full Code Here

    /**
     * Factory method for creating a testable IResource instance
     * @return an IResource instance
     */
    private IResource createResource() {
        return new MockFile(POLICY_FILE);
    }
View Full Code Here

     * @return
     * @throws Exception
     */
    protected ODOMEditorContext createEditorContext() throws Exception {
        ODOMEditorContext context = ODOMEditorContext.
                createODOMEditorContext(null, new MockFile(FILE),
                        NULL_UR_MEMENTO_ORIGINATOR);
        ODOMElement document = createDocument(SINGLE_PANE_RUN);
        context.removeRootElement(context.getRootElement());
        context.addRootElement(document, null);
        return context;
View Full Code Here

TOP

Related Classes of com.volantis.testtools.mocks.MockFile

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.