roryqi commented on code in PR #11127: URL: https://github.com/apache/gravitino/pull/11127#discussion_r3256778687
########## plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/mapper/IdpGroupMetaSQLProviderFactory.java: ########## @@ -0,0 +1,109 @@ +/* + * 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.idp.storage.mapper; + +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import org.apache.gravitino.idp.storage.mapper.provider.base.IdpGroupMetaBaseSQLProvider; +import org.apache.gravitino.idp.storage.mapper.provider.h2.IdpGroupMetaH2Provider; +import org.apache.gravitino.idp.storage.mapper.provider.postgresql.IdpGroupMetaPostgreSQLProvider; +import org.apache.gravitino.idp.storage.po.IdpGroupPO; +import org.apache.gravitino.storage.relational.JDBCBackend.JDBCBackendType; +import org.apache.gravitino.storage.relational.session.SqlSessionFactoryHelper; +import org.apache.ibatis.annotations.Param; + +public class IdpGroupMetaSQLProviderFactory { + private static final IdpGroupMetaBaseSQLProvider IDP_GROUP_META_BASE_PROVIDER = + new IdpGroupMetaBaseSQLProvider(); + private static final IdpGroupMetaBaseSQLProvider IDP_GROUP_META_H2_PROVIDER = + new IdpGroupMetaH2Provider(); + private static final IdpGroupMetaBaseSQLProvider IDP_GROUP_META_POSTGRESQL_PROVIDER = + new IdpGroupMetaPostgreSQLProvider(); + + private static final Map<JDBCBackendType, IdpGroupMetaBaseSQLProvider> + IDP_GROUP_META_SQL_PROVIDER_MAP = + ImmutableMap.of( + JDBCBackendType.MYSQL, IDP_GROUP_META_BASE_PROVIDER, + JDBCBackendType.H2, IDP_GROUP_META_H2_PROVIDER, + JDBCBackendType.POSTGRESQL, IDP_GROUP_META_POSTGRESQL_PROVIDER); + + static IdpGroupMetaBaseSQLProvider getProvider(String databaseId) { Review Comment: Could u extract a util method? It's similar to user meta mapper. We reuse the method. It will better that we can extract abstract class similar to BaseSQLProviderFactory. ########## plugins/idp-basic/src/test/java/org/apache/gravitino/idp/storage/mapper/TestIdpGroupMetaStorage.java: ########## @@ -0,0 +1,174 @@ +/* + * 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.idp.storage.mapper; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.IOException; +import org.apache.gravitino.idp.storage.po.IdpGroupPO; +import org.apache.gravitino.storage.relational.session.SqlSessionFactoryHelper; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; + +@Tag("gravitino-docker-test") +class TestIdpGroupMetaStorage extends AbstractIdpMetaStorageTest { Review Comment: Will it run the user tests iff we extends `AbstractIdpMetaStorageTest` directly. You have two options: 1) Remove user tests from `AbstractIdpMetaStorageTest`, add a user test class TestIdpUserMetaStorage 2) Put all the test cases to `AbstractIdpMetaStorageTest` and rename `AbstractIdpMetaStorageTest` to `IdpMetaStorageTest`. ########## plugins/idp-basic/src/main/java/org/apache/gravitino/idp/storage/po/IdpGroupPO.java: ########## @@ -0,0 +1,41 @@ +/* + * 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.idp.storage.po; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.ToString; + +@Getter +@EqualsAndHashCode +@ToString +@NoArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Builder(setterPrefix = "with") +public class IdpGroupPO { + private Long groupId; + private String groupname; Review Comment: You should use groupName here. Why do we use username instead of userName? Because username is one word. `group name` is two words. -- 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]
