izemlyanskiy commented on a change in pull request #1584: URL: https://github.com/apache/avro/pull/1584#discussion_r824923852
########## File path: lang/java/ipc/src/test/java/org/apache/avro/message/TestBigDecimalEvolution.java ########## @@ -0,0 +1,141 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * <p>https://www.apache.org/licenses/LICENSE-2.0 + * + * <p>Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.avro.message; + +import org.apache.avro.Protocol; +import org.apache.avro.Schema; +import org.apache.avro.io.BinaryEncoder; +import org.apache.avro.io.DecoderFactory; +import org.apache.avro.io.EncoderFactory; +import org.apache.avro.ipc.Transceiver; +import org.apache.avro.ipc.reflect.ReflectRequestor; +import org.apache.avro.ipc.reflect.ReflectResponder; + +import org.apache.avro.message.protocol.BDRequest; +import org.apache.avro.message.protocol.BDResponse; +import org.apache.avro.message.protocol.BigDecimalConversionUpgrade; +import org.apache.avro.message.protocol.BigDecimalConversionOld; +import org.apache.avro.message.protocol.BigDecimalProtocol; +import org.apache.avro.reflect.ReflectData; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigDecimal; +import java.nio.ByteBuffer; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class TestBigDecimalEvolution { + + public static final double DELTA = 0.00000001; + private final MockTransceiver transceiver = new MockTransceiver(); + + @Test + public void bigDecimalEvolutionThroughLogicalType() throws Exception { + ReflectData oldApp = new ReflectData(); + oldApp.addLogicalTypeConversion(new BigDecimalConversionOld()); + ReflectData upgradeApp = new ReflectData(); + upgradeApp.addLogicalTypeConversion(new BigDecimalConversionUpgrade()); + + verify(oldApp, oldApp); + verify(upgradeApp, upgradeApp); + verify(upgradeApp, oldApp); + verify(oldApp, upgradeApp); Review comment: thank you for a review @opwvhk! I love Avro API it was a pleasure writing a test :+1: -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
