@Test public void testExecute() throws Exception { System.out.println("execute"); SampleResult previousResult = null; Sampler currentSampler = null; FifoPop instance = new FifoPop(); LinkedList<CompoundVariable> list = new LinkedList<>(); list.add(new CompoundVariable("FifoPoptest")); list.add(new CompoundVariable("FifoPoptest")); instance.setParameters(list); FifoMap.getInstance().put("FifoPoptest", "FifoPoptest"); String expResult = "FifoPoptest"; String result = instance.execute(null, null); Assert.assertEquals(expResult, result); }
@Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); String value = null; try { Object valueObj = FifoMap.getInstance().pop(fifoName, timeout); if (valueObj != null) { value = valueObj.toString(); } } catch (InterruptedException ex) { log.warn("Interrupted pop from queue " + fifoName); value = "INTERRUPTED"; } JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; }
FifoPop extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); String value = null; try { Object valueObj = FifoMap.getInstance().pop(fifoName, timeout); if (valueObj != null) { value = valueObj.toString(); } } catch (InterruptedException ex) { log.warn("Interrupted pop from queue " + fifoName); value = "INTERRUPTED"; } JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; } }
FifoPop extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); String value = null; try { Object valueObj = FifoMap.getInstance().pop(fifoName, timeout); if (valueObj != null) { value = valueObj.toString(); } } catch (InterruptedException ex) { log.warn("Interrupted pop from queue " + fifoName); value = "INTERRUPTED"; } JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; } FifoPop(); }
FifoPop extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); String value = null; try { Object valueObj = FifoMap.getInstance().pop(fifoName, timeout); if (valueObj != null) { value = valueObj.toString(); } } catch (InterruptedException ex) { log.warn("Interrupted pop from queue " + fifoName); value = "INTERRUPTED"; } JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; } FifoPop(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); @Override List<String> getArgumentDesc(); }
FifoPop extends AbstractFunction { @Override public synchronized String execute(SampleResult previousResult, Sampler currentSampler) throws InvalidVariableException { String fifoName = ((CompoundVariable) values[0]).execute(); String value = null; try { Object valueObj = FifoMap.getInstance().pop(fifoName, timeout); if (valueObj != null) { value = valueObj.toString(); } } catch (InterruptedException ex) { log.warn("Interrupted pop from queue " + fifoName); value = "INTERRUPTED"; } JMeterVariables vars = getVariables(); if (vars != null && values.length > 1) { String varName = ((CompoundVariable) values[1]).execute().trim(); vars.put(varName, value); } return value; } FifoPop(); @Override synchronized String execute(SampleResult previousResult, Sampler currentSampler); @Override synchronized void setParameters(Collection<CompoundVariable> parameters); @Override String getReferenceKey(); @Override List<String> getArgumentDesc();  }