gemmellr commented on code in PR #5079: URL: https://github.com/apache/activemq-artemis/pull/5079#discussion_r1677606126
########## artemis-server/src/test/java/org/apache/activemq/artemis/core/config/DivertConfigurationEncodingTest.java: ########## @@ -0,0 +1,47 @@ +/* + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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.activemq.artemis.core.config; + +import org.apache.activemq.artemis.api.core.ActiveMQBuffer; +import org.apache.activemq.artemis.api.core.ActiveMQBuffers; +import org.apache.activemq.artemis.core.server.ComponentConfigurationRoutingType; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DivertConfigurationEncodingTest { + + @Test + public void testStoreDivertConfigurationWithTransformerNoProperties() { + DivertConfiguration configuration = new DivertConfiguration(); + configuration.setName("myDivertName"); + configuration.setAddress("myDivertAddress"); + configuration.setForwardingAddress("myDivertForwardingAddress"); + configuration.setFilterString("foo='foo'"); + configuration.setRoutingName("myDivertRoutingName"); + configuration.setExclusive(false); + configuration.setRoutingType(ComponentConfigurationRoutingType.ANYCAST); + TransformerConfiguration myDivertTransformer = new TransformerConfiguration("myDivertTransformer"); + myDivertTransformer.getProperties().put("foo", "foo"); + configuration.setTransformerConfiguration(myDivertTransformer); + + int encodeSize = configuration.getEncodeSize(); + ActiveMQBuffer data = ActiveMQBuffers.fixedBuffer(encodeSize); + configuration.encode(data); + assertEquals(encodeSize, data.writerIndex()); Review Comment: Asserting the actual encoding size is as expected, and the actual bytes written, would seem like a good idea for an encoding test. Had that been done previously the bugs fixed should have been caught. Meanwhile this test would still let similar problems be introduced, e.g if it suddenly didn't write the correct things, or anything at all, but said that, this test would still pass. -- 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: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact