Search in sources :

Example 1 with Type2

use of org.apache.geode.cache.lucene.internal.repository.serializer.Type2 in project geode by apache.

the class IndexRepositoryImplJUnitTest method queryShouldUpdateStats.

@Test
public void queryShouldUpdateStats() throws IOException, ParseException {
    repo.create("key2", new Type2("McMinnville Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.create("key4", new Type2("Portland Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.commit();
    checkQuery("Cream", "s", "key2", "key4");
    verify(stats, times(1)).startRepositoryQuery();
    verify(stats, times(1)).endRepositoryQuery(anyLong(), eq(2));
}
Also used : Type2(org.apache.geode.cache.lucene.internal.repository.serializer.Type2) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 2 with Type2

use of org.apache.geode.cache.lucene.internal.repository.serializer.Type2 in project geode by apache.

the class IndexRepositoryImplJUnitTest method updateAndRemove.

private void updateAndRemove(Object key1, Object key2, Object key3, Object key4) throws IOException, ParseException {
    repo.create(key1, new Type2("bacon maple bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
    repo.create(key2, new Type2("McMinnville Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.create(key3, new Type2("Voodoo Doll doughnut", 1, 2L, 3.0, 4.0f, "Toasted coconut doughnut"));
    repo.create(key4, new Type2("Portland Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.commit();
    repo.update(key3, new Type2("Boston Cream Pie", 1, 2L, 3.0, 4.0f, "Toasted coconut doughnut"));
    repo.delete(key4);
    repo.commit();
    // BooleanQuery q = new BooleanQuery();
    // q.add(new TermQuery(SerializerUtil.toKeyTerm("key3")), Occur.MUST_NOT);
    // writer.deleteDocuments(q);
    // writer.commit();
    // Make sure the updates and deletes were applied
    checkQuery("doughnut", "s", key2);
    checkQuery("Cream", "s", key2, key3);
}
Also used : Type2(org.apache.geode.cache.lucene.internal.repository.serializer.Type2)

Example 3 with Type2

use of org.apache.geode.cache.lucene.internal.repository.serializer.Type2 in project geode by apache.

the class IndexRepositoryImplJUnitTest method testAddDocs.

@Test
public void testAddDocs() throws IOException, ParseException {
    repo.create("key1", new Type2("bacon maple bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
    repo.create("key2", new Type2("McMinnville Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.create("key3", new Type2("Voodoo Doll doughnut", 1, 2L, 3.0, 4.0f, "Toasted coconut doughnut"));
    repo.create("key4", new Type2("Portland Cream doughnut", 1, 2L, 3.0, 4.0f, "Captain my Captain doughnut"));
    repo.commit();
    checkQuery("Cream", "s", "key2", "key4");
    checkQuery("NotARealWord", "s");
}
Also used : Type2(org.apache.geode.cache.lucene.internal.repository.serializer.Type2) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 4 with Type2

use of org.apache.geode.cache.lucene.internal.repository.serializer.Type2 in project geode by apache.

the class IndexRepositoryImplJUnitTest method updateShouldUpdateStats.

@Test
public void updateShouldUpdateStats() throws IOException {
    repo.update("key1", new Type2("bacon maple bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
    verify(stats, times(1)).startUpdate();
    verify(stats, times(1)).endUpdate(anyLong());
}
Also used : Type2(org.apache.geode.cache.lucene.internal.repository.serializer.Type2) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 5 with Type2

use of org.apache.geode.cache.lucene.internal.repository.serializer.Type2 in project geode by apache.

the class IndexRepositoryImplJUnitTest method addingDocumentsShouldUpdateDocumentsStat.

@Test
public void addingDocumentsShouldUpdateDocumentsStat() throws IOException {
    repo.create("key1", new Type2("bar", 1, 2L, 3.0, 4.0f, "Grape Ape doughnut"));
    repo.commit();
    ArgumentCaptor<IntSupplier> captor = ArgumentCaptor.forClass(IntSupplier.class);
    verify(stats).addDocumentsSupplier(captor.capture());
    IntSupplier supplier = captor.getValue();
    assertEquals(1, supplier.getAsInt());
}
Also used : Type2(org.apache.geode.cache.lucene.internal.repository.serializer.Type2) IntSupplier(java.util.function.IntSupplier) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

Type2 (org.apache.geode.cache.lucene.internal.repository.serializer.Type2)6 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)5 Test (org.junit.Test)5 IntSupplier (java.util.function.IntSupplier)1