public class PerDimensionIndexingParamsTest extends LuceneTestCase {
@Test
public void testTopLevelSettings() {
FacetIndexingParams ifip = new PerDimensionIndexingParams();
assertNotNull("Missing default category list", ifip
.getAllCategoryListParams());
assertEquals(
"Expected default category list term is $facets:$fulltree$",
new Term("$facets", "$fulltree$"), ifip.getCategoryListParams(
null).getTerm());
String expectedDDText = "a"
+ ifip.getFacetDelimChar() + "b";
CategoryPath cp = new CategoryPath("a", "b");
assertEquals("wrong drill-down term", new Term("$facets",
expectedDDText), DrillDown.term(ifip,cp));
char[] buf = new char[20];
int numchars = ifip.drillDownTermText(cp, buf);
assertEquals("3 characters should be written", 3, numchars);
assertEquals("wrong drill-down term text", expectedDDText, new String(
buf, 0, numchars));
CategoryListParams clParams = ifip.getCategoryListParams(null);
assertEquals("partition for all ordinals is the first", "$fulltree$",
PartitionsUtils.partitionNameByOrdinal(ifip, clParams , 250));
assertEquals("for partition 0, the same name should be returned",
"$fulltree$", PartitionsUtils.partitionName(clParams, 0));
assertEquals(
"for any other, it's the concatenation of name + partition",
"$fulltree$1", PartitionsUtils.partitionName(clParams, 1));
assertEquals("default partition number is always 0", 0,
PartitionsUtils.partitionNumber(ifip,100));
assertEquals("default partition size is unbounded", Integer.MAX_VALUE,
ifip.getPartitionSize());
}