Skip to content

A JUnit test rule for use with unit tests that have a dependency on a Java Content Repository

License

Notifications You must be signed in to change notification settings

bmatthews68/jcrunit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JCR Unit

jcrunit jcrunit GitHub Actions Workflow Status Libraries.io dependency status for GitHub repo

JCR Unit provides a JUnit 4 rule and JUnit 5 extension for use when testing code that depends on a Java Content Repository 2.0 implementation. It creates an in-memory content repository using the Jackrabbit Oak implementation.

The current release only supports file (nt:file) and folder (nt:folder) node types.

Requirements

  • Java 8+

  • JUnit 4.13.2+ or JUnit 5.11.2+

Usage

JUnit 4

In JUni

class RepositoryTest {

    @Rule
    public JCRRepositoryRule repositoryRule = JCRRepositoryRule.withCredentials("root", "secret".toCharArray()); // (1)

    @Test
    public void checkSomething() {
        // ...
    }
}

JUnit 5

@ExtendsWith(JCRRepositoryExtension.class)
@JCRRepositoryConfiguration(username = "root", password = {'s', 'e', 'c', 'r', 'e', 't'}) // (1)
class RepositoryTest {

    @Test
    void checkSomething(final JCRRepositoryHelper helper) { // (2)
        // ...
    }
}

Maven Central Coordinates

LDAPUnit has been published in [Maven Central](http://search.maven.org) at the following coordinates:

<dependency>
    <groupId>com.buraolotech.oss.jcrunit</groupId>
    <artifactId>jcrunit</artifactId>
    <version>3.0.0</version>
</dependency>

Credits

Internally JCRUnit is using the Jackrabbit Oak to run the in-memory content repository.

License & Source Code

The JCRUnit is made available under the Apache License and the source code is hosted on GitHub at https://github.com/bmatthews68/jcrunit.

About

A JUnit test rule for use with unit tests that have a dependency on a Java Content Repository

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages