Esempio n. 1
0
  @Before
  public void setUp() {
    TestHelper.signon(this);

    // Define connection to db - Lazy Connection
    MongoHelper.setDB("iCrossFit");

    // Clear db
    try {
      MongoHelper.getCollection("trainingClasses").drop();
    }
    // If  connection unsuccessful
    catch (Exception e) {
      System.out.println("Mongo DB is not running.  Please start and try again.");
      TestHelper.failed("Mongo DB is not running.  Please start and try again.");
    }

    // Create a training Class instance
    TrainingClass trainingClass = new TrainingClass();

    // Save initial training Class instance to db
    if (!MongoHelper.save(trainingClass, "trainingClasses")) {
      TestHelper.failed("Initial training Class Save failed.");
    }

    // Report status
    System.out.println(
        "Successfully saved initial training Class id = " + trainingClass.getId() + ".");
  }
Esempio n. 2
0
  @Before
  public void setUp() {
    TestHelper.signon(this);

    // Connect to DB - Lazy
    MongoHelper.setDB("iCrossFit");

    // Clear out DB
    try {
      MongoHelper.getCollection("trainingClasses").drop();
    }
    // If not connected
    catch (Exception e) {
      System.out.println("Mongo DB is not running.  Please start and try again.");
      TestHelper.failed("Mongo DB is not running.  Please start and try again.");
    }
  }