use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class RMIIIOPRemoteModel method createConnection.
public RMIConnection createConnection() {
RMIServerManager serverManager = null;
Context initialNamingContext = null;
try {
initialNamingContext = new InitialContext();
} catch (NamingException exception) {
System.out.println("Naming Exception " + exception.toString());
}
;
// Set the client security manager
try {
System.setSecurityManager(new RMISecurityManager());
} catch (Exception exception) {
System.out.println("Security violation " + exception.toString());
}
// Get the remote factory object from the Registry
try {
serverManager = (RMIServerManager) initialNamingContext.lookup("SERVER-MANAGER");
} catch (Exception exception) {
throw new TestProblemException(exception.toString());
}
RMIConnection rmiConnection = null;
try {
rmiConnection = new RMIConnection(serverManager.createRemoteSessionController());
} catch (RemoteException exception) {
System.out.println("Error in invocation " + exception.toString());
}
return rmiConnection;
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class SessionsXMLBasicTestModel method setup.
@Override
public void setup() {
originalSession = getSession();
if ((getSession().getPlatform() instanceof TimesTenPlatform)) {
throw new TestProblemException("This model is not intended for TimesTen databases.");
}
XMLSessionConfigLoader xmlLoader = new XMLSessionConfigLoader("org/eclipse/persistence/testing/models/sessionsxml/sessions.xml");
// Do not login here, login later on.
newXMLSession = SessionManager.getManager().getSession(xmlLoader, "EmployeeSession", getClass().getClassLoader(), false, true);
newXMLSession.setSessionLog(originalSession.getSessionLog());
newXMLSession.setLogLevel(originalSession.getLogLevel());
((DatabaseSession) originalSession).logout();
newXMLSession.getLogin().setPlatform(originalSession.getLogin().getPlatform());
newXMLSession.getLogin().setDriverClassName(originalSession.getLogin().getDriverClassName());
newXMLSession.getLogin().setConnectionString(originalSession.getLogin().getConnectionString());
newXMLSession.getLogin().setUserName(originalSession.getLogin().getUserName());
newXMLSession.getLogin().setEncryptedPassword(originalSession.getLogin().getPassword());
((DatabaseSession) newXMLSession).login();
getExecutor().setSession(newXMLSession);
new EmployeeSystem().createTables((DatabaseSession) newXMLSession);
new EmployeeSystem().populate((DatabaseSession) newXMLSession);
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class SessionsXMLTestModel method addSessionsXMLSchemaWriteTest.
public void addSessionsXMLSchemaWriteTest(TestSuite suite) {
try {
Class<?> testCaseClass = Class.forName("org.eclipse.persistence.testing.tests.sessionsxml.SessionsXMLSchemaWriteTest");
junit.framework.Test testCase = (junit.framework.Test) testCaseClass.getConstructor().newInstance();
suite.addTest(testCase);
} catch (Exception e) {
getSession().logMessage("Unable to load SessionsXMLSchemaWriteTest. This usually occurs when the tests were compiled " + " on a non-Oracle environment. If you are not running on Oracle, this is not a problem.");
if (getSession().getPlatform().isOracle()) {
throw new TestProblemException("Could not load: SessionsXMLSchemaWriteTest", e);
}
}
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class AddDescriptorsMultithreadedTest method createMultithreadedTest.
protected static AddDescriptorsMultithreadedTest createMultithreadedTest(int nAddDescriptorsTests, long timeToSleepBetweenAddingDescriptors, String testName, int nTests, long timeToStopTests) {
AddDescriptorsMultithreadedTest test = new AddDescriptorsMultithreadedTest();
Vector tests = new Vector(nAddDescriptorsTests + nTests);
InterfaceHashtableProject project = new InterfaceHashtableProject();
for (int i = 0; i < nAddDescriptorsTests; i++) {
tests.add(new AddDescriptorsTest(i, nAddDescriptorsTests, timeToSleepBetweenAddingDescriptors, project));
}
for (int i = 0; i < nTests; i++) {
if (testName.equals("SequencePreallocationTest")) {
tests.add(new SequencePreallocationTest(i));
} else if (testName.equals("InsertTest")) {
tests.add(new InsertTest(i, nTests));
} else {
throw new TestProblemException("Unknown test name: " + testName);
}
}
if (nAddDescriptorsTests == 0 && timeToStopTests > 0) {
tests.add(new Timer(timeToStopTests));
}
test.setTests(tests);
test.generateTestName();
return test;
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class GetObjectFromIdentityMapTest method setup.
@Override
public void setup() {
getSession().getIdentityMapAccessor().initializeIdentityMaps();
ExpressionBuilder employees = new ExpressionBuilder();
employee = (Employee) getSession().readObject(Employee.class);
if (employee == null) {
throw new TestProblemException("No employees available");
}
}
Aggregations