Examples of MockResource


Examples of org.apache.sling.commons.testing.sling.MockResource

        resourceType = "foo:bar";
        resourceTypePath = ResourceUtil.resourceTypeToPath(resourceType);

        resourcePath = "/content/page";
        resource = new MockResource(resourceResolver, resourcePath,
            resourceType);
        resourceResolver.addResource(resource);

        request = makeRequest("GET", "print.a4", "html");
    }
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

        // resource type and super type for start resource
        final String resourceType = "foo/bar";
        final String resourceSuperType = "foo/check1";
        final String resourceSuperType2 = "foo/check2";

        final Resource resource2 = new MockResource(resourceResolver,
                root1 + '/' + resourceSuperType,
                resourceType, resourceSuperType2);
        resourceResolver.addResource(resource2);
        final Resource resource3 = new MockResource(resourceResolver,
                root1 + '/' + resourceSuperType2,
                resourceType, resourceType);
        resourceResolver.addResource(resource3);

        LocationIterator li = getLocationIterator(resourceType,
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

        assertFalse(rIter.hasNext());
    }

    protected MockResource createScriptResource(String path, String type) {
        MockResource res = new MockResource(resourceResolver, path, type);
        resourceResolver.addResource(res);
        return res;
    }
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

    protected void assertScript(String method, String selectors, String extension,
            String [] scripts, String expectedScript)
    {
        // Add given scripts to our mock resource resolver
        for(String script : scripts) {
            final MockResource r = new MockResource(resourceResolver, script, "nt:file");
            resourceResolver.addResource(r);
        }

        // Create mock request and get scripts from ResourceCollector
        final MockSlingHttpServletRequest req = makeRequest(method, selectors, extension);
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

  public void init() {
    log.info("init");

    log.info("Creating Resource Structure");
    final MockResourceResolver resolver = new MockResourceResolver();
    resource = new MockResource(resolver, TEST_PATH, "test");
    resolver.addResource(resource);
    MockResource child1 = new MockResource(resolver, TEST_PATH + "/child1",
        "test");
    resolver.addResource(child1);
    MockResource child2 = new MockResource(resolver, TEST_PATH + "/child2",
        "test");
    resolver.addResource(child2);

    log.info("Adding page context");
    pageContext = new MockPageContext();
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

  public void init() {
    log.info("init");

    final MockResourceResolver resolver = new MockResourceResolver();

    resource = new MockResource(resolver, TEST_ABSOLUTE_PATH, "test");
    resolver.addResource(resource);

    MockResource child = new MockResource(resolver, TEST_ABSOLUTE_PATH
        + "/" + TEST_RELATIVE_PATH, "test");
    resolver.addResource(child);

    getResourceTag = new GetResourceTag() {
      protected ResourceResolver getResourceResolver() {
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

    pageContext = new MockPageContext();
    adaptToTag.setPageContext(pageContext);

    ResourceResolver resolver = new MockResourceResolver();
    resource = new MockResource(resolver, "/", "test");
    log.info("init Complete");
  }
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

        } else {
          return null;
        }
      }
    };
    resource = new MockResource(resolver, TEST_PATH, "test");
    resolver.addResource(resource);

    getResourceTag = new FindResourcesTag() {
      protected ResourceResolver getResourceResolver() {
        return resolver;
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

            mn.setProperty("desc", "test.desc");
        } catch(RepositoryException ignored) {
            // ignore, cannot happen with this mock class
        }
       
        final MockResource mr = new MockResource(null, path, null) {
            @SuppressWarnings("unchecked")
            public <Type> Type adaptTo(Class<Type> type) {
                if(type.equals(Node.class)) {
                    return (Type)mn;
                } else {
View Full Code Here

Examples of org.apache.sling.commons.testing.sling.MockResource

    }
   
    public void testTitleBuilding() throws RepositoryException {
        final String path = "/foo/title";
        final MockNode n = new MockNode(path);
        final MockResource r = new MockResource(null, path, null);
       
        assertEquals("foo/title", generator.getTitle(r, n));
       
        n.setProperty("description", "the description");
        assertEquals("the description", generator.getTitle(r, n));
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.