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

The following examples show how to use org.apache.jmeter.samplers.SampleResult#setThreadName() . 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: LoadosophiaUploaderTest.java    From jmeter-bzm-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testOnlineProcessor() throws InterruptedException {
    System.out.println("onlineProcessor");
    LoadosophiaUploader instance = new LoadosophiaUploaderEmul();
    instance.resetTest();
    instance.setUseOnline(true);
    instance.setStoreDir(TestJMeterUtils.getTempDir());
    instance.testStarted("");
    for (int i = 0; i < 100; i++) {
        SampleResult res = new SampleResult();
        res.setThreadName("test " + i);
        SampleEvent event = new SampleEvent(res, "test " + i);
        instance.sampleOccurred(event);
    }
    Thread.sleep(10);
    instance.testEnded("");
}
 
Example 2
Source File: AbstractVsThreadVisualizerTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of getCurrentThreadCount method, of class AbstractVsThreadVisualizer.
 */
@Test
public void testGetCurrentThreadCount()
{
    System.out.println("getCurrentThreadCount");
    long now = System.currentTimeMillis();
    SampleResult sample = new SampleResult();
    sample.setGroupThreads(3);
    sample.setThreadName("test_tg");
    sample.setStampAndTime(now, 300);
    AbstractVsThreadVisualizer instance = new AbstractVsThreadVisualizerImpl();
    instance.add(sample);
    int expResult = 3;
    int result = instance.getCurrentThreadCount(sample);
    assertEquals(expResult, result);
}
 
Example 3
Source File: BytesThroughputOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of add method, of class BytesThroughputOverTimeGui.
 */
@Test
public void testAdd()
{
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    res.setBytes(1234);
    BytesThroughputOverTimeGui instance = new BytesThroughputOverTimeGui();
    instance.add(res);
    res.sampleStart();
    try
    {
        Thread.sleep(10);
    } catch (InterruptedException ex)
    {
    }
    res.sampleEnd();
    instance.add(res);
}
 
Example 4
Source File: ResponseCodesPerSecondGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of add method, of class ResponseCodesPerSecondGui.
 */
@Test
public void testAdd()
{
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    res.setResponseCode("200");
    ResponseCodesPerSecondGui instance = new ResponseCodesPerSecondGui();
    instance.add(res);
    res.sampleStart();
    try
    {
        Thread.sleep(10);
    } catch (InterruptedException ex)
    {
    }
    res.sampleEnd();
    instance.add(res);
}
 
Example 5
Source File: HitsPerSecondGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of add method, of class HitsPerSecondGui.
 */
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    HitsPerSecondGui instance = new HitsPerSecondGui();
    instance.add(res);
    res.sampleStart();
    try {
        Thread.sleep(10);
    } catch (InterruptedException ex) {
    }
    res.sampleEnd();
    instance.add(res);
}
 
Example 6
Source File: HitsPerSecondGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testAdd_issue48() {
    System.out.println("add48");
    SampleResult res = new SampleResult();
    res.setAllThreads(0);
    res.setThreadName("test 1-2");
    res.setResponseMessage(null);

    SampleResult subres = new SampleResult();
    subres.sampleStart();
    subres.sampleEnd();
    res.sampleStart();
    res.addSubResult(subres);

    try {
        Thread.sleep(10);
    } catch (InterruptedException ex) {
    }
    HitsPerSecondGui instance = new HitsPerSecondGui();
    instance.add(res);
}
 
Example 7
Source File: TransactionsPerSecondGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of add method, of class TransactionsPerSecondGui.
 */
@Test
public void testAdd()
{
    System.out.println("add");

    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    TransactionsPerSecondGui instance = new TransactionsPerSecondGui();
    instance.add(res);
    res.sampleStart();
    try
    {
        Thread.sleep(10);
    } catch (InterruptedException ex)
    {
    }
    res.sampleEnd();
    instance.add(res);
}
 
Example 8
Source File: ThreadsStateOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
/**
 * Test of add method, of class ThreadsStateOverTimeGui.
 */
@Test
public void testAdd()
{
   System.out.println("add");
   SampleResult res = new SampleResult();
   res.sampleStart();
   res.setAllThreads(1);
   res.setThreadName("test 1-2");
   res.sampleEnd();
   instance.add(res);
   
   try
   {
      Thread.sleep(2000);
   }
   catch (InterruptedException ex)
   {
      Logger.getLogger(ThreadsStateOverTimeGuiTest.class.getName()).log(Level.SEVERE, null, ex);
   }
   
   SampleResult res2 = new SampleResult(res);
   res2.setAllThreads(1);
   res2.setThreadName("test 1-2");
   instance.add(res);
}
 
Example 9
Source File: FlexibleFileWriterTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testSampleOccurred_labels() throws IOException {
    System.out.println("sampleOccurred_labels");
    SampleResult res = new SampleResult();
    res.setResponseData("test".getBytes());
    FlexibleFileWriter instance = new FlexibleFileWriter();
    instance.setFilename(File.createTempFile("ffw_test_", ".txt").getAbsolutePath());
    instance.setColumns("threadName|\\t|sampleLabel");
    instance.testStarted();

    res.setSampleLabel("SAMPLELBL");
    res.setThreadName("THRDNAME");
    SampleEvent e = new SampleEvent(res, "Test");
    instance.sampleOccurred(e);
    //ByteBuffer written = instance.fileEmul.getWrittenBytes();
    //assertEquals(exp, JMeterPluginsUtils.byteBufferToString(written));

    instance.testEnded();
}
 
Example 10
Source File: LatenciesOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 * Test of add method, of class LatenciesOverTimeGui.
 */
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    LatenciesOverTimeGui instance = new LatenciesOverTimeGui();
    instance.add(res);
}
 
Example 11
Source File: ResponseTimesOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 *
 */
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    ResponseTimesOverTimeGui instance = new ResponseTimesOverTimeGui();
    instance.add(res);
}
 
Example 12
Source File: ResponseTimesPercentilesGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 * Test of add method, of class ResponseTimesPercentilesGUI.
 */
@Test
public void testAdd()
{
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    ResponseTimesPercentilesGui instance = new ResponseTimesPercentilesGui();
    instance.add(res);
}
 
Example 13
Source File: ResponseTimesDistributionGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    res.setStampAndTime(System.currentTimeMillis(), 1000);
    ResponseTimesDistributionGui instance = new ResponseTimesDistributionGui();
    instance.add(res);
}
 
Example 14
Source File: MergeResultsGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    MergeResultsGui instance = new MergeResultsGui();
    instance.add(res);
}
 
Example 15
Source File: PageDataExtractorOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 * Test of add method, of class PageDataExtractorOverTimeGui.
 */
@Test
public void testAdd() {
    System.out.println("add");
    SampleResult res = new SampleResult();
    res.setAllThreads(1);
    res.setThreadName("test 1-2");
    res.setResponseData("aa=10\nbb=20");
    PageDataExtractorOverTimeGui instance = new PageDataExtractorOverTimeGui();
    instance.add(res);
}
 
Example 16
Source File: AbstractDynamicThreadGroupModel.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
protected void saveLogRecord(String marker, String threadName, String arrivalID) {
    SampleResult res = new SampleResult();
    res.sampleStart();
    res.setSampleLabel(arrivalID);
    res.setResponseMessage(marker);
    res.setThreadName(threadName);
    res.sampleEnd();
    SampleEvent evt = new SampleEvent(res, getName());
    logFile.sampleOccurred(evt);
}