kg.apc.emulators.TestJMeterUtils Java Examples

The following examples show how to use kg.apc.emulators.TestJMeterUtils. 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: HTTPRawSamplerTest.java    From jmeter-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testProcessIO_long_Limited() throws Exception {
    JMeterUtils.setProperty(AbstractIPSampler.RECV_BUFFER_LEN_PROPERTY, Integer.toString(1024));
    JMeterUtils.setProperty(AbstractIPSampler.RESULT_DATA_LIMIT, Integer.toString(1024));
    instance = new HTTPRawSamplerEmul();
    instance.setHostName("169.254.250.25");
    instance.setPort("80");
    instance.setTimeout("0");
    System.out.println("processIOlim");
    SampleResult res = new SampleResult();
    res.sampleStart();
    String resp = TestJMeterUtils.getTestData(12048);
    instance.sockEmul.setBytesToRead(ByteBuffer.wrap(resp.getBytes()));
    byte[] result = instance.processIO(res);
    System.out.println(result.length);
    assertEquals(4096, result.length);
}
 
Example #2
Source File: DebuggerTest.java    From jmeter-debugger with Apache License 2.0 6 votes vote down vote up
@Test
public void testMain() throws Exception {
    TestJMeterUtils.createJmeterEnv();
    TestProvider treeProvider = new TestProvider();
    Debugger dbg = new Debugger(treeProvider, new FrontendMock());
    dbg.selectThreadGroup(treeProvider.getTG(0));

    Debugger.toggleBreakpoint(treeProvider.getTG(0));

    dbg.start();
    Thread.sleep(5000);
    Assert.assertFalse(dbg.isContinuing());
    Assert.assertTrue(dbg.getCurrentElement() instanceof Controller);
    dbg.proceed();
    Thread.sleep(1000);
    dbg.proceed();
    Assert.assertTrue(dbg.getCurrentSampler() != null);
    Thread.sleep(1000);
    dbg.continueRun();
    Thread.sleep(2000);
    dbg.pause();
    Thread.sleep(1000);
    dbg.stop();
}
 
Example #3
Source File: LoadosophiaUploaderTest.java    From jmeter-bzm-plugins with Apache License 2.0 6 votes vote down vote up
@Test
public void testTestEnded() throws IOException {
    System.out.println("testEnded");
    LoadosophiaUploader instance = new LoadosophiaUploaderEmul();
    instance.resetTest();
    instance.setStoreDir(TestJMeterUtils.getTempDir());
    instance.setTitle("UnitTest");
    instance.setColorFlag("gray");
    instance.setProject("DEFAULT");
    instance.setUploadToken("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
    instance.testStarted();

    SampleResult res = new SampleResult();
    res.sampleStart();
    res.sampleEnd();
    SampleEvent event = new SampleEvent(res, "test");
    instance.sampleOccurred(event);

    instance.testEnded();
}
 
Example #4
Source File: JMeterPluginsUtilsTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetShortHostnameInvalidPattern() throws IOException {
    System.out.println("testGetShortHostnameInvalidPattern");
    TestJMeterUtils.createJmeterEnv();
    JMeterUtils.setProperty("jmeterPlugin.perfmon.label.useHostname.pattern", "([\\w\\-]+\\.region.*");
    String host;
    host = JMeterPluginsUtils.getShortHostname("aaa-bbb-1234.region.com");
    assertEquals("aaa-bbb-1234.region.com", host);
}
 
Example #5
Source File: ParallelHTTPSamplerTest.java    From jmeter-bzm-plugins with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
    TestJMeterUtils.createJmeterEnv();
    JMeterUtils.setProperty("HTTPResponse.parsers", "htmlParser");
    JMeterUtils.setProperty("htmlParser.types", "text/html");
    JMeterUtils.setProperty("htmlParser.className", "org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser");
}
 
Example #6
Source File: EnvTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
    Map<String, String> env = System.getenv();
    if (!env.isEmpty()) {
        key = env.keySet().iterator().next();
        value = env.get(key);
    }
}
 
Example #7
Source File: TimesVsThreadsGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example #8
Source File: PluginsCMDWorkerTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testDoJob_csv_createdir() throws IOException {
    System.out.println("doJob 4");
    instance.setInputFile(basedir + "/short.jtl");
    instance.setOutputCSVFile(TestJMeterUtils.getTempDir().concat(File.separator).concat("testFile.csv"));
    instance.setPluginType("ResponseTimesOverTime");
    instance.addExportMode(PluginsCMDWorker.EXPORT_CSV);
    int result = instance.doJob();
    int expResult = 0;
    assertEquals(expResult, result);
}
 
