@Test public void testCredentials() { Optional<MongoCredential> credentials = SharedMongoResource.createCredentials(TEST_USER, TEST_PASS, TEST_DB); assertTrue(credentials.isPresent()); assertEquals(TEST_USER, credentials.get().getUserName()); assertEquals(TEST_PASS, new String(credentials.get().getPassword())); credentials = SharedMongoResource.createCredentials(null, TEST_PASS, TEST_DB); assertFalse(credentials.isPresent()); credentials = SharedMongoResource.createCredentials(TEST_USER, null, TEST_DB); assertFalse(credentials.isPresent()); credentials = SharedMongoResource.createCredentials(TEST_USER, TEST_PASS, null); assertFalse(credentials.isPresent()); }
public static Optional<MongoCredential> createCredentials( String username, String password, String database) { if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) { return Optional.of( MongoCredential.createMongoCRCredential(username, database, password.toCharArray())); } else { return Optional.absent(); } }
SharedMongoResource extends BaleenResource { public static Optional<MongoCredential> createCredentials( String username, String password, String database) { if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) { return Optional.of( MongoCredential.createMongoCRCredential(username, database, password.toCharArray())); } else { return Optional.absent(); } } }
SharedMongoResource extends BaleenResource { public static Optional<MongoCredential> createCredentials( String username, String password, String database) { if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) { return Optional.of( MongoCredential.createMongoCRCredential(username, database, password.toCharArray())); } else { return Optional.absent(); } }  }
SharedMongoResource extends BaleenResource { public static Optional<MongoCredential> createCredentials( String username, String password, String database) { if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) { return Optional.of( MongoCredential.createMongoCRCredential(username, database, password.toCharArray())); } else { return Optional.absent(); } }  static Optional<MongoCredential> createCredentials(
      String username, String password, String database); MongoDatabase getDB(); String getMongoURI(); }
SharedMongoResource extends BaleenResource { public static Optional<MongoCredential> createCredentials( String username, String password, String database) { if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) { return Optional.of( MongoCredential.createMongoCRCredential(username, database, password.toCharArray())); } else { return Optional.absent(); } }  static Optional<MongoCredential> createCredentials(
      String username, String password, String database); MongoDatabase getDB(); String getMongoURI(); static final String RESOURCE_KEY; static final String PARAM_HOST; static final String PARAM_PORT; static final String PARAM_DB; static final String PARAM_USER; static final String PARAM_PASS; }