Search in sources :

Example 1 with QueryResultsCache

use of org.apache.isis.applib.services.queryresultscache.QueryResultsCache in project estatio by estatio.

the class AgreementRoleTypeRepository_Test method setup.

@Before
public void setup() {
    agreementType = new AgreementType();
    agreementRoleTypeRepository = new AgreementRoleTypeRepository() {

        @Override
        protected <T> T firstMatch(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.FIRST_MATCH);
            return null;
        }

        @Override
        protected List<AgreementRoleType> allInstances() {
            finderInteraction = new FinderInteraction(null, FinderMethod.ALL_INSTANCES);
            return null;
        }

        @Override
        protected <T> List<T> allMatches(Query<T> query) {
            finderInteraction = new FinderInteraction(query, FinderMethod.ALL_MATCHES);
            return null;
        }
    };
    QueryResultsCache.Control control = new QueryResultsCache.Control();
    control.on(new FixturesInstallingEvent(new FixtureScriptsDefault()));
    final QueryResultsCache queryResultsCache = new QueryResultsCache() {

        {
            control = new Control();
        }
    };
    agreementRoleTypeRepository.queryResultsCache = queryResultsCache;
}
Also used : AgreementType(org.estatio.module.agreement.dom.type.AgreementType) FixturesInstallingEvent(org.apache.isis.applib.events.system.FixturesInstallingEvent) List(java.util.List) FixtureScriptsDefault(org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault) QueryResultsCache(org.apache.isis.applib.services.queryresultscache.QueryResultsCache) FinderInteraction(org.incode.module.unittestsupport.dom.repo.FinderInteraction) Before(org.junit.Before)

Example 2 with QueryResultsCache

use of org.apache.isis.applib.services.queryresultscache.QueryResultsCache in project estatio by estatio.

the class PaymentBatch_Test method setUp.

@Before
public void setUp() throws Exception {
    paymentBatch = new PaymentBatch() {

        @Override
        public String getId() {
            // say
            return "97834";
        }
    };
    paymentBatch.setCreatedOn(new DateTime(2017, 7, 14, 15, 50));
    paymentBatch.setApprovalState(PaymentBatchApprovalState.NEW);
    paymentBatch.serviceRegistry2 = mockServiceRegistry2;
    paymentBatch.queryResultsCache = new QueryResultsCache() {

        @Override
        public <T> T execute(final Callable<T> callable, final Class<?> callingClass, final String methodName, final Object... keys) {
            try {
                return callable.call();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    };
    this.seller1 = newOrganisation("ACME", "/FRA");
    this.seller2 = newOrganisation("YOUKEA", "/FRA");
    this.seller1BankAccount = newBankAccount("NL42RBOS0601349900", "INGBFRPP", seller1);
    this.seller2BankAccount = newBankAccount("NL46RABO0370675415", "BSPFFRPPXXX", seller2);
}
Also used : QueryResultsCache(org.apache.isis.applib.services.queryresultscache.QueryResultsCache) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Aggregations

QueryResultsCache (org.apache.isis.applib.services.queryresultscache.QueryResultsCache)2 Before (org.junit.Before)2 List (java.util.List)1 FixturesInstallingEvent (org.apache.isis.applib.events.system.FixturesInstallingEvent)1 FixtureScriptsDefault (org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault)1 AgreementType (org.estatio.module.agreement.dom.type.AgreementType)1 FinderInteraction (org.incode.module.unittestsupport.dom.repo.FinderInteraction)1 DateTime (org.joda.time.DateTime)1