Search in sources :

Example 1 with ExampleEntity

use of org.qi4j.index.rdf.ContainsAllTest.ExampleEntity in project qi4j-sdk by Qi4j.

the class ContainsTest method performContainsStringValueTest.

private ExampleEntity performContainsStringValueTest(Set<String> entityStrings, String queryableString) throws Exception {
    UnitOfWork creatingUOW = this.module.newUnitOfWork();
    String[] entityStringsArray = new String[entityStrings.size()];
    ContainsAllTest.createEntityWithComplexValues(creatingUOW, this.module, entityStrings.toArray(entityStringsArray));
    creatingUOW.complete();
    UnitOfWork queryingUOW = this.module.newUnitOfWork();
    try {
        ExampleEntity entity = this.findEntityBasedOnValueString(queryableString);
        return entity;
    } finally {
        queryingUOW.discard();
    }
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) ExampleEntity(org.qi4j.index.rdf.ContainsAllTest.ExampleEntity)

Example 2 with ExampleEntity

use of org.qi4j.index.rdf.ContainsAllTest.ExampleEntity in project qi4j-sdk by Qi4j.

the class ContainsTest method performContainsStringTest.

private ExampleEntity performContainsStringTest(Set<String> entityStrings, String queryableString) throws Exception {
    UnitOfWork creatingUOW = this.module.newUnitOfWork();
    String[] entityStringsArray = new String[entityStrings.size()];
    ContainsAllTest.createEntityWithStrings(creatingUOW, this.module, entityStrings.toArray(entityStringsArray));
    creatingUOW.complete();
    UnitOfWork queryingUOW = this.module.newUnitOfWork();
    try {
        ExampleEntity entity = this.findEntity(queryableString);
        return entity;
    } finally {
        queryingUOW.discard();
    }
}
Also used : UnitOfWork(org.qi4j.api.unitofwork.UnitOfWork) ExampleEntity(org.qi4j.index.rdf.ContainsAllTest.ExampleEntity)

Example 3 with ExampleEntity

use of org.qi4j.index.rdf.ContainsAllTest.ExampleEntity in project qi4j-sdk by Qi4j.

the class ContainsTest method simpleContainsStringValueFailTest.

@Test
public void simpleContainsStringValueFailTest() throws Exception {
    ExampleEntity result = this.performContainsStringTest(new HashSet<String>(Arrays.asList(ContainsAllTest.TEST_STRING_1, ContainsAllTest.TEST_STRING_2, ContainsAllTest.TEST_STRING_3)), ContainsAllTest.TEST_STRING_4);
    Assert.assertTrue("The entity must not have been found", result == null);
}
Also used : ExampleEntity(org.qi4j.index.rdf.ContainsAllTest.ExampleEntity) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 4 with ExampleEntity

use of org.qi4j.index.rdf.ContainsAllTest.ExampleEntity in project qi4j-sdk by Qi4j.

the class ContainsTest method simpleContainsSuccessTest.

@Test
public void simpleContainsSuccessTest() throws Exception {
    ExampleEntity result = this.performContainsStringTest(new HashSet<String>(Arrays.asList(ContainsAllTest.TEST_STRING_1, ContainsAllTest.TEST_STRING_2, ContainsAllTest.TEST_STRING_3)), ContainsAllTest.TEST_STRING_3);
    Assert.assertTrue("The entity must have been found", result != null);
}
Also used : ExampleEntity(org.qi4j.index.rdf.ContainsAllTest.ExampleEntity) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Example 5 with ExampleEntity

use of org.qi4j.index.rdf.ContainsAllTest.ExampleEntity in project qi4j-sdk by Qi4j.

the class ContainsTest method simpleContainsSuccessFailTest.

@Test
public void simpleContainsSuccessFailTest() throws Exception {
    ExampleEntity result = this.performContainsStringTest(new HashSet<String>(Arrays.asList(ContainsAllTest.TEST_STRING_1, ContainsAllTest.TEST_STRING_2, ContainsAllTest.TEST_STRING_3)), ContainsAllTest.TEST_STRING_4);
    Assert.assertTrue("The entity must not have been found", result == null);
}
Also used : ExampleEntity(org.qi4j.index.rdf.ContainsAllTest.ExampleEntity) AbstractQi4jTest(org.qi4j.test.AbstractQi4jTest) Test(org.junit.Test)

Aggregations

ExampleEntity (org.qi4j.index.rdf.ContainsAllTest.ExampleEntity)6 Test (org.junit.Test)4 AbstractQi4jTest (org.qi4j.test.AbstractQi4jTest)4 UnitOfWork (org.qi4j.api.unitofwork.UnitOfWork)2