use of org.projectnessie.cel.common.types.pb.ProtoTypeRegistry in project cel-java by projectnessie.
the class ProviderTest method typeRegistryEnumValue.
@Test
void typeRegistryEnumValue() {
ProtoTypeRegistry reg = newEmptyRegistry();
reg.registerDescriptor(GlobalEnum.getDescriptor().getFile());
Val enumVal = reg.enumValue("google.api.expr.test.v1.proto3.GlobalEnum.GOO");
assertThat(enumVal).extracting(Val::intValue).isEqualTo((long) GlobalEnum.GOO.ordinal());
Val enumVal2 = reg.findIdent("google.api.expr.test.v1.proto3.GlobalEnum.GOO");
assertThat(enumVal2.equal(enumVal)).isSameAs(True);
}
use of org.projectnessie.cel.common.types.pb.ProtoTypeRegistry in project cel-java by projectnessie.
the class ProviderTest method typeRegistryFindType.
@Test
void typeRegistryFindType() {
ProtoTypeRegistry reg = newEmptyRegistry();
reg.registerDescriptor(GlobalEnum.getDescriptor().getFile());
String msgTypeName = "google.api.expr.test.v1.proto3.TestAllTypes";
assertThat(reg.findType(msgTypeName)).isNotNull();
// assertThat(reg.findType(msgTypeName + "Undefined")).isNotNull(); ... this doesn't exist in
// protobuf-java
assertThat(reg.findFieldType(msgTypeName, "single_bool")).isNotNull();
assertThat(reg.findFieldType(msgTypeName, "double_bool")).isNull();
}
Aggregations