phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron van der Vegt <>
Subject Trying to setup unittests to query phoenix test db but getting UnsupportedOperationException
Date Fri, 15 May 2015 12:41:07 GMT
Hello everyone,

I'm currently developing an Rest API which should query a phoenix table, 
and return it in JSON. Currently have no issues with building this API, 
but it would be really nice if I could write unittests with dummy data 
to test our created API calls.

I was getting into the right direction, I hope, by extending the 
BaseConnectionlessQueryTest class and setup a test database:

String ddl = "CREATE TABLE test (id VARCHAR not null primary key, 
test_value CHAR(16)";
createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);

And it looks like I could also upsert some data:

Properties props = new Properties();
PhoenixConnection conn = 
PreparedStatement statement = conn.prepareStatement("UPSERT INTO 
test(id) VALUES ('meh')");

But when I want to select data:

PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
ResultSet rs = statement.executeQuery();
while ( {

I am get an UnsupportedOperationException. Could someone please explain 
to me what I'm doing wrong, or that my use case is possible somehow?

Thanks in advice!


View raw message