All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jpattern.orm.test.session.DataSourceConnectionTest Maven / Gradle / Ivy

The newest version!
package com.jpattern.orm.test.session;

import org.junit.Test;

import com.jpattern.orm.BaseTestShared;
import com.jpattern.orm.mapper.NullOrmClassToolMap;
import com.jpattern.orm.persistor.type.TypeFactory;
import com.jpattern.orm.session.OrmSession;
import com.jpattern.orm.session.Session;
import com.jpattern.orm.session.SessionProvider;
import com.jpattern.orm.transaction.Transaction;
import com.jpattern.orm.validator.NullValidator;

/**
 * 
 * @author Francesco Cina
 *
 * 05/giu/2011
 */
public class DataSourceConnectionTest extends BaseTestShared {

	@Override
	protected void setUp() throws Exception {
	}

	@Override
	protected void tearDown() throws Exception {
	}

	@Test
	public void testConnections() throws Exception {
		final SessionProvider provider = getJPOrm().getSessionProvider();
		loopTransaction( provider );
		loopConnection( provider );
	}

	public void loopTransaction(final SessionProvider dsProvider) throws Exception {
		final Session conn = new OrmSession(new NullOrmClassToolMap(), dsProvider.getSessionStrategy(), new TypeFactory(), new NullValidator());

		final int howMany = 1000;

		for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy