Package com.alibaba.cobar.client.entities

Examples of com.alibaba.cobar.client.entities.Offer


    public void testOfferCreationOnMultipleShardsWithNormallyOfferService() {
        String selectSqlActionTwo = "com.alibaba.cobar.client.entities.Offer.findByMemberId";

        for (Long mid : memberIds) {
            Offer parameter = new Offer();
            parameter.setMemberId(mid);
            Offer offer = (Offer) getSqlMapClientTemplate().queryForObject(selectSqlActionTwo,
                    parameter);
            assertNull(offer);
        }

        ((IOfferService) getApplicationContext().getBean("normalOfferService"))
                .createOffersInBatch(createOffersWithMemberIdsFrom(memberIds));

        for (Long mid : memberIds) {
            Offer parameter = new Offer();
            parameter.setMemberId(mid);
            Offer offer = (Offer) getSqlMapClientTemplate().queryForObject(selectSqlActionTwo,
                    parameter);
            assertNotNull(offer);
            assertEquals(mid, offer.getMemberId());
        }
    }
View Full Code Here


     */
    public void testOfferCreationOnMultipleShardsWithAbnormalOfferService() {
        String selectSqlActionTwo = "com.alibaba.cobar.client.entities.Offer.findByMemberId";

        for (Long mid : memberIds) {
            Offer parameter = new Offer();
            parameter.setMemberId(mid);
            Offer offer = (Offer) getSqlMapClientTemplate().queryForObject(selectSqlActionTwo,
                    parameter);
            assertNull(offer);
        }

        try {
            Object offerService = getApplicationContext().getBean("abnormalOfferService");
            assertTrue(offerService instanceof Proxy);
            ((IOfferService) offerService)
                    .createOffersInBatch(createOffersWithMemberIdsFrom(memberIds));
            fail();
        } catch (RuntimeException e) {
            // pass
        }

        for (Long mid : memberIds) {
            Offer parameter = new Offer();
            parameter.setMemberId(mid);
            assertNull(getSqlMapClientTemplate().queryForObject(selectSqlActionTwo, parameter));
        }
    }
View Full Code Here

    }

    public List<Offer> createOffersWithMemberIdsFrom(Long[] mids) {
        List<Offer> offers = new ArrayList<Offer>();
        for (Long mid : mids) {
            Offer offer = new Offer();
            offer.setGmtUpdated(new Date());
            offer.setMemberId(mid);
            offer.setSubject("anything");
            offers.add(offer);
        }
        return offers;
    }
View Full Code Here

TOP

Related Classes of com.alibaba.cobar.client.entities.Offer

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.