Search in sources :

Example 1 with OrbConfigurator

use of alma.acs.container.corba.OrbConfigurator in project ACS by ACS-Community.

the class T112Sampler method runTest.

/**
	 * Perform a single sample.
	 * Perform a single sample for each iteration.  This method
	 * returns a <code>SampleResult</code> object.
	 * <code>SampleResult</code> has many fields which can be
	 * used.  At a minimum, the test should use
	 * <code>SampleResult.sampleStart</code> and
	 * <code>SampleResult.sampleEnd</code>to set the time that
	 * the test required to execute.  It is also a good idea to
	 * set the sampleLabel and the successful flag.
	 * 
	 * @see org.apache.jmeter.samplers.SampleResult#sampleStart()
	 * @see org.apache.jmeter.samplers.SampleResult#sampleEnd()
	 * @see org.apache.jmeter.samplers.SampleResult#setSuccessful(boolean)
	 * @see org.apache.jmeter.samplers.SampleResult#setSampleLabel(String)
	 * 
	 * @param context  the context to run with. This provides access
	 *                 to initialization parameters.
	 * 
	 * @return         a SampleResult giving the results of this
	 *                 sample.
	 */
public SampleResult runTest(JavaSamplerContext context) {
    SampleResult results = new SampleResult();
    try {
        long time = System.currentTimeMillis();
        POA rootPOA = null;
        OrbConfigurator orbConf = OrbConfigurator.getOrbConfigurator();
        ORB orb = ORB.init(orbConf.getOptions(), orbConf.getProperties());
        rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
        rootPOA.the_POAManager().activate();
        results.setTime(System.currentTimeMillis() - time);
        results.setSuccessful(true);
        results.setSampleLabel(m_testName + "() @" + m_instanceID);
        if (orb != null)
            orb.destroy();
    } catch (Exception e) {
        results.setSuccessful(false);
        results.setResponseCode(e.getMessage());
        results.setSampleLabel("ERROR: " + e.getMessage());
        getLogger().error(this.getClass().getName() + ": Error during sample", e);
    }
    if (getLogger().isDebugEnabled()) {
        getLogger().debug(whoAmI() + "\trunTest()" + "\tTime:\t" + results.getTime());
        listParameters(context);
    }
    return results;
}
Also used : OrbConfigurator(alma.acs.container.corba.OrbConfigurator) POA(org.omg.PortableServer.POA) SampleResult(org.apache.jmeter.samplers.SampleResult) ORB(org.omg.CORBA.ORB)

Aggregations

OrbConfigurator (alma.acs.container.corba.OrbConfigurator)1 SampleResult (org.apache.jmeter.samplers.SampleResult)1 ORB (org.omg.CORBA.ORB)1 POA (org.omg.PortableServer.POA)1