lowka commented on code in PR #6225: URL: https://github.com/apache/ignite-3/pull/6225#discussion_r2200134983
########## modules/runner/src/test/java/org/apache/ignite/internal/configuration/compatibility/framework/ConfigAnnotation.java: ########## @@ -29,38 +32,53 @@ public class ConfigAnnotation { @JsonProperty private String name; @JsonProperty - private Map<String, String> properties; + private Map<String, ConfigAnnotationValue> properties = new LinkedHashMap<>(); + @SuppressWarnings("unused") ConfigAnnotation() { // Default constructor for Jackson deserialization. } - ConfigAnnotation(String name) { - this(name, Map.of()); - } - - ConfigAnnotation(String name, Map<String, String> properties) { + ConfigAnnotation(String name, Map<String, ConfigAnnotationValue> properties) { this.name = name; this.properties = properties; } - @Override - public int hashCode() { - return Objects.hashCode(name); + /** + * Returns annotation type name. + */ + public String name() { + return name; + } + + /** + * Returns values of annotation properties. + */ + public Map<String, ConfigAnnotationValue> properties() { + return properties; } @Override public boolean equals(Object o) { - // TODO https://issues.apache.org/jira/browse/IGNITE-25747 Validate annotations properly. - return o != null && getClass() == o.getClass() && name.equals(((ConfigAnnotation) o).name); + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigAnnotation that = (ConfigAnnotation) o; + return Objects.equals(name, that.name) && Objects.equals(properties, that.properties); + } + @Override + public int hashCode() { + return Objects.hash(name, properties); } @Override public String toString() { + // This method is used for metadata comparison, + // so we exclude values from the comparison. Review Comment: Thanks. Fixed. ########## modules/runner/src/test/java/org/apache/ignite/internal/configuration/compatibility/framework/ConfigAnnotationValue.java: ########## @@ -0,0 +1,100 @@ +/* + * 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.ignite.internal.configuration.compatibility.framework; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** + * Annotation property value. + */ +public class ConfigAnnotationValue { + @JsonProperty + private String typeName; + @JsonProperty + private Object value; + + @SuppressWarnings("unused") + public ConfigAnnotationValue() { + // Default constructor for Jackson deserialization. + } + + private ConfigAnnotationValue(String typeName, Object value) { + this.typeName = typeName; + this.value = value; + } + + /** + * Creates a value for a non-array property. + * + * @param className Class name. + * @param value Value. + * @return Value. + */ + public static ConfigAnnotationValue value(String className, Object value) { + return new ConfigAnnotationValue(className, value); + } + + /** + * Returns a value. + */ + public Object value() { + return value; + } + + /** + * Creates a value for an array property. + * + * @param elementClassName Element type name. + * @param elements Elements. + * @return Value. + */ + public static ConfigAnnotationValue array(String elementClassName, List<Object> elements) { Review Comment: Thanks. Fixed. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org