use of org.teiid.adminapi.impl.RequestMetadata in project teiid by teiid.
the class TestRequestMetadata method buildRequest.
private RequestMetadata buildRequest() {
RequestMetadata request = new RequestMetadata();
request.setState(ProcessingState.PROCESSING);
// $NON-NLS-1$
request.setCommand("select * from foo");
request.setExecutionId(1234);
// $NON-NLS-1$
request.setName("request-name");
// $NON-NLS-1$
request.setSessionId("session-id");
request.setSourceRequest(false);
request.setStartTime(12345L);
// $NON-NLS-1$
request.setTransactionId("transaction-id");
request.setThreadState(ThreadState.RUNNING);
// request.setNodeId(1);
return request;
}
use of org.teiid.adminapi.impl.RequestMetadata in project teiid by teiid.
the class TestEmbeddedServerAdmin method testGetRequests.
@SuppressWarnings("unchecked")
@Test
public void testGetRequests() throws AdminException, SQLException {
Connection conn = newSession();
Statement stmt = conn.createStatement();
String command = "SELECT * FROM helloworld";
ResultSet rs = stmt.executeQuery(command);
List<RequestMetadata> requests = (List<RequestMetadata>) admin.getRequests();
assertEquals(1, requests.size());
assertEquals(command, requests.get(0).getCommand());
assertNotNull(requests.get(0).getSessionId());
rs.close();
stmt.close();
conn.close();
}
use of org.teiid.adminapi.impl.RequestMetadata in project teiid by teiid.
the class TestODBCSocketTransport method testImplicitPortalClosing.
@Test
public void testImplicitPortalClosing() throws Exception {
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("select session_id()");
rs.next();
String id = rs.getString(1);
statement.close();
PreparedStatement s = conn.prepareStatement("select 1");
s.executeQuery();
s.executeQuery();
s.executeQuery();
// due to asynch close, there may be several requests
int runningCount = 0;
for (RequestMetadata request : odbcServer.server.getDqp().getRequestsForSession(id)) {
if (request.getState() == ProcessingState.PROCESSING) {
runningCount++;
}
}
assertEquals(1, runningCount);
s.close();
}
Aggregations