On Aug 21, 2008, at 8:34 AM, Kieran Kelleher wrote:

BTW, you can also use Chuck's EOCopyable implementation/interface combined with ValueGenerator to fill a database based on a list of "seed" EOGlobalIDs.

Now that is a novel use I had not thought of!


This is what I do for some Selenium test setups

BTW, a simple ValueGenerator class might look like this:

<snip>

import org.apache.commons.lang.StringUtils;
import blah, blah;

public final class ValueGenerator {

    private static ValueGenerator _sharedInstance;

    public ValueGenerator() {}

    public static ValueGenerator sharedInstance() {
        if (_sharedInstance == null) {
            _sharedInstance = new ValueGenerator();
        } //~ if (_sharedInstance == null)
        return _sharedInstance;
    }

    /**
     * @return a positive Integer value between 0 and 50
     */
    public Integer integerValue(){
        return new Integer(randomNativeInt(0, 50));
    }

    /**
     * @return a positive Double value between 0.0 and 50.0
     */
    public Double doubleValue(){
        return new Double(randomNativeDouble(0.0d, 50.0d));
    }

    /**
     * @return a positive BigDecimal value between 0.0 and 50.0
     */
    public BigDecimal bigDecimalValue(){
        return new BigDecimal(randomNativeDouble(0.0d, 50.0d));
    }

    /**
     * @return a positive BigInteger value between 0.0 and 50.0
     */
    public BigInteger bigIntegerValue(){
        return BigInteger.valueOf(randomNativeInt(0, 50));
    }

    /**
     * @return a string between 1 and 20 characters
     */
    public String stringValue(){
        return ERXLoremIpsumGenerator.words(1, 20, 20);
    }

    public String oneWord(){
        return ERXLoremIpsumGenerator.words(1,1,30);
    }

    /**
     * @param minValue
     * @param maxValue
* @return random int between <code>minValue</code> and <code>maxValue</code>
     */
    public int randomNativeInt(int minValue, int maxValue){
return minValue + (int)Math.round( Math.random() * (maxValue - minValue) );
    }

public double randomNativeDouble(double minValue, double maxValue){
        return minValue + (Math.random() * (maxValue - minValue));
    }

    // Good for login id's for example
    public String randomishFairlyUniqueWord() {
String str = ERXLoremIpsumGenerator.words(1, 1, 5) + StringUtils.removeStart(new Date().hashCode() + "", "-");
        return StringUtils.replace(str, " ", "", -1);
    }

}

</snip>







On Aug 21, 2008, at 10:56 AM, Florijan Stamenkovic wrote:

Not sure if this has been discussed already, but I could not find anything in the list archives, nor by quickly googling.

So, I'm thinking of making a framework for automated data generation, based on a model and some runtime settings. This would, obviously, be used for testing. Specifically: filling up a database with arbitrary numbers of nonsense rows, that are however legal, and proceeding from there.

Has anyone made this already? Skimmed through the wonder API, but did not see anything that struck a chord...

If nobody ever made it, then why not? It seems a very nice thing to have, and off the top of my head I can not think of any insurmountable obstacle to making it...

F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net

This email sent to [EMAIL PROTECTED]

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to