• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Automatic data generation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic data generation


  • Subject: Re: Automatic data generation
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 21 Aug 2008 10:44:44 -0700


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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

-- 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@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Automatic data generation (From: Florijan Stamenkovic <email@hidden>)
 >Re: Automatic data generation (From: Kieran Kelleher <email@hidden>)
 >Re: Automatic data generation (From: Kieran Kelleher <email@hidden>)

  • Prev by Date: Re: Automatic data generation
  • Next by Date: Re: Automatic data generation
  • Previous by thread: Re: Automatic data generation
  • Next by thread: Re: Automatic data generation
  • Index(es):
    • Date
    • Thread