Search in sources :

Example 16 with StringStringValue

use of com.navercorp.pinpoint.common.util.StringStringValue in project pinpoint by naver.

the class MongoDBITBase method deleteData.

public void deleteData(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl) {
    // delete data
    Document doc = new Document("name", "Roy3");
    DeleteResult deleteResult = collection.deleteMany(doc);
    Method deleteMany = getMethod(mongoDatabaseImpl, "deleteMany", Bson.class);
    NormalizedBson parsedBson = parseBson(doc);
    verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, deleteMany, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), "customers"), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), "MAJORITY"), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
    Assert.assertEquals(1, deleteResult.getDeletedCount());
}
Also used : ExpectedAnnotation(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) NormalizedBson(com.navercorp.pinpoint.plugin.mongo.NormalizedBson) Method(java.lang.reflect.Method) Document(org.bson.Document) BsonDocument(org.bson.BsonDocument) DeleteResult(com.mongodb.client.result.DeleteResult)

Example 17 with StringStringValue

use of com.navercorp.pinpoint.common.util.StringStringValue in project pinpoint by naver.

the class MongoDBITBase method filterData2.

public void filterData2(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl) {
    Method find = getMethod(mongoDatabaseImpl, "find", Bson.class);
    Bson bson = and(exists("name"), nin("name", 5, 15));
    NormalizedBson parsedBson = parseBson(bson);
    MongoCursor<Document> cursor = collection.find(bson).iterator();
    verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, find, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), "customers"), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), "secondaryPreferred"), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
    assertResultSize(1, cursor);
}
Also used : ExpectedAnnotation(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) NormalizedBson(com.navercorp.pinpoint.plugin.mongo.NormalizedBson) Method(java.lang.reflect.Method) Document(org.bson.Document) BsonDocument(org.bson.BsonDocument) Bson(org.bson.conversions.Bson) NormalizedBson(com.navercorp.pinpoint.plugin.mongo.NormalizedBson)

Example 18 with StringStringValue

use of com.navercorp.pinpoint.common.util.StringStringValue in project pinpoint by naver.

the class MongoDBITBase method insertData.

public void insertData(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl, String collectionInfo, String collectionOption) {
    // insert Data
    Document doc = new Document("name", "Roy").append("company", "Naver");
    collection.insertOne(doc);
    Method insertOneMethod = getMethod(mongoDatabaseImpl, "insertOne", Object.class);
    NormalizedBson parsedBson = parseBson(doc);
    verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, insertOneMethod, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), collectionInfo), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), collectionOption), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
}
Also used : ExpectedAnnotation(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) NormalizedBson(com.navercorp.pinpoint.plugin.mongo.NormalizedBson) Method(java.lang.reflect.Method) Document(org.bson.Document) BsonDocument(org.bson.BsonDocument)

Example 19 with StringStringValue

use of com.navercorp.pinpoint.common.util.StringStringValue in project pinpoint by naver.

the class MongoDBITBase method insertComlexBsonValueData30.

public void insertComlexBsonValueData30(PluginTestVerifier verifier, MongoCollection<Document> collection, Class<?> mongoDatabaseImpl, String collectionInfo, String collectionOption) {
    // insert Data
    Document document = createComplexDocument();
    collection.insertOne(document);
    Method insertOneMethod = getMethod(mongoDatabaseImpl, "insertOne", Object.class);
    NormalizedBson parsedBson = parseBson(document);
    verifier.verifyTrace(event(MONGO_EXECUTE_QUERY, insertOneMethod, null, MongoDBITConstants.MONGODB_ADDRESS, null, new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_INFO.getName(), collectionInfo), new ExpectedAnnotation(MongoConstants.MONGO_COLLECTION_OPTION.getName(), collectionOption), new ExpectedAnnotation(MongoConstants.MONGO_JSON_DATA.getName(), new StringStringValue(parsedBson.getNormalizedBson(), parsedBson.getParameter()))));
}
Also used : ExpectedAnnotation(com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) NormalizedBson(com.navercorp.pinpoint.plugin.mongo.NormalizedBson) Method(java.lang.reflect.Method) Document(org.bson.Document) BsonDocument(org.bson.BsonDocument)

Example 20 with StringStringValue

use of com.navercorp.pinpoint.common.util.StringStringValue in project pinpoint by naver.

the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_StringString.

@Test
public void buildPAnnotationValue_StringString() {
    StringStringValue intStringValue = new StringStringValue("1", "2");
    PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
    PStringStringValue pAnnotation = container.getStringStringValue();
    Assert.assertEquals(pAnnotation.getStringValue1().getValue(), "1");
    Assert.assertEquals(pAnnotation.getStringValue2().getValue(), "2");
}
Also used : PAnnotationValue(com.navercorp.pinpoint.grpc.trace.PAnnotationValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) StringStringValue(com.navercorp.pinpoint.common.util.StringStringValue) IntStringStringValue(com.navercorp.pinpoint.common.util.IntStringStringValue) PIntStringStringValue(com.navercorp.pinpoint.grpc.trace.PIntStringStringValue) PStringStringValue(com.navercorp.pinpoint.grpc.trace.PStringStringValue) Test(org.junit.Test)

Aggregations

StringStringValue (com.navercorp.pinpoint.common.util.StringStringValue)20 ExpectedAnnotation (com.navercorp.pinpoint.bootstrap.plugin.test.ExpectedAnnotation)7 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)7 NormalizedBson (com.navercorp.pinpoint.plugin.mongo.NormalizedBson)7 Method (java.lang.reflect.Method)7 BsonDocument (org.bson.BsonDocument)7 Document (org.bson.Document)7 PIntStringStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringStringValue)5 PStringStringValue (com.navercorp.pinpoint.grpc.trace.PStringStringValue)5 IntStringValue (com.navercorp.pinpoint.common.util.IntStringValue)3 LongIntIntByteByteStringValue (com.navercorp.pinpoint.common.util.LongIntIntByteByteStringValue)3 PIntStringValue (com.navercorp.pinpoint.grpc.trace.PIntStringValue)3 PLongIntIntByteByteStringValue (com.navercorp.pinpoint.grpc.trace.PLongIntIntByteByteStringValue)3 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)2 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)2 DataType (com.navercorp.pinpoint.common.util.DataType)2 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)2 PAnnotationValue (com.navercorp.pinpoint.grpc.trace.PAnnotationValue)2 PIntBooleanIntBooleanValue (com.navercorp.pinpoint.grpc.trace.PIntBooleanIntBooleanValue)2