// Path: jongo/src/main/java/com/meltmedia/dropwizard/jongo/junit/JongoRule.java
// public class JongoRule
//   implements TestRule
// {
//   public static class Builder {
//     private JongoBuilder jongoBuilder = new JongoBuilder();
// 
//     public Builder withClient(Supplier<MongoClient> mongoClient) {
//       jongoBuilder.withClient(mongoClient);
//       return this;
//     }
//     
//     public Builder withDatabaseName( String databaseName ) {
//       jongoBuilder.withDatabaseName(()->databaseName);
//       return this;
//     }
//     
//     public Builder addMapperOps(Consumer<JacksonMapper.Builder> mapperOp ) {
//       jongoBuilder.addMapperOps(mapperOp);
//       return this;
//     }
//     
//     public Builder addMapperModifier(MapperModifier m) {
//       jongoBuilder.addMapperModifier(m);
//       return this;
//     }
//     
//     public Builder addMixin( Class<?> target, Class<?> mixin ) {
//       jongoBuilder.addMixin(target, mixin);
//       return this;
//     }
//  
//     public JongoRule build() {
//       return new JongoRule( jongoBuilder::build );
//     }
//   }
//   
//   public static Builder builder() {
//     return new Builder();
//   }
// 
//   protected Supplier<Jongo> jongoSupplier;
//   protected Jongo jongo;  
// 
//   public JongoRule( Supplier<Jongo> jongoSupplier ) {
//     this.jongoSupplier = jongoSupplier;
//   }
// 
//   /**
//    * When this rule is active, returns the Jongo instance.
//    */
//   public Jongo getJongo() {
//     return jongo;
//   }
//   
//   public MongoCollection dropAndGetCollection( String name ) {
//     MongoCollection collection = jongo.getCollection(name);
//     collection.drop();
//     return collection;
//   }
// 
//   @Override
//   public Statement apply( final Statement statement, final Description description ) {
//     return new Statement() {
//       @Override
//       public void evaluate() throws Throwable {
//         jongo = jongoSupplier.get();
// 
//         statement.evaluate();
// 
//         jongo = null;
//       }
// 
//     };
//   }
// }
// 
// Path: bundle/src/main/java/com/meltmedia/dropwizard/mongo/junit/MongoRule.java
// public class MongoRule
//   implements TestRule
// {
//   MongoClient mongoClient;
//   String host;
//   int port;
// 
//   public MongoRule( String host, int port ) {
//     this.host = host;
//     this.port = port;
//   }
// 
//   /**
//    * Return an instance of the mongo client when this rule is in effect.
//    * 
//    * @return
//    */
//   public MongoClient getClient() {
//     return mongoClient;
//   }
// 
//   /**
//    * Wraps the provided statement with code to create and then clean up a
//    * MongoClient object.
//    */
//   @Override
//   public Statement apply( final Statement statement, final Description description ) {
//     return new Statement() {
//       @Override
//       public void evaluate() throws Throwable {
//         try {
//           mongoClient = new MongoClient(host, port);
//           statement.evaluate();
//         } finally {
//           if( mongoClient != null ) {
//             try {
//               mongoClient.close();
//             } catch( Exception e ) {
//             }
//             mongoClient = null;
//           }
//         }
//       }
//     };
//   }
// }


import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.bson.types.ObjectId;
import org.jongo.MongoCollection;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import com.meltmedia.dropwizard.jongo.junit.JongoRule;
import com.meltmedia.dropwizard.mongo.junit.MongoRule;
package com.meltmedia.dropwizard.jongo;




/**
 * Ensure that when working with this project, one can map string ids to/from mongo
 * object ids.
 * 
 * @author Christian Trimble
 *
 */
public class ObjectIdMappingIT {
  @ClassRule public static MongoRule mongoRule = new MongoRule("localhost", 27017);
  
  public abstract class ObjectIdOnly {
    @org.jongo.marshall.jackson.oid.MongoObjectId
    private String _id;
  }
  
// Path: jongo/src/main/java/com/meltmedia/dropwizard/jongo/junit/JongoRule.java
// public class JongoRule
//   implements TestRule
// {
//   public static class Builder {
//     private JongoBuilder jongoBuilder = new JongoBuilder();
// 
//     public Builder withClient(Supplier<MongoClient> mongoClient) {
//       jongoBuilder.withClient(mongoClient);
//       return this;
//     }
//     
//     public Builder withDatabaseName( String databaseName ) {
//       jongoBuilder.withDatabaseName(()->databaseName);
//       return this;
//     }
//     
//     public Builder addMapperOps(Consumer<JacksonMapper.Builder> mapperOp ) {
//       jongoBuilder.addMapperOps(mapperOp);
//       return this;
//     }
//     
//     public Builder addMapperModifier(MapperModifier m) {
//       jongoBuilder.addMapperModifier(m);
//       return this;
//     }
//     
//     public Builder addMixin( Class<?> target, Class<?> mixin ) {
//       jongoBuilder.addMixin(target, mixin);
//       return this;
//     }
//  
//     public JongoRule build() {
//       return new JongoRule( jongoBuilder::build );
//     }
//   }
//   
//   public static Builder builder() {
//     return new Builder();
//   }
// 
//   protected Supplier<Jongo> jongoSupplier;
//   protected Jongo jongo;  
// 
//   public JongoRule( Supplier<Jongo> jongoSupplier ) {
//     this.jongoSupplier = jongoSupplier;
//   }
// 
//   /**
//    * When this rule is active, returns the Jongo instance.
//    */
//   public Jongo getJongo() {
//     return jongo;
//   }
//   
//   public MongoCollection dropAndGetCollection( String name ) {
//     MongoCollection collection = jongo.getCollection(name);
//     collection.drop();
//     return collection;
//   }
// 
//   @Override
//   public Statement apply( final Statement statement, final Description description ) {
//     return new Statement() {
//       @Override
//       public void evaluate() throws Throwable {
//         jongo = jongoSupplier.get();
// 
//         statement.evaluate();
// 
//         jongo = null;
//       }
// 
//     };
//   }
// }
// 
// Path: bundle/src/main/java/com/meltmedia/dropwizard/mongo/junit/MongoRule.java
// public class MongoRule
//   implements TestRule
// {
//   MongoClient mongoClient;
//   String host;
//   int port;
// 
//   public MongoRule( String host, int port ) {
//     this.host = host;
//     this.port = port;
//   }
// 
//   /**
//    * Return an instance of the mongo client when this rule is in effect.
//    * 
//    * @return
//    */
//   public MongoClient getClient() {
//     return mongoClient;
//   }
// 
//   /**
//    * Wraps the provided statement with code to create and then clean up a
//    * MongoClient object.
//    */
//   @Override
//   public Statement apply( final Statement statement, final Description description ) {
//     return new Statement() {
//       @Override
//       public void evaluate() throws Throwable {
//         try {
//           mongoClient = new MongoClient(host, port);
//           statement.evaluate();
//         } finally {
//           if( mongoClient != null ) {
//             try {
//               mongoClient.close();
//             } catch( Exception e ) {
//             }
//             mongoClient = null;
//           }
//         }
//       }
//     };
//   }
// }


// Path: jongo/src/test/java/com/meltmedia/dropwizard/jongo/ObjectIdMappingIT.java
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.bson.types.ObjectId;
import org.jongo.MongoCollection;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import com.meltmedia.dropwizard.jongo.junit.JongoRule;
import com.meltmedia.dropwizard.mongo.junit.MongoRule;

package com.meltmedia.dropwizard.jongo;




/**
 * Ensure that when working with this project, one can map string ids to/from mongo
 * object ids.
 * 
 * @author Christian Trimble
 *
 */
public class ObjectIdMappingIT {
  @ClassRule public static MongoRule mongoRule = new MongoRule("localhost", 27017);
  
  public abstract class ObjectIdOnly {
    @org.jongo.marshall.jackson.oid.MongoObjectId
    private String _id;
  }
  
  @Rule public JongoRule jongoRule = JongoRule.builder()