Example usage for org.apache.commons.collections PredicateUtils equalPredicate

List of usage examples for org.apache.commons.collections PredicateUtils equalPredicate

Introduction

In this page you can find the example usage for org.apache.commons.collections PredicateUtils equalPredicate.

Prototype

public static Predicate equalPredicate(Object value) 

Source Link

Document

Creates a Predicate that checks if the input object is equal to the specified object using equals().

Usage

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testSaveBranchReportWithClientSummaryAndRetrieveUsingBranchReport() throws Exception {
    session.save(branchReportWithClientSummaries);
    List<BranchReportBO> retrievedBranchReports = branchReportPersistence.getBranchReport(BRANCH_ID, runDate);
    assertListSizeAndTrueCondition(1, retrievedBranchReports,
            PredicateUtils.equalPredicate(branchReportWithClientSummaries));
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testGetLoanArrearsReportForDateAndBranch() throws Exception {
    session.save(branchReportWithLoanArrears);
    retrieveAndAssertLoanArrearsReportForBranchAndDate(1, PredicateUtils
            .equalPredicate(CollectionUtils.first(branchReportWithLoanArrears.getLoanArrearsAging())));
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testRetrieveStaffSummaryForDateAndBranch() throws Exception {
    session.save(branchReportWithStaffSummary);
    retrieveAndAssertBranchReportStaffSummaryForBranchAndDate(1, PredicateUtils
            .equalPredicate(CollectionUtils.first(branchReportWithStaffSummary.getStaffSummaries())));
}

From source file:org.mifos.reports.business.service.BranchReportServiceIntegrationTest.java

@Test
public void testReturnsClientSummaryForGivenBranchAndRunDate() throws Exception {
    session.save(branchReport);/*from w w  w  .  ja v  a2  s .  c om*/
    List<BranchReportClientSummaryBO> retrievedClientSummaries = branchReportService
            .getClientSummaryInfo(BRANCH_ID, RUN_DATE_STR);
    Assert.assertNotNull(retrievedClientSummaries);
    Assert.assertEquals(3, retrievedClientSummaries.size());

    Assert.assertTrue(
            exists(retrievedClientSummaries, PredicateUtils.equalPredicate(centerCountClientSummary)));

    Assert.assertTrue(
            exists(retrievedClientSummaries, PredicateUtils.equalPredicate(activeClientsCountSummary)));

    Assert.assertTrue(
            exists(retrievedClientSummaries, PredicateUtils.equalPredicate(activeBorrowersCountSummary)));
}

From source file:org.mifos.reports.business.service.BranchReportServiceIntegrationTest.java

@Test
public void testReturnsLoanArrearsAgingInfo() throws Exception {
    session.save(branchReport);//from   w  w  w .  j a  va2  s  . c o  m
    List<BranchReportLoanArrearsAgingBO> retrievedLoanArrearsAgingInfo = branchReportService
            .getLoanArrearsAgingInfo(BRANCH_ID, RUN_DATE_STR);
    Assert.assertEquals(3, retrievedLoanArrearsAgingInfo.size());
    Assert.assertTrue(
            exists(retrievedLoanArrearsAgingInfo, PredicateUtils.equalPredicate(loanArrearReportForFirstWeek)));
    Assert.assertTrue(exists(retrievedLoanArrearsAgingInfo,
            PredicateUtils.equalPredicate(loanArrearReportForSecondWeek)));
    Assert.assertTrue(
            exists(retrievedLoanArrearsAgingInfo, PredicateUtils.equalPredicate(loanArrearReportForThirdWeek)));
}

From source file:org.opencastproject.serviceregistry.impl.jmx.HostsStatistics.java

/**
 * @see org.opencastproject.serviceregistry.impl.jmx.HostsStatisticsMXBean#getOnlineCount()
 *///w w  w. j a v a2 s.c o  m
@Override
public int getOnlineCount() {
    return CollectionUtils.countMatches(hosts.values(), PredicateUtils.equalPredicate(ONLINE));
}

From source file:org.opencastproject.serviceregistry.impl.jmx.HostsStatistics.java

/**
 * @see org.opencastproject.serviceregistry.impl.jmx.HostsStatisticsMXBean#getOfflineCount()
 *//*from w ww .j  a v a  2  s  . c  o m*/
@Override
public int getOfflineCount() {
    return CollectionUtils.countMatches(hosts.values(), PredicateUtils.equalPredicate(OFFLINE));
}

From source file:org.opencastproject.serviceregistry.impl.jmx.HostsStatistics.java

/**
 * @see org.opencastproject.serviceregistry.impl.jmx.HostsStatisticsMXBean#getInMaintenanceCount()
 *///ww w . ja  va2  s  . co  m
@Override
public int getInMaintenanceCount() {
    return CollectionUtils.countMatches(hosts.values(), PredicateUtils.equalPredicate(MAINTENANCE));
}

From source file:org.opencastproject.serviceregistry.impl.jmx.ServicesStatistics.java

/**
 * @see org.opencastproject.serviceregistry.impl.jmx.ServicesStatisticsMXBean#getNormalServiceCount()
 *//*from   w  w w.j a va 2s.co  m*/
@Override
public int getNormalServiceCount() {
    return CollectionUtils.countMatches(services.values(), PredicateUtils.equalPredicate(ServiceState.NORMAL));
}

From source file:org.opencastproject.serviceregistry.impl.jmx.ServicesStatistics.java

/**
 * @see org.opencastproject.serviceregistry.impl.jmx.ServicesStatisticsMXBean#getWarningServiceCount()
 *//*from  www .j a v  a 2 s. c  o  m*/
@Override
public int getWarningServiceCount() {
    return CollectionUtils.countMatches(services.values(), PredicateUtils.equalPredicate(ServiceState.WARNING));
}