@Test public void testSchedule_Prop() { System.out.println("schedule from property"); String threadsSchedule = "spawn(1,1s,1s,1s,1m) spawn(2,1s,3s,1s,2h)"; JMeterUtils.setProperty(UltimateThreadGroup.EXTERNAL_DATA_PROPERTY, threadsSchedule); UltimateThreadGroup instance = new UltimateThreadGroup(); JMeterProperty result = instance.getData(); JMeterUtils.setProperty(UltimateThreadGroup.EXTERNAL_DATA_PROPERTY, ""); assertEquals("[[1, 1, 1, 1, 60], [2, 1, 3, 1, 7200]]", result.toString()); }
public JMeterProperty getData() { JMeterProperty brokenProp = getProperty(EXTERNAL_DATA_PROPERTY); JMeterProperty usualProp = getProperty(DATA_PROPERTY); if (brokenProp instanceof CollectionProperty) { if (usualProp == null || usualProp instanceof NullProperty) { log.warn("Copying '" + EXTERNAL_DATA_PROPERTY + "' into '" + DATA_PROPERTY + "'"); JMeterProperty newProp = brokenProp.clone(); newProp.setName(DATA_PROPERTY); setProperty(newProp); } log.warn("Removing property '" + EXTERNAL_DATA_PROPERTY + "' as invalid"); removeProperty(EXTERNAL_DATA_PROPERTY); } CollectionProperty overrideProp = getLoadFromExternalProperty(); if (overrideProp != null) { return overrideProp; } return getProperty(DATA_PROPERTY); }
UltimateThreadGroup extends AbstractSimpleThreadGroup implements Serializable, TestStateListener { public JMeterProperty getData() { JMeterProperty brokenProp = getProperty(EXTERNAL_DATA_PROPERTY); JMeterProperty usualProp = getProperty(DATA_PROPERTY); if (brokenProp instanceof CollectionProperty) { if (usualProp == null || usualProp instanceof NullProperty) { log.warn("Copying '" + EXTERNAL_DATA_PROPERTY + "' into '" + DATA_PROPERTY + "'"); JMeterProperty newProp = brokenProp.clone(); newProp.setName(DATA_PROPERTY); setProperty(newProp); } log.warn("Removing property '" + EXTERNAL_DATA_PROPERTY + "' as invalid"); removeProperty(EXTERNAL_DATA_PROPERTY); } CollectionProperty overrideProp = getLoadFromExternalProperty(); if (overrideProp != null) { return overrideProp; } return getProperty(DATA_PROPERTY); } }
UltimateThreadGroup extends AbstractSimpleThreadGroup implements Serializable, TestStateListener { public JMeterProperty getData() { JMeterProperty brokenProp = getProperty(EXTERNAL_DATA_PROPERTY); JMeterProperty usualProp = getProperty(DATA_PROPERTY); if (brokenProp instanceof CollectionProperty) { if (usualProp == null || usualProp instanceof NullProperty) { log.warn("Copying '" + EXTERNAL_DATA_PROPERTY + "' into '" + DATA_PROPERTY + "'"); JMeterProperty newProp = brokenProp.clone(); newProp.setName(DATA_PROPERTY); setProperty(newProp); } log.warn("Removing property '" + EXTERNAL_DATA_PROPERTY + "' as invalid"); removeProperty(EXTERNAL_DATA_PROPERTY); } CollectionProperty overrideProp = getLoadFromExternalProperty(); if (overrideProp != null) { return overrideProp; } return getProperty(DATA_PROPERTY); } UltimateThreadGroup(); }
UltimateThreadGroup extends AbstractSimpleThreadGroup implements Serializable, TestStateListener { public JMeterProperty getData() { JMeterProperty brokenProp = getProperty(EXTERNAL_DATA_PROPERTY); JMeterProperty usualProp = getProperty(DATA_PROPERTY); if (brokenProp instanceof CollectionProperty) { if (usualProp == null || usualProp instanceof NullProperty) { log.warn("Copying '" + EXTERNAL_DATA_PROPERTY + "' into '" + DATA_PROPERTY + "'"); JMeterProperty newProp = brokenProp.clone(); newProp.setName(DATA_PROPERTY); setProperty(newProp); } log.warn("Removing property '" + EXTERNAL_DATA_PROPERTY + "' as invalid"); removeProperty(EXTERNAL_DATA_PROPERTY); } CollectionProperty overrideProp = getLoadFromExternalProperty(); if (overrideProp != null) { return overrideProp; } return getProperty(DATA_PROPERTY); } UltimateThreadGroup(); JMeterProperty getData(); void setData(CollectionProperty rows); @Override int getNumThreads(); @Override void testStarted(); @Override void testStarted(String host); @Override void testEnded(); @Override void testEnded(String host); }
UltimateThreadGroup extends AbstractSimpleThreadGroup implements Serializable, TestStateListener { public JMeterProperty getData() { JMeterProperty brokenProp = getProperty(EXTERNAL_DATA_PROPERTY); JMeterProperty usualProp = getProperty(DATA_PROPERTY); if (brokenProp instanceof CollectionProperty) { if (usualProp == null || usualProp instanceof NullProperty) { log.warn("Copying '" + EXTERNAL_DATA_PROPERTY + "' into '" + DATA_PROPERTY + "'"); JMeterProperty newProp = brokenProp.clone(); newProp.setName(DATA_PROPERTY); setProperty(newProp); } log.warn("Removing property '" + EXTERNAL_DATA_PROPERTY + "' as invalid"); removeProperty(EXTERNAL_DATA_PROPERTY); } CollectionProperty overrideProp = getLoadFromExternalProperty(); if (overrideProp != null) { return overrideProp; } return getProperty(DATA_PROPERTY); } UltimateThreadGroup(); JMeterProperty getData(); void setData(CollectionProperty rows); @Override int getNumThreads(); @Override void testStarted(); @Override void testStarted(String host); @Override void testEnded(); @Override void testEnded(String host); static final String DATA_PROPERTY; static final String EXTERNAL_DATA_PROPERTY; static final int START_THREADS_CNT_FIELD_NO; static final int INIT_DELAY_FIELD_NO; static final int STARTUP_TIME_FIELD_NO; static final int HOLD_LOAD_FOR_FIELD_NO; static final int SHUTDOWN_TIME_FIELD_NO; }