use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestFailuresSuite method testViolateUniqueness.
public void testViolateUniqueness() throws IOException {
System.out.println("STARTING testVU");
Client client = getClient();
VoltTable[] results = null;
try {
results = client.callProcedure("ViolateUniqueness", 1L, 1L, 1L).getResults();
System.out.println("testVU client response received");
assertEquals(results.length, 0);
} catch (ProcCallException e) {
try {
results = client.callProcedure("InsertNewOrder", 2L, 2L, 2L).getResults();
} catch (ProcCallException e1) {
fail(e1.toString());
} catch (IOException e1) {
fail(e1.toString());
}
System.out.println("second client response received");
assertEquals(1, results.length);
assertEquals(1, results[0].asScalarLong());
return;
} catch (IOException e) {
fail(e.toString());
return;
}
fail("testViolateUniqueness should return while catching ProcCallException");
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestFailuresSuite method testBadVarcharToAnyCompare.
// Subcase of ENG-800
public void testBadVarcharToAnyCompare() throws IOException {
System.out.println("STARTING testBadVarcharToAnyCompare");
Client client = getClient();
boolean threw = false;
try {
client.callProcedure("BadVarcharCompare", 1).getResults();
} catch (ProcCallException e) {
if (!isHSQL()) {
if ((e.getMessage().contains("SQL ERROR")) && (e.getMessage().contains("cannot be cast for comparison to type VARCHAR"))) {
threw = true;
} else {
e.printStackTrace();
}
} else {
threw = true;
}
}
assertTrue(threw);
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestFailuresSuite method testBadDecimalToVarcharCompare.
// Subcase of ENG-800
public void testBadDecimalToVarcharCompare() throws IOException {
System.out.println("STARTING testBadDecimalToVarcharCompare");
Client client = getClient();
boolean threw = false;
try {
client.callProcedure("BadDecimalToVarcharCompare", 1).getResults();
} catch (ProcCallException e) {
if (!isHSQL()) {
if ((e.getMessage().contains("SQL ERROR")) && (e.getMessage().contains("VARCHAR cannot be cast for comparison to type DECIMAL"))) {
threw = true;
} else {
e.printStackTrace();
}
} else {
threw = true;
}
}
assertTrue(threw);
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestFailuresSuite method testTooFewParamsOnSQLStmt.
public void testTooFewParamsOnSQLStmt() throws IOException {
System.out.println("STARTING testTooFewParamsOnSQLStmt");
Client client = getClient();
try {
client.callProcedure("TooFewParams", 1, 1);
fail();
} catch (ProcCallException e) {
}
}
use of org.voltdb.client.ProcCallException in project voltdb by VoltDB.
the class TestDecimalRoundingSuite method validateDecimalDefault.
private final void validateDecimalDefault(String tableName, boolean shouldFail, boolean roundEnabled, RoundingMode roundMode, String value) throws Exception {
Client client = getClient();
ClientResponse cr;
boolean sawFail = false;
VoltTable tbl = null;
BigDecimal found = null;
try {
cr = client.callProcedure("@AdHoc", String.format("insert into %s (id) values ?;", tableName), 100);
assertEquals(ClientResponse.SUCCESS, cr.getStatus());
sawFail = false;
cr = client.callProcedure("@AdHoc", String.format("select (dec) from %s;", tableName));
assertEquals(ClientResponse.SUCCESS, cr.getStatus());
tbl = cr.getResults()[0];
assertTrue(tbl.advanceRow());
found = tbl.getDecimalAsBigDecimal(0);
} catch (ProcCallException ex) {
sawFail = true;
}
assertEquals(shouldFail ? "Expected a failure here" : "Unexpected failure here", shouldFail, sawFail);
if (shouldFail) {
return;
}
BigDecimal expected = roundDecimalValue(value, roundEnabled, roundMode);
assertEquals(String.format("Default decimal value failed: rounding is %s, mode is %s", roundEnabled ? "enabled" : "not enabled", roundMode), expected, found);
}
Aggregations