Example #9
Source File: SamplesVsThreadsGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example #10
Source File: ThreadsStateOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example #11
Source File: JMeterXMPPSamplerTest.java    From jmeter-bzm-plugins with Apache License 2.0 5 votes vote down vote up
public void testLoginLogout() throws Exception {
    TestJMeterUtils.createJmeterEnv();
    JMeterXMPPSampler obj = new JMeterXMPPSampler();
    JMeterXMPPConnection conn = new JMeterXMPPConnection();
    fillActionClasses(conn.getActions());
    conn.setConnectionType(JMeterXMPPConnectionBase.Type.BOSH.toString());
    conn.setAddress("view.webcast.cisco.com");
    conn.setPort("443");
    conn.setBOSHSSL(true);
    conn.setServiceName("cisco.com");
    conn.setPacketReplyTimeout("0");
    conn.setBOSHURL("/httpbinding/");

    conn.setAddress("192.168.5.4");
    conn.setPort("7070");
    conn.setBOSHSSL(false);
    conn.setServiceName("example.com");
    conn.setPacketReplyTimeout("5000");
    conn.setBOSHURL("/http-bind/");


    conn.testStarted();
    obj.addTestElement(conn);
    obj.setProperty(Login.LOGIN, "[email protected]");
    obj.setProperty(Login.PASSWORD, "cisco123");
    obj.setProperty(Login.RESOURCE, "qanda-panelist");

    for (int a = 0; a < 2; a++) {
        doAction(obj, Connect.class);
        SASLAuthentication.getRegisterdSASLMechanisms();
        doAction(obj, Login.class);
        //Thread.sleep(500);
        doAction(obj, Disconnect.class);
        //Thread.sleep(500);
    }
}
 
Example #12
Source File: DebuggingThreadGroupGuiTest.java    From jmeter-debugger with Apache License 2.0 5 votes vote down vote up
@Test
public void test() throws InterruptedException {
    TestJMeterUtils.createJmeterEnv();
    DebuggingThreadGroupGui obj = new DebuggingThreadGroupGui();
    
    if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
        JFrame frame = new JFrame();
        frame.setSize(800, 600);
        frame.add(obj);
        frame.setVisible(true);
        Thread.sleep(10000);
    }
}
 
Example #13
Source File: TestProvider.java    From jmeter-debugger with Apache License 2.0 5 votes vote down vote up
public TestProvider() throws IllegalUserActionException, IOException {
    File file = new File(this.getClass().getResource("/com/blazemeter/jmeter/debugger/sample1.jmx").getFile());
    String basedir = TestJMeterUtils.fixWinPath(file.getParentFile().getAbsolutePath());

    File f = new File(basedir + "/sample1.jmx");
    mdl.addSubTree(SaveService.loadTree(f), (JMeterTreeNode) mdl.getRoot());
}
 
Example #14
Source File: TestProvider.java    From jmeter-debugger with Apache License 2.0 5 votes vote down vote up
public TestProvider(String path, String name) throws IllegalUserActionException, IOException {
    File file = new File(this.getClass().getResource(path).getFile());
    String basedir = TestJMeterUtils.fixWinPath(file.getParentFile().getAbsolutePath());

    File f = new File(basedir + '/' + name);
    mdl.addSubTree(SaveService.loadTree(f), (JMeterTreeNode) mdl.getRoot());
}
 
Example #15
Source File: JMeterPluginsUtilsTest.java    From jmeter-plugins with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetEnvDefault() throws IOException {
    System.out.println("getEnvDefault");
    TestJMeterUtils.createJmeterEnv();
    Map<String, String> env = System.getenv();
    if (!env.isEmpty()) {
        String key = env.keySet().iterator().next();
        assertEquals(env.get(key), JMeterPluginsUtils.getEnvDefault(key, "testGetEnvDefault"));
        assertEquals("testGetEnvDefault", JMeterPluginsUtils.getEnvDefault(key + "testGetEnvDefault", "testGetEnvDefault"));
    }
}
 
Example #16
Source File: RawRequestSourcePreProcessorGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #17
Source File: DummySubPostProcessorGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #18
Source File: AbstractGraphPanelVisualizerTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
        throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #19
Source File: BytesThroughputOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception
{
    TestJMeterUtils.createJmeterEnv();
}
 
Example #20
Source File: TSTFeedbackTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #21
Source File: AutoStopTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #22
Source File: UDPSamplerGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #23
Source File: OAuthSamplerGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #24
Source File: TestPlanCheckToolTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #25
Source File: VariableThroughputTimerGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #26
Source File: FlexibleFileWriterGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #27
Source File: HitsPerSecondGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #28
Source File: FilterPanelTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@AfterClass
public static void tearDownClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #29
Source File: PageDataExtractorOverTimeGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example #30
Source File: SetVariablesActionGuiTest.java    From jmeter-plugins with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass()
        throws Exception {
    TestJMeterUtils.createJmeterEnv();
}