PluginValueProvider creates a custom Property Expansion to provide values.
The value provider is used to insert dynamic content into messages and property values. This may mean tokens, external data, or anything else you want.
The valueName
property contains the text that is used to trigger the provider.
The annotated class must implement the DynamicPropertyResolver.ValueProvider
interface.
Sample Value Provider
package com.smartbear.ready.plugin.template.factories;
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContext;
import com.eviware.soapui.model.propertyexpansion.resolvers.DynamicPropertyResolver;
import com.eviware.soapui.plugins.auto.PluginValueProvider;
/**
*
*/
@PluginValueProvider(valueName = "randomNumber")
public class SampleValueProvider implements DynamicPropertyResolver.ValueProvider {
@Override
public String getValue(PropertyExpansionContext propertyExpansionContext) {
return String.valueOf(1000 * Math.random());
}
}
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionContext;
import com.eviware.soapui.model.propertyexpansion.resolvers.DynamicPropertyResolver;
import com.eviware.soapui.plugins.auto.PluginValueProvider;
/**
*
*/
@PluginValueProvider(valueName = "randomNumber")
public class SampleValueProvider implements DynamicPropertyResolver.ValueProvider {
@Override
public String getValue(PropertyExpansionContext propertyExpansionContext) {
return String.valueOf(1000 * Math.random());
}
}