Search in sources :

Example 6 with TestWarningException

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

the class LockOnCloneDeadlockAvoidanceTest method setup.

@Override
public void setup() {
    if (getSession().isDistributedSession()) {
        throw new TestWarningException("Test unavailable on Remote UnitOfWork because of timing issues");
    }
    getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
    getSession().getDescriptor(ConcurrentAddress.class).getEventManager().addListener(listener);
    UnitOfWork uow = getSession().acquireUnitOfWork();
    this.person = (ConcurrentPerson) uow.registerObject(ConcurrentPerson.example1());
    uow.commit();
    ConcurrentAddress.RUNNING_TEST = ConcurrentAddress.LOCK_ON_CLONE_DEADLOCK;
}
Also used : UnitOfWork(org.eclipse.persistence.sessions.UnitOfWork) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 7 with TestWarningException

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

the class ReportQueryFunctionTypeTestCase method test.

@Override
public void test() {
    // on all platforms.
    if (getSession().getLogin().getDriverClassName().equals("com.oracle.ias.jdbc.db2.DB2Driver")) {
        throw new TestWarningException("This test is not supported on DB2 DataDirect");
    } else {
        ReportQuery reportQuery = new ReportQuery();
        reportQuery.setReferenceClass(Employee.class);
        ExpressionBuilder builder = reportQuery.getExpressionBuilder();
        reportQuery.addAverage("salary-ave", builder.get("salary"));
        // Oracle specific function.
        if (getSession().getDatasourcePlatform().isOracle()) {
            reportQuery.addVariance("salary-var", builder.get("salary"));
        }
        // Sybase, Symfoware (bug 304909) and TimesTen don't support
        if (!(getSession().getDatasourcePlatform().isSybase() || getSession().getDatasourcePlatform().isTimesTen() || getSession().getDatasourcePlatform().isDerby() || getSession().getDatasourcePlatform().isSymfoware())) {
            reportQuery.addStandardDeviation("salary-std", builder.get("salary"));
        }
        reportQuery.addSum("id-sum", builder.get("id"));
        reportQuery.addMinimum("id-min", builder.get("id"));
        reportQuery.addMaximum("id-max", builder.get("id"));
        if (this.shouldHaveReadAllQueryInDescriptor) {
            ClassDescriptor desc = getSession().getDescriptor(Employee.class);
            if (!desc.getQueryManager().hasReadAllQuery()) {
                desc.getQueryManager().setReadAllQuery(new ReadAllQuery());
                hasSetReadAllQueryIntoDescriptor = true;
            }
        }
        results = (Vector<ReportQueryResult>) getSession().executeQuery(reportQuery);
    }
}
Also used : ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) ReportQuery(org.eclipse.persistence.queries.ReportQuery) ReadAllQuery(org.eclipse.persistence.queries.ReadAllQuery) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException) ReportQueryResult(org.eclipse.persistence.queries.ReportQueryResult)

Example 8 with TestWarningException

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

the class ClassForInheritanceTestCase method setup.

@Override
protected void setup() throws Exception {
    if (getSession().isRemoteSession()) {
        throw new TestWarningException("This Test is not designed to work with RemoteSessions.");
    }
    super.setup();
    ExpressionBuilder builder = new ExpressionBuilder();
    reportQuery = new ReportQuery(Project.class, builder);
    reportQuery.addItem("Type", builder.type());
    reportQuery.addItem("project", builder);
}
Also used : ReportQuery(org.eclipse.persistence.queries.ReportQuery) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 9 with TestWarningException

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

the class BatchCommitTransactionExceptionTest method test.

@Override
public void test() {
    Session session = getSession();
    DatabasePlatform plat = session.getPlatform();
    // test to fail on MYSQL. Tracking bug 335724
    if (plat.isOracle() || plat.isSQLServer() || plat.isSybase() || plat.isSQLAnywhere() || plat.isMySQL() || plat.isSymfoware()) {
        DatabaseLogin login = session.getLogin();
        login.useBatchWriting();
        try {
            ((DatabaseSession) session).beginTransaction();
            session.executeNonSelectingCall(new org.eclipse.persistence.queries.SQLCall("Insert into BOB Value"));
            ((DatabaseSession) session).commitTransaction();
        } catch (org.eclipse.persistence.exceptions.EclipseLinkException e) {
            this.caughtException = e;
            ((DatabaseSession) session).rollbackTransaction();
        }
    } else {
        throw new TestWarningException("Test not run on this database platform");
    }
}
Also used : DatabaseLogin(org.eclipse.persistence.sessions.DatabaseLogin) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) DatabasePlatform(org.eclipse.persistence.internal.databaseaccess.DatabasePlatform) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Session(org.eclipse.persistence.sessions.Session) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException)

