use of com.google.api.expr.test.v1.proto3.TestAllTypesProto.TestAllTypes.NestedMessage in project cel-java by projectnessie.
the class AttributesTest method benchmarkResolverCustomQualifier.
@Test
void benchmarkResolverCustomQualifier() {
TypeRegistry reg = newRegistry();
AttributeFactory attrs = new CustAttrFactory(newAttributeFactory(Container.defaultContainer, reg, reg));
NestedMessage msg = NestedMessage.newBuilder().setBb(123).build();
Activation vars = newActivation(mapOf("msg", msg));
NamespacedAttribute attr = attrs.absoluteAttribute(1, "msg");
Qualifier qualBB = attrs.newQualifier(Type.newBuilder().setMessageType("google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage").build(), 2, "bb");
attr.addQualifier(qualBB);
// Note: Migrated to JMH
}
use of com.google.api.expr.test.v1.proto3.TestAllTypesProto.TestAllTypes.NestedMessage in project cel-java by projectnessie.
the class AttributesTest method resolverCustomQualifier.
@Test
void resolverCustomQualifier() {
TypeRegistry reg = newRegistry();
AttributeFactory attrs = new CustAttrFactory(newAttributeFactory(Container.defaultContainer, reg, reg));
NestedMessage msg = NestedMessage.newBuilder().setBb(123).build();
Activation vars = newActivation(mapOf("msg", msg));
NamespacedAttribute attr = attrs.absoluteAttribute(1, "msg");
Qualifier qualBB = attrs.newQualifier(Type.newBuilder().setMessageType("google.api.expr.test.v1.proto3.TestAllTypes.NestedMessage").build(), 2, "bb");
attr.addQualifier(qualBB);
Object out = attr.resolve(vars);
assertThat(out).isEqualTo(123);
assertThat(estimateCost(attr)).extracting("min", "max").containsExactly(1L, 1L);
}
Aggregations