Comments (3)
Hi Andrew,
I did manage to solve this by adding all generated Events to an ArrayList (without committing them to a file/logger), and then performing the logEvent iteration outside of the while loop.
I also added a quantity parameter to each configuration step, so I could easily generate 1,000 or even a million instances of a given config step that all get added to a single file for easy importing into a NoSQL database.
// Store all events in this ArrayList for future processing by each logger type
ArrayList<String> events = new ArrayList<String>();
Iterator<WorkflowStep> it = workflow.getSteps().iterator();
while (running && it.hasNext()) {
WorkflowStep step = it.next();
// custom "quantity" parameter added to each configuration step to allow for looping
int stepQuantity = step.getQuantity();
int stepQuantityRun = 0;
while (stepQuantityRun < stepQuantity) {
executeStep(step);
stepQuantityRun++;
}
if (!it.hasNext() && workflow.isRepeatWorkflow()) {
it = workflow.getSteps().iterator();
try {
performWorkflowSleep(workflow);
} catch (InterruptedException ie) {
//wake up!
running = false;
break;
}
}
}
// Log all events here, instead, by concatenating the Events ArrayList from above
for (EventLogger l : eventLoggers) {
l.logEvent(String.join(",", events)
, null);
}
Here's the executeStep method:
try {
String event = generateEvent(wrapper);
// Add the events to the Events Array
events.add(event);
try {
performEventSleep(workflow);
} catch (InterruptedException ie) {
//wake up!
running = false;
break;
}
} catch (IOException ioe) {
log.error("Error generating json event", ioe);
}
I'm building a CRM system, and I'd like the mock data to have relationships built in, despite the records continuing to be selected randomly. My goal is to have an Account/Contact class that not only randomly pulls a Name from the list of companies/contacts, but when company "XYZ" is selected, an ID field of "123" would always be included as well (instead of a random alphaNumeric type). In that way, the mock data has relationships built into it and is much more useful for intricate systems, such as a CRM app.
I'm hacking around and am getting closer to a solution, but again, I'm completely new to Java, so the progress is slow. Any suggestions would be greatly appreciated.
from json-data-generator.
Hey @AaronJessen did you figure this out? Just saw you closed it. I haven't had a chance to look at it yet, so let me know if you solved this.
from json-data-generator.
Hi Andrew,
I did manage to solve this by adding all generated Events to an ArrayList (without committing them to a file/logger), and then performing the logEvent iteration outside of the while loop.
I also added a quantity parameter to each configuration step, so I could easily generate 1,000 or even a million instances of a given config step that all get added to a single file for easy importing into a NoSQL database.
...
Hello @AaronJessen and @andrewserff ,
I'm very interested in your open source software to generate large JSON datasets to evaluate my own software. As far as I looked at it, it is very well coded (even if it lacks some comments)! Like @AaronJessen , I need to generate one file which contains all the generated objects and the quantity
parameter would be very useful for me.
Unfortunately, I'm not able to use @AaronJessen pieces of code to do it on my own. Have you forked the project and made a version with your improvements? If you have, I will be very grateful if you can share it with me.
Sorry for re-opening this old issue but I need some insights.
[UPDATE] I finally managed to use the quantity parameter as an argument and managed to write the events in one file.
Best,
Nelly
from json-data-generator.
Related Issues (20)
- Generate JSON web server logs HOT 2
- Any plans to support SQS producer? HOT 1
- Need help to change the configuration file to limit the numbers of record i create
- Integer values within JSON array are not been maintained
- Can't generate array of double HOT 2
- support for Basic Auth in HttpPostLogger
- Error while using the repeat() function in my Workflow defenition HOT 6
- data generator to kafka
- Troubles running default config
- BUG: closing parenthesis ")" breaks parsing arguments HOT 1
- Upgrade jackson-databind to 2.9.10
- Upgrade mqtt library to v1.2.2
- Properties from prev step.
- Not able to generate JSON output from the schema HOT 1
- HTTP-POST error 404 HOT 1
- Main thread never terminates HOT 1
- How to generate multiple pieces of data in one json file instead of one line of data per file HOT 1
- Allow a DataSource to be used to provide values in generated items HOT 1
- Adding custom function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-data-generator.