Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created October 21, 2011 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1303716 to your computer and use it in GitHub Desktop.
Save anonymous/1303716 to your computer and use it in GitHub Desktop.
private void generate(){
try {
System.out.println("generating");
SecureRandom random = new SecureRandom();
for(int i=0;i<1000;i++){
Random r = new Random();
int words = r.nextInt(40);
int start = r.nextInt(40);
Something s = new Something();
LoremIpsum lorem = new LoremIpsum();
String w = lorem.getWords(words, start);
s.setSomeProp1(w);
words = r.nextInt(40);
start = r.nextInt(40);
String w2 = lorem.getWords(words, start);
s.setSuperDuperProp(w2);
String str = new BigInteger(130, random).toString(32);
s.setUniqueRandom(str);
System.out.println("saving : " + w);
somthingdao.save(s);
System.out.println("saved all somethings :)");
}
Something s2 = new Something();
s2.setSomeProp1("Once upon a time there was a pricess bla bla bla ...");
s2.setUniqueRandom("ABSCDEFG");
somthingdao.save(s2);
//
// List<Something> things = somthingdao.getAll();
// for (Something something : things) {
//
// DBObject dbo = ds.getMapper().toDBObject(something);
//
// es.index(Something.class, something, dbo);
//
//
// }
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("done");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment