@@ -0,0 +1,1917 @@
+package com.loyaltyplant.test.controller;%0A%0Aimport com.loyaltyplant.test.domain.Balance;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.transaction.annotation.Propagation;%0Aimport org.springframework.transaction.annotation.Transactional;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.ResponseBody;%0A%0Aimport javax.annotation.Nullable;%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.PersistenceContext;%0Aimport java.math.BigDecimal;%0A%0A/**%0A * @author Maksim Zakharov%0A * @since 1.0%0A */%0A@Controller%0A@RequestMapping(%22/jmeter/test%22)%0Apublic class JMeterTestController %7B%0A%0A    @PersistenceContext%0A    private EntityManager em;%0A%0A    @RequestMapping(%22/setup%22)%0A    @Transactional(propagation = Propagation.REQUIRED)%0A    @ResponseBody%0A    public Integer setUpDatabase() %7B%0A        // Clear database%0A        em.createQuery(%22delete from Transaction%22).executeUpdate();%0A        em.createQuery(%22delete from Order%22).executeUpdate();%0A        em.createQuery(%22delete from AbstractOperation%22).executeUpdate();%0A        em.createQuery(%22delete from Balance%22).executeUpdate();%0A%0A        // Create 1000 new Balances%0A        Integer startId = em.merge(new Balance(null, new BigDecimal(%2210.0%22))).getId();%0A        for (int i = 0; i%3C 999; i++) %7B%0A            em.merge(new Balance(i, new BigDecimal(%2210.0%22)));%0A        %7D%0A%0A        return startId;%0A    %7D%0A%0A    @RequestMapping(%22/validate%22)%0A    @ResponseBody%0A    public void validate() %7B%0A        @Nullable%0A        BigDecimal credit = (BigDecimal) em.createQuery(%22select sum(o.amount) from CreditOperation o%22).getSingleResult();%0A        @Nullable%0A        BigDecimal debit = (BigDecimal) em.createQuery(%22select sum(o.amount) from DebitOperation o%22).getSingleResult();%0A%0A        // TODO: validate credit equals debit%0A        // TODO: validate sum of balances is equals to 1000 * 10 (initial amount)%0A    %7D%0A%7D%0A

Prepare JMeter test controller.