Search in sources :

Example 1 with Quantity

use of io.kubernetes.client.proto.Resource.Quantity in project seldon-core by SeldonIO.

the class JsonFormatTest method testQuantityCustomFormat.

@Test
public void testQuantityCustomFormat() throws InvalidProtocolBufferException {
    final String val = "100Mi";
    Quantity q = Quantity.newBuilder().setString(val).build();
    Printer jf = JsonFormat.printer().usingTypeConverter(q.getDescriptorForType().getFullName(), new QuantityUtils.QuantityConverter());
    Assert.assertTrue(jf.print(q).equals("\"" + val + "\""));
}
Also used : Quantity(io.kubernetes.client.proto.Resource.Quantity) IntOrString(io.kubernetes.client.proto.IntStr.IntOrString) Printer(io.seldon.clustermanager.pb.JsonFormat.Printer) Test(org.junit.Test)

Aggregations

IntOrString (io.kubernetes.client.proto.IntStr.IntOrString)1 Quantity (io.kubernetes.client.proto.Resource.Quantity)1 Printer (io.seldon.clustermanager.pb.JsonFormat.Printer)1 Test (org.junit.Test)1