Package de.flapdoodle.embed.mongo

Examples of de.flapdoodle.embed.mongo.MongodStarter


  private DB db;

  @Before
  public void beforeEach() throws Exception {

    MongodStarter runtime = MongodStarter.getDefaultInstance();
    mongodExecutable = runtime.prepare(new MongodConfig(Version.V2_2_1, 12345, Network.localhostIsIPv6()));
    mongodProcess = mongodExecutable.start();
    Mongo mongo = new Mongo("localhost", 12345);
    db = mongo.getDB(DATABASE_NAME);

    // Create collections
View Full Code Here


   
    @BeforeClass
    public static void setUpClass() throws IOException {
        executor = Executors.newSingleThreadExecutor();

        MongodStarter starter = MongodStarter.getDefaultInstance();

        int port = 12345;
        IMongodConfig mongodConfig = new MongodConfigBuilder()
            .version(Version.Main.PRODUCTION)
            .net(new Net(port, Network.localhostIsIPv6()))
            .build();

        try {
            mongodExecutable = starter.prepare(mongodConfig);
            MongodProcess mongod = mongodExecutable.start();
           
            mongoClient = FiberMongoFactory.createClient( "mongodb://localhost:" + port + "/test?maxConnectionCount=10" ).asSerializedClient();
        } catch (IOException ioe) {
            tearDownClass();
View Full Code Here

   * Initiate the MongoDB server on the default port
   */
  @Override
  public void setUpClass() throws Exception {
    super.setUpClass();
    MongodStarter runtime = MongodStarter.getDefaultInstance();

    int port = Network.getFreeServerPort();
    IMongodConfig mongodConfig = new MongodConfigBuilder()
        .version(Version.Main.PRODUCTION)
        .net(new Net(port, Network.localhostIsIPv6())).build();

    // Store Mongo server "host:port" in Hadoop configuration
    // so that MongoStore will be able to get it latter
    conf.set(MongoStore.PROP_MONGO_SERVERS, "127.0.0.1:" + port);

    log.info("Starting embedded Mongodb server on {} port.", port);
    try {

      _mongodExe = runtime.prepare(mongodConfig);
      _mongod = _mongodExe.start();

      _mongo = new MongoClient("localhost", port);
    } catch (Exception e) {
      log.error("Error starting embedded Mongodb server... tearing down test driver.");
View Full Code Here

  public static int PORT = 12345;

  private static MongodProcess mongod = null;

  public static void startDb() {
    MongodStarter starter = MongodStarter.getDefaultInstance();

    try {
        IMongodConfig mongodConfig = new MongodConfigBuilder()
            .version(Version.Main.V2_4)
            .net(new Net(PORT, Network.localhostIsIPv6()))
            .build();

        MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
        mongod = mongodExecutable.start();
    } catch (IOException e) {
      throw new IllegalStateException(e);
    }
  }
View Full Code Here

                                               return prefix + "_axontest_" + counter.getAndIncrement() + "_" + postfix;
                                           }
                                       }))
                .build();

        MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);

        return runtime.prepare(mongodConfig);
    }
View Full Code Here

    }

    @BeforeClass
    public static void setUpClass() throws Exception {
        RuntimeConfig config = RuntimeConfig.getInstance(LOGGER);
        MongodStarter runtime = MongodStarter.getInstance(config);
        int freeServerPort = Network.getFreeServerPort();
        mongodExecutable = runtime.prepare(new MongodConfig(Version.Main.V2_3, freeServerPort,
                                                                             Network.localhostIsIPv6()));
        mongodProcess = mongodExecutable.start();

        binaryStore = new MongodbBinaryStore("localhost", freeServerPort, "test-" + UUID.randomUUID());
        binaryStore.start();
View Full Code Here

  private Mongo mongo;
  private DB db;

  @BeforeMethod
  public void setup() throws Exception {
      MongodStarter runtime = MongodStarter.getDefaultInstance();
      MongodExecutable mongodExe = runtime.prepare( new MongodConfig(Version.V2_3_0, 12345,
          Network.localhostIsIPv6()) );
      mongod = mongodExe.start();
      mongo = new Mongo("localhost", 12345);
      db = mongo.getDB(DATABASE_NAME);
  }
View Full Code Here

  private Mongo mongo;

  @SuppressWarnings("deprecation")
  @Before
  public void beforeEach() throws Exception {
    MongodStarter  runtime = MongodStarter .getDefaultInstance();
      mongodExe = runtime.prepare(new MongodConfig(Version.V2_0_1, MONGODB_PORT, Network.localhostIsIPv6()));
      mongod = mongodExe.start();
      mongo = new Mongo("localhost", MONGODB_PORT);
  }
View Full Code Here

TOP

Related Classes of de.flapdoodle.embed.mongo.MongodStarter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.