You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2013/05/21 18:21:16 UTC

[jira] [Commented] (OAK-833) Extend the performance framework in order to handle also junit test

    [ https://issues.apache.org/jira/browse/OAK-833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13663086#comment-13663086 ] 

Jukka Zitting commented on OAK-833:
-----------------------------------

In general I'm happy with new functionality, but after looking at the patch I'm wondering if we're really solving the right issue here. To me it looks like the problem you're addressing is not being able to benchmark a JUnit test as such, but rather being able to use the AbstractSecurityTest base class in setting up the test fixture for a benchmark. And I wonder why you'd want to do that in the first place.

AFAICT the following benchmark test should already do pretty much what you're trying to achieve with the ReadStatusTestSingleACL class, i.e. measure the time it takes to get the child count of a large node covered by a single ACL.

{code}
public class ReadStatusTestSingleACL extends AbstractTest {

    private Session reader;

    @Override
    protected void beforeSuite() throws Exception {
        reader = loginReader();

        Session writer = loginWriter();

        PrincipalManager pm = ((JackrabbitSession) writer).getPrincipalManager();
        Principal principal = pm.getPrincipal(reader.getUserID());

        AccessControlManager acm = writer.getAccessControlManager();
        JackrabbitAccessControlList acl = getAccessControlList(acm, "/");
        acl.addEntry(principal, privilegesFromNames(acm, JCR_READ), true);
        acm.setPolicy("/", acl);

        Node a = writer.getRootNode().addNode("a");
        for (int i = 0; i < 10000; i++){
            a.addNode("node" + i);
        }
        writer.save();
    }

    @Override
    protected void runTest() throws Exception {
        NodeIterator iterator = reader.getNode("/a").getNodes();
        long size = iterator.getSize();
        if (size == -1) {
            for (size = 0; iterator.hasNext(); size++) {
                iterator.nextNode();
            }
        }
    }

}
{code}

The nice thing about this approach is that we're using the full Oak stack, including the JCR layer, and that we can for example compare performance between Oak and Jackrabbit by simply switching the repository fixture used by the test.
                
> Extend the performance framework in order to handle also junit test
> -------------------------------------------------------------------
>
>                 Key: OAK-833
>                 URL: https://issues.apache.org/jira/browse/OAK-833
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: run
>            Reporter: Antonio Sanso
>            Priority: Minor
>         Attachments: OAK-833-patch.txt
>
>
> The current performance test framework in the benchmark are of oak-run at the moment works only as integration test against a running instance.
> It would be nice to extend them to work as well with junit test.
> I will provide a patch that try to extend this.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira