use of org.iobserve.simulate.petstore.data.SimulationModel in project iobserve-analysis by research-iobserve.
the class SimulatePetStoreMain method main.
/**
* @param args
* command line arguments
* @throws InterruptedException
* on thread interruption
*/
public static void main(final String[] args) throws InterruptedException {
final Settings configuration = new Settings();
final JCommander commander = new JCommander(configuration);
commander.parse(args);
if (configuration.getPort() != null) {
SimulatePetStoreMain.startReconfigurationListener(configuration);
}
// create model
final SimulationModel model = SimulatePetStoreMain.createModel(configuration);
// execute model
SimulatePetStoreMain.executeModel(model, configuration);
if (SimulatePetStoreMain.execution != null) {
SimulatePetStoreMain.execution.abortEventually();
}
}
use of org.iobserve.simulate.petstore.data.SimulationModel in project iobserve-analysis by research-iobserve.
the class SimulatePetStoreMain method createModel.
private static SimulationModel createModel(final Settings configuration) {
final SimulationModel model = new SimulationModel(configuration.getDelay(), configuration.getLocations(), configuration.getIterations());
final Random random = new Random();
model.getServices().add(new Service("jpetstore-account-database", SimulatePetStoreMain.createIP(0), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-catalog-database", SimulatePetStoreMain.createIP(1), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-order-database", SimulatePetStoreMain.createIP(2), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-order-service", SimulatePetStoreMain.createIP(3), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-catalog-service", SimulatePetStoreMain.createIP(4), ISOCountryCode.GERMANY));
model.getServices().add(new Service("jpetstore-frontend-service", SimulatePetStoreMain.createIP(5), ISOCountryCode.GERMANY));
for (int i = 0; i < configuration.getAccounting(); i++) {
final ISOCountryCode countryCode = configuration.getLocations().get(random.nextInt(configuration.getLocations().size()));
model.getServices().add(new Service("jpetstore-account-service", SimulatePetStoreMain.createIP(i + 6), countryCode));
}
return model;
}
Aggregations