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;
}
}
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();
}
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();
}
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);
}
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();
}
Aggregations