Java Code Examples for kg.apc.emulators.TestJMeterUtils

The following examples show how to use kg.apc.emulators.TestJMeterUtils. These examples are extracted from open source projects. 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
@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 2
Source Project: jmeter-debugger   Source File: DebuggerTest.java    License: 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 Project: jmeter-plugins   Source File: HTTPRawSamplerTest.java    License: 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 4
@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 5
Source Project: jmeter-plugins   Source File: PluginsCMDWorkerTest.java    License: 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 6
Source Project: jmeter-plugins   Source File: EnvTest.java    License: 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 Project: jmeter-bzm-plugins   Source File: JMeterXMPPSamplerTest.java    License: 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 8
@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 9
Source Project: jmeter-debugger   Source File: TestProvider.java    License: 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 10
Source Project: jmeter-debugger   Source File: TestProvider.java    License: 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 11
Source Project: jmeter-plugins   Source File: JMeterPluginsUtilsTest.java    License: 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 12
Source Project: jmeter-plugins   Source File: JMeterPluginsUtilsTest.java    License: 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 13
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example 14
Source Project: jmeter-plugins   Source File: SamplesVsThreadsGuiTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example 15
Source Project: jmeter-plugins   Source File: TimesVsThreadsGuiTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass()
     throws Exception
{
   TestJMeterUtils.createJmeterEnv();
}
 
Example 16
Source Project: jmeter-plugins   Source File: IsDefinedTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 17
@BeforeClass
public static void setupJMeterEnv() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 18
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 19
Source Project: jmeter-plugins   Source File: PerfMonCollectorTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 20
Source Project: jmeter-plugins   Source File: DbMonCollectorTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 21
@BeforeClass
public static void setupJMeterEnv() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 22
Source Project: jmeter-plugins   Source File: DummySamplerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Before
public void setUpClass() {
    TestJMeterUtils.createJmeterEnv(); // to set UTF-8
}
 
Example 23
@BeforeClass
public static void setupJMeterEnv() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 24
@BeforeClass
public static void setUpClass() {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 25
@BeforeClass
public static void setUpClass()
        throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 26
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 27
Source Project: jmeter-plugins   Source File: SteppingThreadGroupGuiTest.java    License: Apache License 2.0 4 votes vote down vote up
/**
 *
 * @throws Exception
 */
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 28
Source Project: jmeter-plugins   Source File: JSONPathExtractorTest.java    License: Apache License 2.0 4 votes vote down vote up
@Before
public void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 29
Source Project: jmeter-plugins   Source File: AutoStopGuiTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}
 
Example 30
Source Project: jmeter-plugins   Source File: ArrivalsThreadGroupTest.java    License: Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpClass() throws Exception {
    TestJMeterUtils.createJmeterEnv();
}