Package org.apache.lucene.facet.enhancements.association

Examples of org.apache.lucene.facet.enhancements.association.AssociationProperty


/** Test {@link AssociationProperty}-ies. */
public class AssociationPropertyTest extends LuceneTestCase {

  @Test
  public void testAssociationCountProperty() throws FacetException {
    AssociationProperty aa1 = new AssociationIntProperty(5);
    AssociationProperty aa2 = new AssociationIntProperty(3);
    assertEquals("Wrong association for property", 5, aa1.getAssociation());
    assertEquals("Wrong association for property", 3, aa2.getAssociation());
    aa1.merge(aa2);
    assertEquals("Wrong association for property", 8, aa1.getAssociation());
  }
View Full Code Here


    assertEquals("Wrong association for property", 8.0, aa1.getFloatAssociation(), 0.00001);
  }

  @Test
  public void testEquals() {
    AssociationProperty aa1 = new AssociationIntProperty(5);
    AssociationProperty aa2 = new AssociationIntProperty(5);
    AssociationProperty aa3 = new AssociationFloatProperty(5);
    AssociationProperty aa4 = new AssociationFloatProperty(5);

    assertTrue("Should be equal", aa1.equals(aa1));
    assertTrue("Should be equal", aa1.equals(aa2));
    assertFalse("Should not be equal", aa1.equals(aa3));
    assertTrue("Should be equal", aa3.equals(aa3));
View Full Code Here

    assertEquals("Wrong number of tokens with properties", 1, nProperties);
  }

  @Test
  public void testMultipleCategoriesWithProperties() throws FacetException {
    AssociationProperty associationProperty = new AssociationIntProperty(
        49);
    categoryContainer.addCategory(new CategoryPath("five", "six"),
        new DummyProperty(), associationProperty);
    categoryContainer.addCategory(new CategoryPath("seven", "eight"),
        new DummyProperty());
View Full Code Here

    int nCategories;
    int nAssociations = 0;
    for (nCategories = 0; iterator.hasNext(); nCategories++) {
      CategoryAttribute ca = iterator.next();
      AssociationProperty aa = (AssociationProperty) ca
          .getProperty(AssociationIntProperty.class);
      if (aa != null) {
        assertEquals("Wrong association value", 17, aa.getAssociation());
        nAssociations++;
      }
    }
    assertEquals("Wrong number of tokens", 3, nCategories);
    assertEquals("Wrong number of tokens with associations", 1,
View Full Code Here

        nAssociations);
  }
 
  @Test
  public void testSerialization() throws Exception {
    AssociationProperty associationProperty = new AssociationIntProperty(
        49);
    categoryContainer.addCategory(new CategoryPath("five", "six"),
        new DummyProperty(), associationProperty);
    categoryContainer.addCategory(new CategoryPath("seven", "eight"),
        new DummyProperty());
View Full Code Here

TOP

Related Classes of org.apache.lucene.facet.enhancements.association.AssociationProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.