Search in sources :

Example 1 with FindOperation

use of com.mongodb.operation.FindOperation in project incubator-skywalking by apache.

the class MongoDBMethodInterceptorTest method setUp.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setUp() throws Exception {
    interceptor = new MongoDBMethodInterceptor();
    Config.Plugin.MongoDB.TRACE_PARAM = true;
    when(enhancedInstance.getSkyWalkingDynamicField()).thenReturn("127.0.0.1:27017");
    BsonDocument document = new BsonDocument();
    document.append("name", new BsonString("by"));
    MongoNamespace mongoNamespace = new MongoNamespace("test.user");
    Decoder decoder = PowerMockito.mock(Decoder.class);
    FindOperation findOperation = new FindOperation(mongoNamespace, decoder);
    findOperation.filter(document);
    arguments = new Object[] { findOperation };
    argumentTypes = new Class[] { findOperation.getClass() };
}
Also used : BsonDocument(org.bson.BsonDocument) BsonString(org.bson.BsonString) MongoNamespace(com.mongodb.MongoNamespace) Decoder(org.bson.codecs.Decoder) FindOperation(com.mongodb.operation.FindOperation) Before(org.junit.Before)

Aggregations

MongoNamespace (com.mongodb.MongoNamespace)1 FindOperation (com.mongodb.operation.FindOperation)1 BsonDocument (org.bson.BsonDocument)1 BsonString (org.bson.BsonString)1 Decoder (org.bson.codecs.Decoder)1 Before (org.junit.Before)1