Exemple #1
0
  private void verifyResults(ClientResponseImpl response) {
    VoltTable results[] = response.getResults();
    assertEquals(2, results.length);

    Set<Integer> pValues = new HashSet<Integer>();
    pValues.add(45);
    pValues.add(44);
    pValues.add(43);
    pValues.add(42);

    while (results[0].advanceRow()) {
      assertTrue(pValues.contains((int) results[0].getLong(0)));
      assertTrue(pValues.contains(Integer.valueOf(results[0].getString(1))));
    }

    Set<Integer> c1Values = pValues;
    Set<Integer> c2Values = new HashSet<Integer>();
    c2Values.add(43);
    c2Values.add(44);

    while (results[1].advanceRow()) {
      assertTrue(c1Values.contains(Integer.valueOf(results[1].getString(0))));
      assertTrue(c2Values.contains((int) results[1].getLong(1)));
    }
  }
Exemple #2
0
  @Test
  public void testCollectDRStats() throws Exception {
    createAndRegisterStats();
    m_mvoltdb
        .getStatsAgent()
        .performOpsAction(m_mockConnection, 32, OpsSelector.STATISTICS, subselect("DR", 0));
    ClientResponseImpl response = responses.take();

    assertEquals(ClientResponse.SUCCESS, response.getStatus());
    VoltTable results[] = response.getResults();
    System.out.println(results[0]);
    System.out.println(results[1]);
    verifyResults(response);
  }
Exemple #3
0
  @Test
  public void testCollectionTimeout() throws Exception {
    createAndRegisterStats();
    StatsAgent.OPS_COLLECTION_TIMEOUT = 300;
    MockStatsSource.delay = 200;
    m_mvoltdb
        .getStatsAgent()
        .performOpsAction(m_mockConnection, 32, OpsSelector.STATISTICS, subselect("DR", 0));
    ClientResponseImpl response = responses.take();

    assertEquals(ClientResponse.GRACEFUL_FAILURE, response.getStatus());
    VoltTable results[] = response.getResults();
    assertEquals(0, results.length);
    System.out.println(response.getStatusString());
    assertEquals(
        "OPS request hit sixty second timeout before all responses were received",
        response.getStatusString());
  }
Exemple #4
0
 @Test
 public void testCollectUnavailableStats() throws Exception {
   for (StatsSelector selector : StatsSelector.values()) {
     m_mvoltdb
         .getStatsAgent()
         .performOpsAction(
             m_mockConnection, 32, OpsSelector.STATISTICS, subselect(selector.name(), 0));
     ClientResponseImpl response = responses.take();
     assertEquals(ClientResponse.GRACEFUL_FAILURE, response.getStatus());
     VoltTable results[] = response.getResults();
     assertEquals(0, results.length);
     assertEquals(
         "Requested info \""
             + selector.name()
             + "\" is not yet available or not "
             + "supported in the current configuration.",
         response.getStatusString());
   }
 }
Exemple #5
0
  @Test
  public void testCollectSnapshotStatusStats() throws Exception {
    createAndRegisterStats();
    m_mvoltdb
        .getStatsAgent()
        .performOpsAction(
            m_mockConnection, 32, OpsSelector.STATISTICS, subselect("SNAPSHOTSTATUS", 0));
    ClientResponseImpl response = responses.take();

    assertEquals(ClientResponse.SUCCESS, response.getStatus());
    VoltTable results[] = response.getResults();
    System.out.println(results[0]);
    while (results[0].advanceRow()) {
      String c1 = results[0].getString("c1");
      String c2 = results[0].getString("c2");
      if (c1.equalsIgnoreCase("RYANLOVES")) {
        assertEquals("THEYANKEES", c2);
      } else if (c1.equalsIgnoreCase("NOREALLY")) {
        assertEquals("ASKHIM", c2);
      } else {
        fail("Unexpected row in results: c1: " + c1 + ", c2: " + c2);
      }
    }
  }