Methods Summary |
---|
protected void | setUp()
schema = new IndexSchema();
|
protected void | tearDown()
super.tearDown();
|
public void | testAddSchemaField()
schema.addSchemaField(null);
assertEquals(0, schema.getFields().size());
IndexSchemaField f = new IndexSchemaField();
f.setName(IndexDocument.FIELD_ENTRY_ID);
schema.addSchemaField(f);
assertEquals(0, schema.getFields().size());
f.setName(IndexDocument.FIELD_FEED_ID);
schema.addSchemaField(f);
assertEquals(0, schema.getFields().size());
f.setName("some");
schema.addSchemaField(f);
assertEquals(1, schema.getFields().size());
assertEquals(StandardAnalyzer.class, schema.getServiceAnalyzer()
.getClass());
assertEquals(StandardAnalyzer.class, schema.getSchemaAnalyzer()
.getClass());
f.setName("someOther");
f.setAnalyzerClass(StopAnalyzer.class);
schema.addSchemaField(f);
assertEquals(2, schema.getFields().size());
assertEquals(PerFieldAnalyzerWrapper.class, schema.getSchemaAnalyzer()
.getClass());
schema.addSchemaField(f);
assertEquals(3, schema.getFields().size());
|
public void | testEquals()
assertFalse(schema.equals(null));
assertFalse(schema.equals(new String()));
assertTrue(schema.equals(schema));
assertFalse(schema.equals(new IndexSchema()));
IndexSchema s1 = new IndexSchema();
s1.setName("someName");
assertFalse(schema.equals(s1));
schema.setName(s1.getName());
assertTrue(schema.equals(s1));
|
public void | testGetSearchableFieldNames()
IndexSchemaField f = new IndexSchemaField();
f.setName("some");
schema.addSchemaField(f);
assertEquals(1, schema.getSearchableFieldNames().size());
assertTrue(schema.getSearchableFieldNames().contains("some"));
|
public void | testHashCode()
assertEquals(schema.hashCode(), schema.hashCode());
assertNotNull(schema.hashCode());
IndexSchema s1 = new IndexSchema();
s1.setName("someName");
assertTrue(schema.hashCode() != s1.hashCode());
schema.setName(s1.getName());
assertTrue(schema.hashCode() == s1.hashCode());
|
public void | testInitialize()
try {
schema.initialize();
fail("def search field is null");
} catch (RuntimeException e) {
// TODO: handle exception
}
schema.setDefaultSearchField("someField");
try {
schema.initialize();
fail("name is null");
} catch (RuntimeException e) {
// TODO: handle exception
}
schema.setName("someName");
try {
schema.initialize();
fail("indexLocation is null");
} catch (RuntimeException e) {
// TODO: handle exception
}
schema.setIndexLocation("/loc/loc");
try {
schema.initialize();
fail("default search field is not set as a field");
} catch (RuntimeException e) {
// TODO: handle exception
}
IndexSchemaField f = new IndexSchemaField();
f.setName(schema.getDefaultSearchField());
f.setContentType(ContentType.TEXT);
schema.addSchemaField(f);
try {
schema.initialize();
fail("field check failed");
} catch (RuntimeException e) {
// TODO: handle exception
}
f.setPath("path");
schema.initialize();
|
public void | testToSTringNoNullPEx()
assertNotNull(schema.toString());
|