开发者

Query Coherence using JMeter

This is the situation I'm in:

I have a web service that is using the Coherence grid to store data for faster results. The grid holds specific DTO objects -- When new data comes in from the users, I update these DTOs. Now, I need to write specific JMeter tests for this. I can add a EndPoint (Restful WS) to collect these DTOs to verify that the objects are being updated, but that's kind of mixing the QA and Dev.

Is there a way to connect directly to the Grid using JMeter and query it for my objects? Or even any way to create a stand-alone java app and run it through Jmeter (add specific params for querys) to return the objects..

Thanks guys! Ninn

EDIT: java class to collect coherence objects

    package disclosed.jmeter;

import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.apache.jmeter.samplers.SampleResult;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;

public class JmeterTest extends AbstractJavaSamplerClient{

    @Override
    public Arguments getDefaultParameters() {
        // TODO Auto-generated 开发者_StackOverflow社区method stub
        return null;
    }

    @Override
    public SampleResult runTest(JavaSamplerContext arg0) {
        CacheFactory.getCluster().getMemberSet();
        NamedCache cache = CacheFactory.getCache("myCache");
        System.out.println("The value taken from the cache is: " + cache.get("message"));
        SampleResult result = new SampleResult();
        result.setResponseCode((String) cache.get("message"));
        return result;
    }

    @Override
    public void setupTest(JavaSamplerContext arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void teardownTest(JavaSamplerContext arg0) {
        // TODO Auto-generated method stub

    }

}


Yes, you can query any service from JMeter, either if you have Java library to access it, or by simulating raw TCP/UDP network traffic.

Best way is to have existing Java library to access service. Then you may use it from BeanShell Sampler, or write custom Sampler, it's easy.

Further details strongly depends on library you choose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