jerryshao commented on code in PR #14881: URL: https://github.com/apache/gravitino/pull/14881#discussion_r4547747366
########## core/src/test/java/org/apache/gravitino/domain/TestDomainNormalizeDispatcher.java: ########## @@ -0,0 +1,139 @@ +/* + * 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.gravitino.domain; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + +import java.util.function.Consumer; +import org.apache.gravitino.SupportsDomainOperations.LockedDomainState; +import org.apache.gravitino.meta.DomainEntity; +import org.apache.gravitino.tag.TagValue; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.NullAndEmptySource; +import org.junit.jupiter.params.provider.ValueSource; + +class TestDomainNormalizeDispatcher { + private final DomainDispatcher delegate = mock(DomainDispatcher.class); + private final DomainDispatcher dispatcher = new DomainNormalizeDispatcher(delegate); + private final TagValue tag = TagValue.noValue("department"); + + @ParameterizedTest + @NullAndEmptySource + @ValueSource( + strings = { + " ", + ".", + "..", + "-start", + "a.b", + "A/B", + "a b", + "财务", + "*", + "SyStEm", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }) + void rejectsInvalidNewNames(String name) { Review Comment: Extended the parameterized test in 35ac637f62 to cover publish, unpublish, backing-tag updates, listing subdomains, detach, and listMembers with an invalid target name. It also checks the target names for alter and attach. Each case verifies that the delegate received no calls. ########## docs/open-api/domains.yaml: ########## @@ -678,8 +675,11 @@ components: type: string enum: [draft, published] parent: - type: string - nullable: true + oneOf: + - $ref: "#/components/schemas/DomainName" + - type: string + nullable: true + enum: [null] Review Comment: Confirmed locally that `./gradlew :docs:build` passes. The validator accepted the main OpenAPI document, which references both nullable Domain schemas in domains.yaml. -- 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]