Example 10 with TestWarningException

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

the class XMLProjectWriterTestModel method addTests.

@Override
public void addTests() {
    // Employee Tests
    TestSuite employeeSuite = new TestSuite();
    employeeSuite.setName("EmployeeModel");
    employeeSuite.addTest(EmployeeBasicTestModel.getReadObjectTestSuite());
    employeeSuite.addTest(EmployeeBasicTestModel.getUpdateObjectTestSuite());
    employeeSuite.addTest(EmployeeBasicTestModel.getInsertObjectTestSuite());
    employeeSuite.addTest(EmployeeBasicTestModel.getDeleteObjectTestSuite());
    employeeSuite.addTest(EmployeeBasicTestModel.getReadAllTestSuite());
    addTest(employeeSuite);
    // Inheritance Tests
    TestSuite inheritanceSuite = new TestSuite();
    inheritanceSuite.setName("InheritanceModel");
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getDuplicateFieldTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getReadObjectTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getReadAllTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getDeleteObjectTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getInsertObjectTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getUpdateObjectTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getUnitOfWorkTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getUnitOfWorkCommitResumeTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getDeepInheritanceTestSuite());
    inheritanceSuite.addTest(org.eclipse.persistence.testing.tests.inheritance.InheritanceTestModel.getTranslatedKeyInheritanceTestSuite());
    addTest(inheritanceSuite);
    // Aggregate Tests
    TestSuite aggregateSuite = new TestSuite();
    aggregateSuite.setName("AggregateModel");
    boolean useNewAggregateCollectionOriginal = AggregateTestModel.useNewAggregateCollection;
    // MW doesn't support new AggregateCollection apis - temporary set the flag to false
    AggregateTestModel.useNewAggregateCollection = false;
    aggregateSuite.addTest(AggregateTestModel.getReadObjectTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getUpdateObjectTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getReadAllTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getDeleteObjectTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getInsertObjectTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getUnitOfWorkTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getUnitOfWorkCommitResumeTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getCheckForNullUnitOfWorkTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getMergingUnitOfWorkTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getDescriptorPropertiesTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getEventTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getNestedAggregateTestSuite());
    aggregateSuite.addTest(AggregateTestModel.getAggregateInheritanceTestSuite());
    // reset the original value
    AggregateTestModel.useNewAggregateCollection = useNewAggregateCollectionOriginal;
    addTest(aggregateSuite);
    // Interface Tests
    TestSuite interfaceSuite = new TestSuite();
    interfaceSuite.setName("InterfaceModel");
    interfaceSuite.addTest(InterfaceWithoutTablesTestModel.getReadObjectTestSuite());
    interfaceSuite.addTest(InterfaceWithoutTablesTestModel.getUpdateObjectTestSuite());
    interfaceSuite.addTest(InterfaceWithoutTablesTestModel.getReadAllTestSuite());
    interfaceSuite.addTest(InterfaceWithoutTablesTestModel.getDeleteObjectTestSuite());
    interfaceSuite.addTest(InterfaceWithoutTablesTestModel.getInsertObjectTestSuite());
    addTest(interfaceSuite);
    // ExpressionPersistenceTests
    addTest(new org.eclipse.persistence.testing.tests.workbenchintegration.ExpressionPersistence.ExpressionPersistenceTestSuite());
    // ReportQuery
    addTest(new org.eclipse.persistence.testing.tests.workbenchintegration.ExpressionPersistence.ReportQueryTestSuite());
    // Query options
    addTest(new org.eclipse.persistence.testing.tests.workbenchintegration.QueryOptions.QueryOptionTestSuite());
    TestSuite readAndWriteSuite = new TestSuite();
    readAndWriteSuite.setName("XMLReadAndWriteSuite");
    readAndWriteSuite.setDescription("Tests to ensure various project options are properly read and written in XML.");
    readAndWriteSuite.addTest(new QueryShouldMaintainCacheTest());
    readAndWriteSuite.addTest(new ProjectXMLDatabaseTableNameTest());
    readAndWriteSuite.addTest(new ProjectXMLOrderByQueryKeysTest());
    readAndWriteSuite.addTest(new ProjectXMLQueryManagerQueryOrderTest());
    // bug 295383
    readAndWriteSuite.addTest(new EventListenerCollectionTest());
    addTest(readAndWriteSuite);
    TestSuite mappingSuite = new TestSuite();
    mappingSuite.setName("MappingSuite");
    mappingSuite.setDescription("Tests to ensure mappings are properly written to and read from XML.");
    mappingSuite.addTest(new DirectMapMappingTest());
    mappingSuite.addTest(new MergeChangeSetWithDirectMapMappingTest());
    mappingSuite.addTest(new DirectMapMappingDeleteTest());
    mappingSuite.addTest(new DirectMapMappingBatchReadTest());
    mappingSuite.addTest(new DirectMapMappingIndirectionTest());
    addTest(mappingSuite);
    TestSuite proxyIndirectSuite = new TestSuite();
    proxyIndirectSuite.setName("ProxyIndirectionSuite");
    proxyIndirectSuite.setDescription("Tests to ensure proxy indirection is properly written to and read from XML.");
    proxyIndirectSuite.addTest(ProxyIndirectionTestModel.getDeleteTestSuite());
    proxyIndirectSuite.addTest(ProxyIndirectionTestModel.getReadTestSuite());
    proxyIndirectSuite.addTest(ProxyIndirectionTestModel.getUnitOfWorkTestSuite());
    proxyIndirectSuite.addTest(ProxyIndirectionTestModel.getWriteTestSuite());
    proxyIndirectSuite.addTest(ProxyIndirectionTestModel.getProxyObjectTestSuite());
    addTest(proxyIndirectSuite);
    // Insurance model test
    class TestSuiteOracleOnly extends TestSuite {

        @Override
        public void setup() {
            if (!getSession().getPlatform().isOracle9()) {
                throw new TestWarningException("This test suite is intended for Oracle databases only.");
            }
        }
    }
    TestSuiteOracleOnly insuranceORTestSuite = new TestSuiteOracleOnly();
    insuranceORTestSuite.setName("InsuranceORTestModel");
    insuranceORTestSuite.setDescription("Tests to enusre Insurance - object relationship descriptor - is properly written to and read from XML.");
    insuranceORTestSuite.addTest(InsuranceObjectRelationalTestModel.getDeleteObjectTestSuite());
    insuranceORTestSuite.addTest(InsuranceObjectRelationalTestModel.getInsertObjectTestSuite());
    insuranceORTestSuite.addTest(InsuranceObjectRelationalTestModel.getReadAllTestSuite());
    insuranceORTestSuite.addTest(InsuranceObjectRelationalTestModel.getReadObjectTestSuite());
    insuranceORTestSuite.addTest(InsuranceObjectRelationalTestModel.getUpdateObjectTestSuite());
    addTest(insuranceORTestSuite);
    // Mapping model test
    TestSuite mappingTestSuite = new TestSuite();
    mappingTestSuite.setName("MappingTestModel");
    mappingTestSuite.setDescription("Tests to enusre mapping model is properly written to and read from XML.");
    mappingTestSuite.addTest(MappingTestModel.getReadObjectTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getReadAllTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getDeleteObjectTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getInsertObjectTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getUpdateObjectTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getUnitOfWorkTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getPublic1MTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getPrivateMMTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getTransformationMappingTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getUnitOfWorkCommitResumeTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getBidirectionalUnitOfWorkTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getAdditionalJoinTest());
    mappingTestSuite.addTest(MappingTestModel.getBuildSelectionCriteriaTestSuite());
    mappingTestSuite.addTest(MappingTestModel.getSameNameMappingTestSuite());
    addTest(mappingTestSuite);
    // Multiple table model test
    TestSuite multipleTableTestSuite = new TestSuite();
    multipleTableTestSuite.setName("MultipleTableTestModel");
    MultipleTableModel.addTestsToTestCollection(multipleTableTestSuite);
    addTest(multipleTableTestSuite);
}
Also used : DirectMapMappingDeleteTest(org.eclipse.persistence.testing.tests.directmap.DirectMapMappingDeleteTest) MergeChangeSetWithDirectMapMappingTest(org.eclipse.persistence.testing.tests.directmap.MergeChangeSetWithDirectMapMappingTest) TestWarningException(org.eclipse.persistence.testing.framework.TestWarningException) TestSuite(org.eclipse.persistence.testing.framework.TestSuite) DirectMapMappingIndirectionTest(org.eclipse.persistence.testing.tests.directmap.DirectMapMappingIndirectionTest) MergeChangeSetWithDirectMapMappingTest(org.eclipse.persistence.testing.tests.directmap.MergeChangeSetWithDirectMapMappingTest) DirectMapMappingBatchReadTest(org.eclipse.persistence.testing.tests.directmap.DirectMapMappingBatchReadTest)

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