This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 3488740ab09 Remove OptionalSPI (#23702)
3488740ab09 is described below

commit 3488740ab09e32caca8405474c4757a5712cbd9c
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jan 22 16:12:35 2023 +0800

    Remove OptionalSPI (#23702)
---
 .../infra/util/spi/type/optional/OptionalSPI.java  | 24 ------------
 .../spi/type/optional/OptionalSPIRegistry.java     | 44 ----------------------
 .../spi/type/optional/OptionalSPIRegistryTest.java | 34 -----------------
 .../type/optional/fixture/OptionalSPIFixture.java  | 23 -----------
 .../fixture/impl/OptionalSPIFixtureImpl.java       | 23 -----------
 ...il.spi.type.optional.fixture.OptionalSPIFixture | 18 ---------
 6 files changed, 166 deletions(-)

diff --git 
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPI.java
 
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPI.java
deleted file mode 100644
index 297e2b9a698..00000000000
--- 
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPI.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.shardingsphere.infra.util.spi.type.optional;
-
-/**
- * Optional SPI.
- */
-public interface OptionalSPI {
-}
diff --git 
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistry.java
 
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistry.java
deleted file mode 100644
index b3e6050e4b2..00000000000
--- 
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistry.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.shardingsphere.infra.util.spi.type.optional;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
-
-import java.util.Collection;
-import java.util.Optional;
-
-/**
- * Optional SPI registry.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class OptionalSPIRegistry {
-    
-    /**
-     * Find registered service.
-     *
-     * @param spiClass optional SPI class
-     * @param <T> SPI class type
-     * @return registered service
-     */
-    public static <T extends OptionalSPI> Optional<T> 
findRegisteredService(final Class<T> spiClass) {
-        Collection<T> result = 
ShardingSphereServiceLoader.getServiceInstances(spiClass);
-        return result.isEmpty() ? Optional.empty() : 
Optional.of(result.iterator().next());
-    }
-}
diff --git 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistryTest.java
 
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistryTest.java
deleted file mode 100644
index 02a8cc9c417..00000000000
--- 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/OptionalSPIRegistryTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.shardingsphere.infra.util.spi.type.optional;
-
-import 
org.apache.shardingsphere.infra.util.spi.type.optional.fixture.OptionalSPIFixture;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.junit.Assert.assertTrue;
-
-public final class OptionalSPIRegistryTest {
-    
-    @Test
-    public void assertFindRegisteredService() {
-        Optional<OptionalSPIFixture> actual = 
OptionalSPIRegistry.findRegisteredService(OptionalSPIFixture.class);
-        assertTrue(actual.isPresent());
-    }
-}
diff --git 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/OptionalSPIFixture.java
 
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/OptionalSPIFixture.java
deleted file mode 100644
index 07264f8e6b2..00000000000
--- 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/OptionalSPIFixture.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.shardingsphere.infra.util.spi.type.optional.fixture;
-
-import org.apache.shardingsphere.infra.util.spi.type.optional.OptionalSPI;
-
-public interface OptionalSPIFixture extends OptionalSPI {
-}
diff --git 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/impl/OptionalSPIFixtureImpl.java
 
b/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/impl/OptionalSPIFixtureImpl.java
deleted file mode 100644
index f79cd0d5ee9..00000000000
--- 
a/infra/util/src/test/java/org/apache/shardingsphere/infra/util/spi/type/optional/fixture/impl/OptionalSPIFixtureImpl.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.shardingsphere.infra.util.spi.type.optional.fixture.impl;
-
-import 
org.apache.shardingsphere.infra.util.spi.type.optional.fixture.OptionalSPIFixture;
-
-public class OptionalSPIFixtureImpl implements OptionalSPIFixture {
-}
diff --git 
a/infra/util/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.util.spi.type.optional.fixture.OptionalSPIFixture
 
b/infra/util/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.util.spi.type.optional.fixture.OptionalSPIFixture
deleted file mode 100644
index f6dabaf30e6..00000000000
--- 
a/infra/util/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.util.spi.type.optional.fixture.OptionalSPIFixture
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.shardingsphere.infra.util.spi.type.optional.fixture.impl.OptionalSPIFixtureImpl

Reply via email to