use of org.eclipse.persistence.sessions.DatabaseRecord in project eclipselink by eclipse-ee4j.
the class PLSQLrecordOutTestSet method runQuery.
@Test
public void runQuery() {
DatabaseSession s = project.createDatabaseSession();
s.dontLogMessages();
s.login();
OutputRowSessionEventAdapter outputParametersDetected = new OutputRowSessionEventAdapter();
s.getEventManager().addListener(outputParametersDetected);
boolean worked = false;
String msg = null;
Object result = null;
Object outputRow = null;
try {
result = s.executeQuery("PLSQLrecordOut", PLSQLEmployeeType.class);
worked = true;
outputRow = outputParametersDetected.getEventResult();
} catch (Exception e) {
msg = e.getMessage();
}
assertTrue("invocation rec_test_out failed: " + msg, worked);
assertNotNull("result is supposed to be not-null", result);
DatabaseRecord record = (DatabaseRecord) outputRow;
assertTrue("incorrect EMPNO", record.get("EMPNO").equals(new BigDecimal(1234)));
assertTrue("incorrect ENAME", record.get("ENAME").equals("GOOFY"));
assertTrue("incorrect JOB", record.get("JOB").equals("ACTOR"));
assertNull("MGR is supposed to be null", record.get("MGR"));
assertNull("HIREDATE is supposed to be null", record.get("HIREDATE"));
assertTrue("incorrect SAL", record.get("SAL").equals(6000.0));
assertNull("COMM is supposed to be null", record.get("COMM"));
assertTrue("incorrect DEPTNO", record.get("DEPTNO").equals(new BigDecimal(20)));
s.logout();
}
use of org.eclipse.persistence.sessions.DatabaseRecord in project eclipselink by eclipse-ee4j.
the class joNijiNoTestSet method runQuery.
@SuppressWarnings("unchecked")
@Test
public void runQuery() {
DatabaseSession s = project.createDatabaseSession();
s.dontLogMessages();
s.login();
Object o = null;
Vector queryArgs = new NonSynchronizedVector();
queryArgs.add(100);
queryArgs.add(101);
boolean worked = false;
String msg = null;
try {
o = s.executeQuery("joNijiNo", Empty.class, queryArgs);
worked = true;
} catch (Exception e) {
msg = e.getMessage();
}
assertTrue("invocation joNijiNo failed: " + msg, worked);
Vector results = (Vector) o;
DatabaseRecord record = (DatabaseRecord) results.get(0);
String y = (String) record.get("X");
assertTrue("wrong y value", y.equals("test"));
Integer aa = (Integer) record.get("AA");
assertTrue("wrong aa value", aa == 1);
s.logout();
}
use of org.eclipse.persistence.sessions.DatabaseRecord in project eclipselink by eclipse-ee4j.
the class joNijijoTestSet method runQuery.
@SuppressWarnings("unchecked")
@Test
public void runQuery() {
DatabaseSession s = project.createDatabaseSession();
s.dontLogMessages();
s.login();
Object o = null;
Vector queryArgs = new NonSynchronizedVector();
queryArgs.add(100);
queryArgs.add(101);
boolean worked = false;
String msg = null;
try {
o = s.executeQuery("joNijiNo", Empty.class, queryArgs);
worked = true;
} catch (Exception e) {
msg = e.getMessage();
}
assertTrue("invocation joNijiNo failed: " + msg, worked);
Vector results = (Vector) o;
DatabaseRecord record = (DatabaseRecord) results.get(0);
String y = (String) record.get("X");
assertTrue("wrong y value", y.equals("test"));
Integer aa = (Integer) record.get("AA");
assertTrue("wrong aa value", aa == 1);
s.logout();
}
use of org.eclipse.persistence.sessions.DatabaseRecord in project eclipselink by eclipse-ee4j.
the class joNijioTestSet method runQuery.
@SuppressWarnings("unchecked")
@Test
public void runQuery() {
DatabaseSession s = project.createDatabaseSession();
s.dontLogMessages();
s.login();
Object o = null;
Vector queryArgs = new NonSynchronizedVector();
queryArgs.add(1);
queryArgs.add("test");
boolean worked = false;
String msg = null;
try {
o = s.executeQuery("joNijio", Empty.class, queryArgs);
worked = true;
} catch (Exception e) {
msg = e.getMessage();
}
assertTrue("invocation joNijio failed: " + msg, worked);
Vector results = (Vector) o;
DatabaseRecord record = (DatabaseRecord) results.get(0);
BigDecimal x = (BigDecimal) record.get("X");
assertTrue("wrong x value", x.intValue() == 51);
String z = (String) record.get("Z");
assertTrue("wrong z value", z.equals("test-thingie"));
s.logout();
}
use of org.eclipse.persistence.sessions.DatabaseRecord in project eclipselink by eclipse-ee4j.
the class jiNioTestSet method runQuery.
@SuppressWarnings("unchecked")
@Test
public void runQuery() {
DatabaseSession s = project.createDatabaseSession();
s.dontLogMessages();
s.login();
Object o = null;
Vector queryArgs = new NonSynchronizedVector();
queryArgs.add("test");
queryArgs.add(1);
boolean worked = false;
String msg = null;
try {
o = s.executeQuery("jiNio", Empty.class, queryArgs);
worked = true;
} catch (Exception e) {
msg = e.getMessage();
}
assertTrue("invocation jiNio failed: " + msg, worked);
Vector results = (Vector) o;
DatabaseRecord record = (DatabaseRecord) results.get(0);
Integer bool2int = (Integer) record.get("Y");
assertTrue("wrong bool2int value", bool2int == 0);
s.logout();
}
Aggregations