use of com.hazelcast.sql.HazelcastSqlException in project hazelcast by hazelcast.
the class SqlErrorClientTest method testMemberDisconnect_execute.
/**
* Test proper handling of member disconnect while waiting for execute result.
*/
@Test
public void testMemberDisconnect_execute() {
instance1 = newHazelcastInstance(true);
client = newClient();
SqlStatement streamingQuery = new SqlStatement("SELECT * FROM TABLE(GENERATE_STREAM(5000))");
HazelcastSqlException error = assertSqlExceptionWithShutdown(client, streamingQuery);
assertErrorCode(SqlErrorCode.CONNECTION_PROBLEM, error);
}
use of com.hazelcast.sql.HazelcastSqlException in project hazelcast by hazelcast.
the class SqlErrorClientTest method testMemberDisconnect_fetch.
@Test
public void testMemberDisconnect_fetch() {
instance1 = newHazelcastInstance(true);
client = newClient();
createMapping(instance1, MAP_NAME, long.class, long.class);
populate(instance1, DEFAULT_CURSOR_BUFFER_SIZE + 1);
// Get the first row.
boolean shutdown = true;
try {
for (SqlRow ignore : client.getSql().execute(query())) {
// Shutdown the member
if (shutdown) {
instance1.shutdown();
shutdown = false;
}
}
fail("Should fail");
} catch (HazelcastSqlException e) {
assertErrorCode(SqlErrorCode.CONNECTION_PROBLEM, e);
}
}
use of com.hazelcast.sql.HazelcastSqlException in project hazelcast by hazelcast.
the class SqlErrorClientTest method testParameterError_deserialization.
@Test
public void testParameterError_deserialization() {
instance1 = newHazelcastInstance(true);
client = newClient();
SqlStatement query = new SqlStatement("SELECT * FROM map").addParameter(new BadParameter(false, true));
HazelcastSqlException error = assertSqlException(client, query);
assertErrorCode(SqlErrorCode.GENERIC, error);
assertTrue(error.getMessage().contains("Read error"));
}
use of com.hazelcast.sql.HazelcastSqlException in project hazelcast by hazelcast.
the class SqlErrorClientTest method testClientConnectedToLiteMember.
@Test
public void testClientConnectedToLiteMember() {
factory.newHazelcastInstance(getConfig().setLiteMember(true));
client = factory.newHazelcastClient(null);
HazelcastSqlException error = assertSqlException(client, query());
assertErrorCode(SqlErrorCode.GENERIC, error);
assertEquals("SQL queries cannot be executed on lite members", error.getMessage());
}
use of com.hazelcast.sql.HazelcastSqlException in project hazelcast by hazelcast.
the class SqlErrorAbstractTest method checkTimeout.
protected void checkTimeout(boolean useClient) {
// Start two instances and fill them with data
instance1 = newHazelcastInstance(false);
instance2 = newHazelcastInstance(true);
client = newClient();
// Execute query on the instance1.
SqlStatement query = new SqlStatement("select v from table(generate_stream(1))").setTimeoutMillis(1L);
HazelcastSqlException error = assertSqlException(useClient ? client : instance1, query);
assertTrue(error.getMessage().contains("CANCEL_FORCEFUL"));
}
Aggregations