Search in sources :

Example 1 with TestWarningException

use of org.eclipse.persistence.testing.framework.TestWarningException in project eclipselink by eclipse-ee4j.

the class ScrollableCursorJoinedAttributeTest method test.

@Override
public void test() {
    if (getSession().getPlatform().isHANA() || getSession().getPlatform().isSQLServer()) {
        throw new TestWarningException("ScrollableCursor is not supported on this platform");
    }
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    cursoredResults = new Vector();
    ReadAllQuery cursoredQuery = new ReadAllQuery(Employee.class);
    cursoredQuery.useScrollableCursor();
    cursoredQuery.addJoinedAttribute(cursoredQuery.getExpressionBuilder().anyOfAllowingNone("phoneNumbers"));
    cursoredQuery.addOrdering(cursoredQuery.getExpressionBuilder().get("id"));
    try {
        ScrollableCursor cursor = (ScrollableCursor) getSession().executeQuery(cursoredQuery);
        while (cursor.hasNext()) {
            Object result = cursor.next();
            cursoredResults.add(result);
        }
        cursor.close();
    } catch (Exception e) {
        caughtException = e;
    }
}
Also used : ScrollableCursor(org.eclipse.persistence.queries.ScrollableCursor) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) Vector(java.util.Vector) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 2 with TestWarningException

use of org.eclipse.persistence.testing.framework.TestWarningException in project eclipselink by eclipse-ee4j.

the class ScrollableCursorJoiningVerificationTest method test.

@Override
public void test() {
    if (getSession().getPlatform().isHANA() || getSession().getPlatform().isSQLServer()) {
        throw new TestWarningException("ScrollableCursor is not supported on this platform");
    }
    // non-cursored results
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    ReadAllQuery nonCursoredQuery = new ReadAllQuery(Employee.class);
    nonCursoredQuery.dontCheckCache();
    nonCursoredQuery.addJoinedAttribute(nonCursoredQuery.getExpressionBuilder().anyOfAllowingNone("phoneNumbers"));
    nonCursoredQuery.addOrdering(nonCursoredQuery.getExpressionBuilder().get("id"));
    nonCursoredResults = (List) getSession().executeQuery(nonCursoredQuery);
    // forward cursored results
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    forwardCursoredResults = new ArrayList<Employee>();
    ReadAllQuery cursoredQuery = new ReadAllQuery(Employee.class);
    nonCursoredQuery.dontCheckCache();
    cursoredQuery.useScrollableCursor();
    cursoredQuery.addJoinedAttribute(cursoredQuery.getExpressionBuilder().anyOfAllowingNone("phoneNumbers"));
    cursoredQuery.addOrdering(cursoredQuery.getExpressionBuilder().get("id"));
    ScrollableCursor cursor = (ScrollableCursor) getSession().executeQuery(cursoredQuery);
    while (cursor.hasNext()) {
        Employee result = (Employee) cursor.next();
        forwardCursoredResults.add(result);
    }
    // reverse cursored results - use the same cursor
    reverseCursoredResults = new ArrayList();
    while (cursor.hasPrevious()) {
        Employee result = (Employee) cursor.previous();
        reverseCursoredResults.add(result);
    }
    cursor.close();
}
Also used : Employee(org.eclipse.persistence.testing.models.employee.domain.Employee) ScrollableCursor(org.eclipse.persistence.queries.ScrollableCursor) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) ArrayList(java.util.ArrayList) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 3 with TestWarningException

use of org.eclipse.persistence.testing.framework.TestWarningException in project eclipselink by eclipse-ee4j.

the class DeepMergeCloneIndirectionTest method setup.

@Override
public void setup() {
    if (getSession() instanceof org.eclipse.persistence.sessions.remote.RemoteSession) {
        throw new TestWarningException("This test cannot be run through the remote.");
    }
    getAbstractSession().beginTransaction();
    this.orderObject = new Order();
    this.orderObject.contacts = IndirectCollectionsFactory.createIndirectList();
    this.orderObject.lines = IndirectCollectionsFactory.createIndirectList();
    this.orderObject.setTotal(56789);
    this.orderObject.customerName = "henry";
    // Using a unit of work here becuase this test is used in the clientSession Tests
    UnitOfWork uow = getSession().acquireUnitOfWork();
    uow.registerObject(this.orderObject);
    uow.commit();
}
Also used : Order(org.eclipse.persistence.testing.models.transparentindirection.Order) UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 4 with TestWarningException

