Examples of MockNode


Examples of org.apache.sling.commons.testing.jcr.MockNode

        writer.dump(n, sw, 0);
        return sw.toString();
    }
   
    public void testBasicJson() throws RepositoryException, JSONException {
        final Node n = new MockNode("/test");
        n.setProperty("testprop", "1234");
        assertEquals("{\"testprop\":\"1234\"}",getJson(n, 0));
    }
View Full Code Here

Examples of org.apache.sling.commons.testing.jcr.MockNode

        n.setProperty("testprop", "1234");
        assertEquals("{\"testprop\":\"1234\"}",getJson(n, 0));
    }
   
    public void testMultivalued() throws RepositoryException, JSONException {
        final Node n = new MockNode("/test");
        final String [] values = { "1234", "yes" };
        n.setProperty("testprop", values);
        assertEquals("{\"testprop\":[\"1234\",\"yes\"]}",getJson(n, 0));
    }
View Full Code Here

Examples of org.apache.sling.commons.testing.jcr.MockNode

    /**
     * See <a href="https://issues.apache.org/jira/browse/SLING-924">SLING-924</a>
     */
    public void testOutputIterator() throws JSONException, RepositoryException {
        MockNode node1 = new MockNode("/node1");
        MockNode node2 = new MockNode("/node2");
        node1.addNode("node3");
        node1.setProperty("name", "node1");
        node2.setProperty("name", "node2");
        final NodeIterator it = new MockNodeIterator(new Node[]{node1, node2});
        final StringWriter sw = new StringWriter();
        writer.dump(it, sw);
        Pattern testPattern = Pattern.compile("\\{(.[^\\}]*)\\}"); // Pattern to look for a {...}
        Matcher matcher = testPattern.matcher(sw.toString());
View Full Code Here

Examples of org.apache.sling.commons.testing.jcr.MockNode

* @since Apr 17, 2009 6:57:04 PM
*/
public class JsonJcrNodeTest extends TestCase {

    public void testJcrJsonObject() throws RepositoryException, JSONException {
        MockNode node = new MockNode("/node1");
        node.setProperty("prop1", "value1");
        node.setProperty("prop2", "value2");
        Set<String> ignoredProperties = new HashSet<String>();
        ignoredProperties.add("prop2");
        JsonJcrNode json = new JsonJcrNode(node, ignoredProperties);
        assertTrue("Did not create property", json.has("prop1"));
        assertFalse("Created ignored property", json.has("prop2"));
View Full Code Here

Examples of org.jboss.as.cli.completion.mock.MockNode

public class PathNavigatorsTestCase extends AbstractAddressCompleterTest {

    public PathNavigatorsTestCase() {
        super();

        MockNode root = addRoot("type1");
        root.addChild("name11");
        root.addChild("name12").addChild("type2").addChild("child21");
    }
View Full Code Here

Examples of org.jboss.as.cli.completion.mock.MockNode

    private MockCommandContext ctx;
    private OperationRequestCompleter completer;

    public OperationNameCompletionTestCase() {

        MockNode root = new MockNode("root");

        MockOperation op = new MockOperation("operation-no-properties");
        root.addOperation(op);

        op = new MockOperation("operation-property-a");
        root.addOperation(op);

        op = new MockOperation("operation-properties-a-b");
        root.addOperation(op);

        ctx = new MockCommandContext();
        ctx.setOperationCandidatesProvider(new MockOperationCandidatesProvider(root));
        completer = new OperationRequestCompleter();
    }
View Full Code Here

Examples of org.jboss.as.cli.completion.mock.MockNode

    private MockCommandContext ctx;
    private OperationRequestCompleter completer;

    public PropertiesCompletionTestCase() {

        MockNode root = new MockNode("root");

        MockOperation op = new MockOperation("operation-no-properties");
        root.addOperation(op);

        op = new MockOperation("operation-properties-one-two-three");
        op.setPropertyNames(Arrays.asList("one", "two", "three"));
        root.addOperation(op);

        ctx = new MockCommandContext();
        ctx.setOperationCandidatesProvider(new MockOperationCandidatesProvider(root));
        completer = new OperationRequestCompleter();
    }
View Full Code Here

Examples of org.jboss.as.cli.completion.mock.MockNode

        }
    }

    protected void initModel() {

        MockNode parent = this.root;
        for (int i = 1; i <= getModelDepth(); ++i) {
            parent.addChild("last" + i);
            parent.addChild("other" + i);
            parent = parent.addChild("link" + i);
        }
    }
View Full Code Here

Examples of org.jboss.as.cli.completion.mock.MockNode

public class NodeNameFormattingTestCase extends AbstractAddressCompleterTest {

    public NodeNameFormattingTestCase() {
        super();

        MockNode root = addRoot("root");
        root.addChild("colon:");
        root.addChild("slash/");
        root.addChild("back\\slash");
        root.addChild("both/:");
        root.addChild("all equals= slash/ colon: \"quotes\"");
        root.addChild("equals=equals");

        MockNode datasource = root.addChild("datasources").addChild("data-source");
        datasource.addChild("java:/H2DS1");
        datasource.addChild("java:/H2DS2");
    }
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.