@Test
  public void testGetRequests() throws Exception {
    JavaArchive jar = getLoopyArchive();

    try {
      admin.deploy("loopy.jar", jar.as(ZipExporter.class).exportAsInputStream());
      deployVdb();
      Translator t = admin.getTranslator("loopy");
      assertNotNull(t);

      admin.updateSource("bqt", 1, "Source", "loopy", "java:jboss/datasources/ExampleDS");
      Connection conn =
          TeiidDriver.getInstance()
              .connect("jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user", null);
      Collection<? extends Session> sessions = admin.getSessions();
      assertEquals(1, sessions.size());
      Session s = sessions.iterator().next();

      Statement stmt = conn.createStatement();

      Collection<? extends Request> requests = admin.getRequests();

      assertEquals(0, requests.size());

      stmt.execute("select * from source.smalla");

      requests = admin.getRequests();
      assertEquals(1, requests.size());

      Request r = requests.iterator().next();
      assertEquals("select * from source.smalla", r.getCommand());
      assertNotNull(r.getExecutionId());
      assertNotNull(r.getSessionId());

      stmt.execute("select * from source.smalla");
      Collection<? extends Request> requests2 = admin.getRequestsForSession(s.getSessionId());
      assertEquals(1, requests2.size());

      Request r2 = requests.iterator().next();
      assertEquals("select * from source.smalla", r2.getCommand());
      assertEquals(s.getSessionId(), r2.getSessionId());

      stmt.close();
      conn.close();

      requests = admin.getRequests();
      assertEquals(0, requests.size());

    } finally {
      admin.undeploy("loopy.jar");
    }
  }
  @Test
  public void testSessions() throws Exception {
    deployVdb();

    Collection<? extends Session> sessions = admin.getSessions();
    assertEquals(0, sessions.size());

    Connection conn =
        TeiidDriver.getInstance()
            .connect(
                "jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test",
                null);
    sessions = admin.getSessions();
    assertEquals(1, sessions.size());
    Session s = sessions.iterator().next();

    assertEquals("user@teiid-security", s.getUserName());
    assertEquals("test", s.getApplicationName());
    assertEquals("bqt", s.getVDBName());
    assertEquals(1, s.getVDBVersion());
    assertNotNull(s.getSessionId());

    conn.close();

    conn =
        TeiidDriver.getInstance()
            .connect(
                "jdbc:teiid:bqt@mm://localhost:31000;user=user;password=user;ApplicationName=test",
                null);
    sessions = admin.getSessions();
    assertEquals(1, sessions.size());
    s = sessions.iterator().next();

    admin.terminateSession(s.getSessionId());
    sessions = admin.getSessions();
    assertEquals(0, sessions.size());
    conn.close();
  }