use of org.eclipse.persistence.testing.framework.TestWarningException in project eclipselink by eclipse-ee4j.

the class ConcurrentRefreshOnCloneTest method setup.

@Override
public void setup() {
    if (getSession().isDistributedSession()) {
        throw new TestWarningException("Test unavailable on Remote UnitOfWork because of timing issues");
    }
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    ConcurrentRefreshOnCloneTest.session = getSession();
    ConcurrentRefreshOnCloneTest.waited = false;
    ConcurrentAddress newAddress = new ConcurrentAddress();
    newAddress.id = new BigDecimal(15);
    newAddress.city = "Meductic";
    newAddress.country = "Canada";
    newAddress.postalCode = "C1C 1C1";
    newAddress.province = "New Brunswick";
    newAddress.street = "St. Jermone";
    UnitOfWork uow = getSession().acquireUnitOfWork();
    uow.registerObject(newAddress);
    uow.commit();
    ConcurrentRefreshOnCloneTest.lock = newAddress;
    this.originalIsolationLevel = getSession().getLogin().getCacheTransactionIsolation();
    getSession().getLogin().setCacheTransactionIsolation(org.eclipse.persistence.sessions.DatasourceLogin.SYNCHRONIZED_READ_ON_WRITE);
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) BigDecimal(java.math.BigDecimal) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 5 with TestWarningException

use of org.eclipse.persistence.testing.framework.TestWarningException in project eclipselink by eclipse-ee4j.

the class NoIdentityMergeCloneTest method setup.

@Override
public void setup() {
    if (getSession() instanceof org.eclipse.persistence.sessions.remote.RemoteSession) {
        throw new TestWarningException("Not support in remote");
    }
    super.setup();
    // Have to keep track of what the setting for existence checking and IM types on a per descriptor basis
    // because it may not be the same for all descriptors.
    this.checkCacheState = new Hashtable(10);
    this.identityMapTypes = new Hashtable(10);
    Iterator<ClassDescriptor> iterator = getSession().getProject().getDescriptors().values().iterator();
    while (iterator.hasNext()) {
        ClassDescriptor descriptor = iterator.next();
        checkCacheState.put(descriptor, descriptor.getQueryManager().getDoesExistQuery().getExistencePolicy());
        if (descriptor.requiresInitialization((AbstractSession) getSession())) {
            // identityMapClass is null for AggregateObject, AggregateMapping and Interface descriptors.
            identityMapTypes.put(descriptor, descriptor.getIdentityMapClass());
        }
    }
    getSession().getProject().checkDatabaseForDoesExist();
    getSession().getProject().useCacheIdentityMap(1);
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
}
Also used : ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) Hashtable(java.util.Hashtable) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Aggregations

TestWarningException (org.eclipse.persistence.testing.framework.TestWarningException)29 UnitOfWork (org.eclipse.persistence.sessions.UnitOfWork)9 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)7 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)5 ExpressionBuilder (org.eclipse.persistence.expressions.ExpressionBuilder)4 BigDecimal (java.math.BigDecimal)3 Vector (java.util.Vector)3 ReadAllQuery (org.eclipse.persistence.queries.ReadAllQuery)3 Employee (org.eclipse.persistence.testing.models.employee.domain.Employee)3 DataSource (javax.sql.DataSource)2 DatabasePlatform (org.eclipse.persistence.internal.databaseaccess.DatabasePlatform)2 AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)2 ReportQuery (org.eclipse.persistence.queries.ReportQuery)2 ScrollableCursor (org.eclipse.persistence.queries.ScrollableCursor)2 DatabaseLogin (org.eclipse.persistence.sessions.DatabaseLogin)2 JNDIConnector (org.eclipse.persistence.sessions.JNDIConnector)2 TestProblemException (org.eclipse.persistence.testing.framework.TestProblemException)2 Address (org.eclipse.persistence.testing.models.employee.domain.Address)2 Order (org.eclipse.persistence.testing.models.transparentindirection.Order)2 Connection (java.sql.Connection)1