Spring Framework AbstractTransactionalTestNGSpringContextTests - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework AbstractTransactionalTestNGSpringContextTests class.

This code example shows how to use the following methods:
 * @author Sam Brannen 
 * @author Xavier Detant 
 * @since 4.0.1 
 */ 
@DirtiesContext(classMode = ClassMode.AFTER_CLASS) 
public abstract class AbstractEjbTxDaoTestNGTests extends AbstractTransactionalTestNGSpringContextTests { 
 
	protected static final String TEST_NAME = "test-name"; 
 
	@EJB 
	protected TestEntityDao dao; 
 
	@PersistenceContext 
	protected EntityManager em; 
 
 
	@Test 
	public void test1InitialState() { 
		int count = dao.getCount(TEST_NAME); 
		assertEquals("New TestEntity should have count=0.", 0, count); 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * 
 * @author Sam Brannen 
 * @since 4.1 
 */ 
@ContextConfiguration 
public class ProgrammaticTxMgmtTestNGTests extends AbstractTransactionalTestNGSpringContextTests { 
 
	private String method; 
 
 
	@Override 
	public void run(IHookCallBack callBack, ITestResult testResult) { 
		this.method = testResult.getMethod().getMethodName(); 
		super.run(callBack, testResult); 
	} 
 
	@BeforeTransaction 
	public void beforeTransaction() { 
		deleteFromTables("user"); 
		executeSqlScript("classpath:/org/springframework/test/context/jdbc/data.sql", false); 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:assertEquals, assertNotNull
        Component component = PersistedObjectsFactory.getDefaultComponent(); 
        session.save(component); 
 
        Component result = componentDao.get(component.getId()); 
 
        assertNotNull(result); 
        assertEquals(result.getId(), component.getId()); 
        assertEquals(result.getProperties().size(), 2); 
    } 
 
 
    @Test 
    public void testGetInvalidId() { 
        Component result = componentDao.get(-567890L); 
 
        assertNull(result); 
    } 
 
    @Test 
    public void testUpdate() { 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
/** 
 * Created By xiaoliangl on 9/3/14. 
 */ 
@ContextConfiguration(locations = {"classpath:/META-INF/spring/*-context.xml"}) 
public class TestAppMgrDao extends AbstractTransactionalTestNGSpringContextTests { 
   @Autowired 
   IAppManagerDAO appManagerDAO; 
 
   @Test(expectedExceptions = DataIntegrityViolationException.class) 
   @Transactional(propagation = Propagation.NEVER) //simulate two concurrent TXs: one user is inserting a APPManager, which another is doing the same. 
   public void testPrimaryKeyViolation() { 
      AppManagerEntity appManagerAddDefault = new AppManagerEntity(); 
      appManagerAddDefault.setName("fooAppMgr"); 
      appManagerAddDefault.setDescription("fooAppMgr"); 
      appManagerAddDefault.setType("fooAppMgr"); 
      appManagerAddDefault.setUrl(""); 
      appManagerAddDefault.setUsername(""); 
      appManagerAddDefault.setPassword(""); 
      appManagerAddDefault.setSslCertificate(""); 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
import org.testng.annotations.Test; 
 
import com.vmware.bdd.apitypes.RackInfo; 
 
@ContextConfiguration(locations = { "classpath:/spring/*-context.xml" }) 
public class TestRackInfoManager extends 
      AbstractTransactionalTestNGSpringContextTests { 
   @Autowired 
   RackInfoManager rim; 
 
   @BeforeMethod 
   public void setup() { 
 
   } 
 
   @AfterMethod 
   public void tearDown() { 
 
   } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * @author Elena Lepaeva 
 */ 
@ContextConfiguration(locations = {"classpath:/org/jtalks/jcommune/model/entity/applicationContext-dao.xml"}) 
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) 
@Transactional 
public class ForumStatisticsHibernateDaoTest extends AbstractTransactionalTestNGSpringContextTests { 
 
    @Autowired 
    private ForumStatisticsDao dao; 
    @Autowired 
    private SessionFactory sessionFactory; 
    private Session session; 
 
    @BeforeMethod 
    public void setUp() throws Exception { 
        session = sessionFactory.getCurrentSession(); 
        PersistedObjectsFactory.setSession(session); 
    } 
 
    @Test 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * 
 */ 
@ContextConfiguration(locations = {"classpath:/org/jtalks/jcommune/model/entity/applicationContext-dao.xml"}) 
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) 
@Transactional 
public class PropertyHibernateDaoTest  extends AbstractTransactionalTestNGSpringContextTests { 
    private static final String PROPERTY_NAME = "property_name"; 
    private Property property = new Property(PROPERTY_NAME, "value"); 
    @Autowired 
    private SessionFactory sessionFactory; 
    @Autowired 
    private PropertyDao propertyDao; 
    private Session session; 
     
    @BeforeMethod 
    public void setUp() { 
        session = sessionFactory.getCurrentSession(); 
    } 
     
    /*===== Common methods =====*/ 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:assertEquals
            DateTime creationDatePrevious = postList.get(i - 1).getCreationDate(); 
            DateTime creationDate = postList.get(i).getCreationDate(); 
            assertTrue(creationDatePrevious.compareTo(creationDate) >= 0); 
        } 
 
        assertEquals(postsPage.getContent().size(), pageSize, "Incorrect count of posts in one page."); 
        assertEquals(postsPage.getTotalElements(), totalSize, "Incorrect total count."); 
        assertEquals(postsPage.getTotalPages(), pageCount, "Incorrect count of pages."); 
        assertEquals(postsPage.getNumber(), 1, "Incorrect page number"); 
    } 
 
    @Test 
    public void testPostOfUserWithEnabledPagingPageTooBig() { 
        int totalSize = 50; 
        int pageCount = 2; 
        int pageSize = totalSize / pageCount; 
 
        PageRequest pageRequest = new PageRequest( 
                PAGE_NUMBER_TOO_BIG, pageSize); 
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize); 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * @author Anuar Nurmakanov 
 */ 
@ContextConfiguration(locations = {"classpath:/org/jtalks/jcommune/model/entity/applicationContext-dao.xml"}) 
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) 
@Transactional 
public class PollHibernateDaoTest extends AbstractTransactionalTestNGSpringContextTests { 
    @Autowired 
    private SessionFactory sessionFactory; 
    @Autowired 
    private Crud<Poll> pollDao; 
    private Session session; 
 
    @BeforeMethod 
    public void setUp() { 
        session = sessionFactory.getCurrentSession(); 
        PersistedObjectsFactory.setSession(session); 
    } 
 
    /*===== Common methods =====*/ 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 * @author Anuar Nurmakanov 
 */ 
@ContextConfiguration(locations = {"classpath:/org/jtalks/jcommune/model/entity/applicationContext-dao.xml"}) 
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) 
@Transactional 
public class PollOptionHibernateDaoTest extends AbstractTransactionalTestNGSpringContextTests { 
    @Autowired 
    private SessionFactory sessionFactory; 
    @Autowired 
    private Crud<PollItem> pollOptionDao; 
    private Session session; 
 
    @BeforeMethod 
    public void setUp() { 
        session = sessionFactory.getCurrentSession(); 
        PersistedObjectsFactory.setSession(session); 
    } 
 
    /*===== Common methods =====*/ 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java