Search in sources :

Example 16 with NonSynchronizedVector

use of org.eclipse.persistence.internal.helper.NonSynchronizedVector 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();
}
Also used : DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Vector(java.util.Vector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) Test(org.junit.Test)

Example 17 with NonSynchronizedVector

use of org.eclipse.persistence.internal.helper.NonSynchronizedVector 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();
}
Also used : DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Vector(java.util.Vector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 18 with NonSynchronizedVector

use of org.eclipse.persistence.internal.helper.NonSynchronizedVector in project eclipselink by eclipse-ee4j.

the class jiNiTestSet method runQuery.

@SuppressWarnings("unchecked")
@Test
public void runQuery() {
    DatabaseSession s = project.createDatabaseSession();
    s.dontLogMessages();
    s.login();
    Vector queryArgs = new NonSynchronizedVector();
    queryArgs.add("test");
    queryArgs.add(0);
    boolean worked = false;
    String msg = null;
    try {
        s.executeQuery("jiNi", Empty.class, queryArgs);
        worked = true;
    } catch (Exception e) {
        msg = e.getMessage();
    }
    assertTrue("invocation jiNi failed: " + msg, worked);
    s.logout();
}
Also used : DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Vector(java.util.Vector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) Test(org.junit.Test)

Example 19 with NonSynchronizedVector

use of org.eclipse.persistence.internal.helper.NonSynchronizedVector 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();
}
Also used : DatabaseRecord(org.eclipse.persistence.sessions.DatabaseRecord) DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Vector(java.util.Vector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) Test(org.junit.Test)

Example 20 with NonSynchronizedVector

use of org.eclipse.persistence.internal.helper.NonSynchronizedVector in project eclipselink by eclipse-ee4j.

the class NijijiNiTestSet method runQuery.

@SuppressWarnings("unchecked")
@Test
public void runQuery() {
    DatabaseSession s = project.createDatabaseSession();
    s.dontLogMessages();
    s.login();
    Vector queryArgs = new NonSynchronizedVector();
    queryArgs.add(0);
    queryArgs.add("test");
    queryArgs.add(Float.parseFloat("12.75"));
    queryArgs.add(13);
    boolean worked = false;
    String msg = null;
    try {
        s.executeQuery("NijijiNi", Empty.class, queryArgs);
        worked = true;
    } catch (Exception e) {
        msg = e.getMessage();
    }
    assertTrue("invocation nijijini failed: " + msg, worked);
    s.logout();
}
Also used : DatabaseSession(org.eclipse.persistence.sessions.DatabaseSession) Vector(java.util.Vector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) NonSynchronizedVector(org.eclipse.persistence.internal.helper.NonSynchronizedVector) Test(org.junit.Test)

Aggregations

NonSynchronizedVector (org.eclipse.persistence.internal.helper.NonSynchronizedVector)40 Test (org.junit.Test)36 Vector (java.util.Vector)34 DatabaseSession (org.eclipse.persistence.sessions.DatabaseSession)34 BigDecimal (java.math.BigDecimal)13 DatabaseRecord (org.eclipse.persistence.sessions.DatabaseRecord)13 Date (java.sql.Date)4 StringReader (java.io.StringReader)3 SQLException (java.sql.SQLException)2 Struct (java.sql.Struct)2 Invocation (org.eclipse.persistence.internal.xr.Invocation)2 Operation (org.eclipse.persistence.internal.xr.Operation)2 XMLMarshaller (org.eclipse.persistence.oxm.XMLMarshaller)2 DatabaseQuery (org.eclipse.persistence.queries.DatabaseQuery)2 Document (org.w3c.dom.Document)2 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)1 DatasourceCall (org.eclipse.persistence.internal.databaseaccess.DatasourceCall)1 Platform (org.eclipse.persistence.internal.databaseaccess.Platform)1 SQLInsertStatement (org.eclipse.persistence.internal.expressions.SQLInsertStatement)1 ConversionManager (org.eclipse.persistence.internal.helper.ConversionManager)1