Hi

In the sub project org.apache.sling.ddr’s core in the sling-whiteboard I tried 
to use Sling Context to run the Unit Test for 
DeclarativeDynamicResourceManagerServiceTest. 

In there I register a new Node Type:

@Rule
public SlingContext context = new SlingContext(ResourceResolverType.JCR_OAK);

try {
    
NodeTypeDefinitionScanner.get().register(context.resourceResolver().adaptTo(Session.class),
        ImmutableList.of("SLING-CONTENT/nodetypes/ddr.cnd"),
        ResourceResolverType.JCR_OAK.getNodeTypeMode());
}
catch (RepositoryException ex) {
    throw new RuntimeException("Unable to register namespaces.", ex);
}

 then use the context to load my test resources into /conf:

context.load().json("/ddr-sources/ddr-conf-settings.json", "/conf”);

. The resource /conf/test/settings/dynamic has these properties (Resource 
sourceRoot = resourceResolver.getResource("/conf/test/settings/dynamic”): 

JcrNodeResource, type=sling:DDR, superType=null, 
path=/conf/test/settings/dynamic

Then I do a query:

Iterator<Resource> i = resourceResolver.findResources(
    "SELECT * FROM [" + DDR_NODE_TYPE + "]",
    Query.JCR_SQL2
);

But the iterator is empty. 

Is that not supported or did I do something wrong here.

Thanks - Andy

Reply via email to