Search in sources :

Example 1 with SimulationModel

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();
    }
}
Also used : JCommander(com.beust.jcommander.JCommander) SimulationModel(org.iobserve.simulate.petstore.data.SimulationModel)

Example 2 with SimulationModel

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;
}
Also used : Random(java.util.Random) ISOCountryCode(org.iobserve.common.record.ISOCountryCode) Service(org.iobserve.simulate.petstore.data.Service) SimulationModel(org.iobserve.simulate.petstore.data.SimulationModel)

Aggregations

SimulationModel (org.iobserve.simulate.petstore.data.SimulationModel)2 JCommander (com.beust.jcommander.JCommander)1 Random (java.util.Random)1 ISOCountryCode (org.iobserve.common.record.ISOCountryCode)1 Service (org.iobserve.simulate.petstore.data.Service)1