Java Code Examples for org.apache.jmeter.samplers.SampleResult#getResponseData()

The following examples show how to use org.apache.jmeter.samplers.SampleResult#getResponseData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectthesetle() {
    CassandraSampler cs = new CassandraSampler();

    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + TABLE + " WHERE key = 1");

    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "key\ttheset\n" + "1" + "\t" + "{one,three,two}" + "\n");

}
 
Example 2
Source File: SimpleQueryTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test(dataProvider = "provideQueries")
public void testSimpleQuery(String table, String expected, Object nothing) {

    CassandraSampler cs = new CassandraSampler();
    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + table);
    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "k\tv\n"+ expected +"\t"+ expected +"\n");
}
 
Example 3
Source File: SimpleQueryTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test(dataProvider = "provideQueries")
public void testPreparedQuery(String table, String expected, Object nothing) {

    CassandraSampler cs = new CassandraSampler();
    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.PREPARED);
    cs.setProperty("queryArguments", expected );
    cs.setProperty("query", "SELECT * FROM " + table + " WHERE K = ?");
    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.debug(rowdata);
    assertEquals(rowdata, "k\tv\n"+ expected +"\t"+ expected +"\n");
}
 
Example 4
Source File: SimpleQueryTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test(dataProvider = "provideQueries")
public void testPreparedSetQuery(String table, String expected, Object nothing) {

    CassandraSampler cs = new CassandraSampler();
    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.PREPARED);
    cs.setProperty("queryArguments", expected );
    cs.setProperty("query", "SELECT * FROM set_" + table + " WHERE K = ?");
    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.debug(rowdata);
    assertEquals(rowdata, "k\tv\n"+ expected +"\t{"+ expected +"}\n");
}
 
Example 5
Source File: SimpleQueryTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test(dataProvider = "provideQueries")
public void testPreparedListQuery(String table, String expected, Object nothing) {

    CassandraSampler cs = new CassandraSampler();
    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.PREPARED);
    cs.setProperty("queryArguments", expected );
    cs.setProperty("query", "SELECT * FROM list_" + table + " WHERE K = ?");
    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.debug(rowdata);
    assertEquals(rowdata, "k\tv\n"+ expected +"\t["+ expected +"]\n");
}
 
Example 6
Source File: SimpleQueryTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test(dataProvider = "provideQueries")
public void testPreparedMapQuery(String table, String expected, Object nothing) {

    CassandraSampler cs = new CassandraSampler();
    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.PREPARED);
    cs.setProperty("queryArguments", expected );
    cs.setProperty("query", "SELECT * FROM map_" + table + " WHERE K = ?");
    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.debug(rowdata);
    assertEquals(rowdata, "k\tv\n"+ expected +"\t{"+ expected + ":" + expected +"}\n");
}
 
Example 7
Source File: MapTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectthemap() {
    CassandraSampler cs = new CassandraSampler();

    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + TABLE + " WHERE key = 1");

    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "key\tthemap\n" + "1" + "\t" + "{1:one,2:two,3:three}" + "\n");
}
 
Example 8
Source File: UDTTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectUDT() {
    CassandraSampler cs = new CassandraSampler();

    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + TABLE + " WHERE key = 1");

    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "key\tudt\n" + "1" + "\t" + EXPECTED + "\n");

}
 
Example 9
Source File: ListTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectthelist() {
    CassandraSampler cs = new CassandraSampler();

    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + TABLE + " WHERE key = 1");

    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "key\tthelist\n" + "1" + "\t" + "[one,two,three]" + "\n");
}
 
Example 10
Source File: TupleTest.java    From jmeter-cassandra with Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectTuple() {
    CassandraSampler cs = new CassandraSampler();

    cs.setProperty("sessionName",TESTSESSION);
    cs.setProperty("consistencyLevel", AbstractCassandaTestElement.ONE);
    cs.setProperty("resultVariable","rv");
    cs.setProperty("queryType", AbstractCassandaTestElement.SIMPLE);
    cs.setProperty("query", "SELECT * FROM " + TABLE + " WHERE key = 1");

    TestBeanHelper.prepare(cs);

    SampleResult res = cs.sample(new Entry());
    assertTrue(res.isSuccessful(), res.getResponseMessage());

    String rowdata = new String(res.getResponseData());
    logger.info(rowdata);
    assertEquals(rowdata, "key\ttup\n" + "1" + "\t" + EXPECTED + "\n");

}