use of org.hypertrace.core.attribute.service.v1.AttributeMetadata in project gateway-service by hypertrace.
the class QueryValueToGatewayValueConverterTest method whenValueTypeTimestamp_AttributeKindUndefined_thenExpectValueFromFallback.
@Test
public void whenValueTypeTimestamp_AttributeKindUndefined_thenExpectValueFromFallback() {
Value value = Value.newBuilder().setValueType(org.hypertrace.core.query.service.api.ValueType.TIMESTAMP).setTimestamp(10).build();
AttributeMetadata attributeMetadata = AttributeMetadata.newBuilder().setFqn("weight").setValueKind(AttributeKind.KIND_UNDEFINED).build();
org.hypertrace.gateway.service.v1.common.Value retVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value, attributeMetadata);
org.hypertrace.gateway.service.v1.common.Value fallBackVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value);
assertEquals(fallBackVal, retVal);
}
use of org.hypertrace.core.attribute.service.v1.AttributeMetadata in project gateway-service by hypertrace.
the class QueryValueToGatewayValueConverterTest method whenValueTypeFloat_AttributeKindString_thenExpectValueTypeString.
@Test
public void whenValueTypeFloat_AttributeKindString_thenExpectValueTypeString() {
Value value = Value.newBuilder().setValueType(org.hypertrace.core.query.service.api.ValueType.FLOAT).setFloat(10.25f).build();
AttributeMetadata attributeMetadata = AttributeMetadata.newBuilder().setFqn("weight").setValueKind(AttributeKind.TYPE_STRING).build();
org.hypertrace.gateway.service.v1.common.Value retVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value, attributeMetadata);
assertSame(retVal.getValueType(), ValueType.STRING);
assertEquals("10.25", retVal.getString());
}
use of org.hypertrace.core.attribute.service.v1.AttributeMetadata in project gateway-service by hypertrace.
the class QueryValueToGatewayValueConverterTest method whenValueTypeIntegerArray_AttributeKindUndefined_thenExpectValueFromFallback.
@Test
public void whenValueTypeIntegerArray_AttributeKindUndefined_thenExpectValueFromFallback() {
Value value = Value.newBuilder().setValueType(org.hypertrace.core.query.service.api.ValueType.INT_ARRAY).addAllIntArray(IntStream.range(1, 11).boxed().collect(Collectors.toList())).build();
AttributeMetadata attributeMetadata = AttributeMetadata.newBuilder().setFqn("weight").setValueKind(AttributeKind.KIND_UNDEFINED).build();
org.hypertrace.gateway.service.v1.common.Value retVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value, attributeMetadata);
org.hypertrace.gateway.service.v1.common.Value fallBackVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value);
assertEquals(fallBackVal, retVal);
}
use of org.hypertrace.core.attribute.service.v1.AttributeMetadata in project gateway-service by hypertrace.
the class QueryValueToGatewayValueConverterTest method whenValueTypeDouble_AttributeKindUndefined_thenExpectValueFromFallback.
@Test
public void whenValueTypeDouble_AttributeKindUndefined_thenExpectValueFromFallback() {
Value value = Value.newBuilder().setValueType(org.hypertrace.core.query.service.api.ValueType.DOUBLE).setDouble(10.25f).build();
AttributeMetadata attributeMetadata = AttributeMetadata.newBuilder().setFqn("weight").setValueKind(AttributeKind.KIND_UNDEFINED).build();
org.hypertrace.gateway.service.v1.common.Value retVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value, attributeMetadata);
org.hypertrace.gateway.service.v1.common.Value fallBackVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value);
assertEquals(fallBackVal, retVal);
}
use of org.hypertrace.core.attribute.service.v1.AttributeMetadata in project gateway-service by hypertrace.
the class QueryValueToGatewayValueConverterTest method whenValueTypeLong_AttributeKindUndefined_thenExpectValueFromFallback.
@Test
public void whenValueTypeLong_AttributeKindUndefined_thenExpectValueFromFallback() {
Value value = Value.newBuilder().setValueType(org.hypertrace.core.query.service.api.ValueType.LONG).setLong(10).build();
AttributeMetadata attributeMetadata = AttributeMetadata.newBuilder().setFqn("weight").setValueKind(AttributeKind.KIND_UNDEFINED).build();
org.hypertrace.gateway.service.v1.common.Value retVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value, attributeMetadata);
org.hypertrace.gateway.service.v1.common.Value fallBackVal = QueryAndGatewayDtoConverter.convertQueryValueToGatewayValue(value);
assertEquals(fallBackVal, retVal);
}
Aggregations