Examples of MongoConnectorFactoryBean


Examples of com.opengamma.util.mongo.MongoConnectorFactoryBean

   */
  public static MongoConnector getMongoConnector() {
    Properties testProperties = TestProperties.getTestProperties();
    String mongoHost = testProperties.getProperty("mongoServer.host");
    int mongoPort = Integer.parseInt(testProperties.getProperty("mongoServer.port"));
    MongoConnectorFactoryBean mongoFactory = new MongoConnectorFactoryBean();
    mongoFactory.setName("BloombergTestUtils");
    mongoFactory.setHost(mongoHost);
    mongoFactory.setPort(mongoPort);
    mongoFactory.setDatabaseName("testReferenceData");
    mongoFactory.setCollectionSuffix("bloomberg-security-loader-test-context");
    return mongoFactory.getObjectCreating();
  }
View Full Code Here

Examples of com.opengamma.util.mongo.MongoConnectorFactoryBean

   * @param testName  the name of the testing database, used as a suffix, not null
   * @param makeUnique  whether to make the connector unique by date-time
   * @return the Mongo connector, not null
   */
  public static MongoConnector makeTestConnector(String testName, boolean makeUnique) {
    MongoConnectorFactoryBean factory = new MongoConnectorFactoryBean();
    factory.setName("MongoTestUtils");
    Properties properties = TestProperties.getTestProperties();
    factory.setHost(properties.getProperty("mongoServer.host"));
    factory.setPort(Integer.parseInt(properties.getProperty("mongoServer.port")));
    factory.setDatabaseName(System.getProperty("user.name").replace('.', '_') + "_unit");
    String collectionSuffix = "_" + testName;
    if (makeUnique) {
      collectionSuffix += "_" + System.currentTimeMillis();
    }
    factory.setCollectionSuffix(collectionSuffix);
    return factory.createObject();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.