You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/09/18 11:08:22 UTC

[isis] 01/03: ISIS-2435: Commons: remove CDI plugin

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

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

commit 163f779cdb3a92f0ea0979dcf400c193fed00fad
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Sep 18 12:03:24 2020 +0200

    ISIS-2435: Commons: remove CDI plugin
---
 .../commons/internal/ioc/cdi/BeanAdapterCDI.java   |  54 -----
 .../isis/commons/internal/ioc/cdi/CdiPlugin.java   |  52 -----
 .../apache/isis/commons/internal/ioc/cdi/_CDI.java | 243 ---------------------
 .../commons/internal/ioc/cdi/_CDI_Lifecycle.java   |  44 ----
 .../plugins/ioc/ConversationContextHandle.java     |  30 ---
 .../plugins/ioc/ConversationContextService.java    |  32 ---
 .../ioc/ConversationContextServiceDefault.java     |  38 ----
 .../apache/isis/commons/internal/cdi/CDITest.java  | 128 -----------
 .../internal/cdi/ValidQualifierForTesting.java     |  35 ---
 9 files changed, 656 deletions(-)

diff --git a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/BeanAdapterCDI.java b/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/BeanAdapterCDI.java
deleted file mode 100644
index dd6e5de..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/BeanAdapterCDI.java
+++ /dev/null
@@ -1,54 +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.isis.commons.internal.ioc.cdi;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.apache.isis.commons.collections.Can;
-import org.apache.isis.commons.internal.ioc.ManagedBeanAdapter;
-
-import lombok.Value;
-import lombok.val;
-
-@Value(staticConstructor="of")
-final class BeanAdapterCDI implements ManagedBeanAdapter {
-
-    private final String id;
-    private final Bean<?> bean;
-
-    @Override
-    public Can<?> getInstance() {
-        val type = bean.getBeanClass();
-        return _CDI.select(type, bean.getQualifiers());
-    }
-
-    @Override
-    public boolean isCandidateFor(Class<?> requiredType) {
-        return bean.getTypes().stream()
-                .filter(type -> type instanceof Class)
-                .map(type->(Class<?>)type)
-                .anyMatch(type->requiredType.isAssignableFrom(type));
-    }
-
-    @Override
-    public Class<?> getBeanClass() {
-        return bean.getBeanClass(); //TODO[2033] does not work for 'produced' beans
-    }
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/CdiPlugin.java b/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/CdiPlugin.java
deleted file mode 100644
index 815e92f..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/CdiPlugin.java
+++ /dev/null
@@ -1,52 +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.isis.commons.internal.ioc.cdi;
-
-import java.util.stream.Stream;
-
-import javax.enterprise.inject.spi.CDIProvider;
-
-import org.apache.isis.commons.internal.context._Plugin;
-
-/**
- * No longer used since 2.0.
- *  
- * @since 2.0
- */
-interface CdiPlugin {
-
-    // -- INTERFACE
-
-    public CDIProvider getCDIProvider(Stream<Class<?>> discover);
-
-    // -- LOOKUP
-
-    public static CdiPlugin get() {
-
-        return _Plugin.getOrElse(CdiPlugin.class,
-                ambiguousPlugins->{
-                    return _Plugin.pickAnyAndWarn(CdiPlugin.class, ambiguousPlugins);
-                },
-                ()->{
-                    throw _Plugin.absenceNonRecoverable(CdiPlugin.class);
-                });
-    }
-
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI.java b/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI.java
deleted file mode 100644
index bec3ac4..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI.java
+++ /dev/null
@@ -1,243 +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.isis.commons.internal.ioc.cdi;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.annotation.Nullable;
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.CDI;
-import javax.enterprise.inject.spi.CDIProvider;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Qualifier;
-
-import org.apache.isis.commons.collections.Can;
-import org.apache.isis.commons.internal.base._NullSafe;
-import org.apache.isis.commons.internal.base._With;
-import org.apache.isis.commons.internal.context._Context;
-import org.apache.isis.commons.internal.exceptions._Exceptions;
-import org.apache.isis.commons.internal.functions._Functions.CheckedRunnable;
-import org.apache.isis.commons.internal.ioc.ManagedBeanAdapter;
-
-import static org.apache.isis.commons.internal.base._NullSafe.isEmpty;
-import static org.apache.isis.commons.internal.base._NullSafe.stream;
-
-import lombok.val;
-
-/**
- * <h1>- internal use only -</h1>
- * <p>
- * Framework internal CDI support.
- * <p>
- * <b>WARNING</b>: Do <b>NOT</b> use any of the classes provided by this package! <br/>
- * These may be changed or removed without notice!
- *
- * @since 2.0
- */
-public final class _CDI {
-
-    /**
-     * Bootstrap CDI if not already present.
-     * @param onDiscover - Packages of the specified (stream of) classes will be scanned and found classes 
-     * will be added to the set of bean classes for the synthetic bean archive. 
-     */
-    public static void init(Supplier<Stream<Class<?>>> onDiscover) {
-
-        if(cdi().isPresent()) {
-            return;
-        }
-
-        _With.requires(onDiscover, "onDiscover");
-
-        // plug in the provider
-        final CDIProvider standaloneCDIProvider = CdiPlugin.get().getCDIProvider(onDiscover.get());
-        CDI.setCDIProvider(standaloneCDIProvider);
-
-        // verify
-        if(!cdi().isPresent()) {
-            throw _Exceptions.unrecoverable("Could not resolve an instance of CDI.");
-        }
-
-        // proper CDI lifecycle support utilizing the fact that WELD provides a WeldContainer that 
-        // implements AutoCloseable, which we can put on the _Context, such that when _Context.clear()
-        // is called, gets properly closed
-        final CheckedRunnable onClose = () -> ((AutoCloseable)CDI.current()).close();
-        _Context.putSingleton(_CDI_Lifecycle.class, _CDI_Lifecycle.of(onClose));
-
-    }
-
-    /**
-     * Get the CDI BeanManager for the current context.
-     * @return non-null
-     * @throws RuntimeException - if no BeanManager could be resolved
-     */
-    public static BeanManager getBeanManager() {
-        return cdi().map(CDI::getBeanManager)
-                .orElseThrow(()->_Exceptions.unrecoverable("Could not resolve a BeanManager."));
-    }
-
-    /**
-     * Obtains a child Instance for the given required type and additional required qualifiers. 
-     * @param subType
-     * @param qualifiers
-     * @return non-null {@code Bin}
-     */
-    public static <T> Can<T> select(final Class<T> subType, Collection<Annotation> qualifiers) {
-        if(_NullSafe.isEmpty(qualifiers)) {
-            return select(subType);
-        }
-
-        final Annotation[] _qualifiers = qualifiers.toArray(new Annotation[] {});
-
-        return cdi()
-                .map(cdi->tryGet(()->cdi.select(subType, _qualifiers)))
-                .map(instance->Can.ofInstance(instance))
-                .orElse(Can.empty());
-    }
-
-    /**
-     * Obtains a child Instance for the given required type and additional required qualifiers. 
-     * @param subType
-     * @return non-null {@code Bin}
-     */
-    public static <T> Can<T> select(final Class<T> subType) {
-        return cdi()
-                .map(cdi->tryGet(()->cdi.select(subType)))
-                .map(instance->Can.ofInstance(instance))
-                .orElse(Can.empty());
-    }
-
-
-    /**
-     * Filters the input array into a collection, such that only annotations are retained, 
-     * that are valid qualifiers for CDI.
-     * @param annotations
-     * @return non-null
-     */
-    public static List<Annotation> filterQualifiers(final Annotation[] annotations) {
-        return _NullSafe.stream(annotations)
-                .filter(_CDI::isQualifier)
-                .collect(Collectors.toList());
-    }
-
-    /**
-     * @param annotation
-     * @return whether or not the annotation is a valid qualifier for CDI
-     */
-    public static boolean isQualifier(Annotation annotation) {
-        if(annotation==null) {
-            return false;
-        }
-        return annotation.annotationType().getAnnotationsByType(Qualifier.class).length>0;
-    }
-
-    // -- GENERIC SINGLETON RESOLVING
-
-    /**
-     * @return CDI managed singleton wrapped in an Optional
-     */
-    public static <T> Optional<T> getSingleton(@Nullable Class<T> type) {
-        if(type==null) {
-            return Optional.empty();
-        }
-        return _CDI.select(type).getSingleton();
-    }
-
-    /**
-     * @return CDI managed singleton
-     * @throws NoSuchElementException - if the singleton is not resolvable
-     */
-    public static <T> T getSingletonElseFail(@Nullable Class<T> type) {
-        return getSingleton(type)
-                .orElseThrow(()->_Exceptions.noSuchElement("Cannot resolve singleton '%s'", type));
-
-    }
-
-    // -- ENUMERATE BEANS
-
-    public static final AnnotationLiteral<Any> QUALIFIER_ANY = 
-            new AnnotationLiteral<Any>() {
-        private static final long serialVersionUID = 1L;};
-
-        private static Stream<Bean<?>> streamAllCDIBeans() {
-            BeanManager beanManager = _CDI.getBeanManager();
-            Set<Bean<?>> beans = beanManager.getBeans(Object.class, _CDI.QUALIFIER_ANY);
-            return beans.stream();
-        }
-
-        /**
-         * 
-         * @param classifier
-         * @param beanNameProvider - usually ServiceUtil::idOfBean
-         */
-        public static Stream<ManagedBeanAdapter> streamAllBeans(
-                Function<Bean<?>, String> beanNameProvider) {
-
-            return streamAllCDIBeans()
-                    .map(bean->{
-
-                        //val scope = bean.getScope().getSimpleName(); // also works for produced beans
-                        val id = beanNameProvider.apply(bean);
-                        val beanAdapter = BeanAdapterCDI.of(id, bean);
-                        return beanAdapter;
-                    });
-
-        }
-
-        // -- HELPER
-
-        private _CDI() {}
-
-        /**
-         * Get the CDI instance that provides access to the current container. 
-         * @return an optional
-         */
-        private static Optional<CDI<Object>> cdi() {
-            try {
-                CDI<Object> cdi = CDI.current();
-                return Optional.ofNullable(cdi);
-            } catch (Exception e) {
-                return Optional.empty();
-            }
-        }
-
-        private static <T> T tryGet(final Supplier<T> supplier) {
-            try { 
-                return supplier.get();  
-            } catch (Exception e) {
-                return null;
-            }
-        }
-
-
-
-
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI_Lifecycle.java b/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI_Lifecycle.java
deleted file mode 100644
index 8f5c49a..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/ioc/cdi/_CDI_Lifecycle.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.isis.commons.internal.ioc.cdi;
-
-import org.apache.isis.commons.internal.functions._Functions.CheckedRunnable;
-
-import lombok.RequiredArgsConstructor;
-import lombok.val;
-import lombok.extern.log4j.Log4j2;
-
-@RequiredArgsConstructor(staticName="of") @Log4j2
-final class _CDI_Lifecycle implements AutoCloseable {
-
-    private final CheckedRunnable onClose;
-
-    @Override
-    public void close() {
-        try {
-            onClose.run();
-        } catch (Exception e) {
-            val note = "This implementation expects the IocPlugin to provide a CDIProvider "
-                    + "that creates CDI instances that implement AutoClosable";
-
-            log.warn("Failed to properly close the CDI container. Note: {}", note, e);
-        }
-    }
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextHandle.java b/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextHandle.java
deleted file mode 100644
index 8fbc9bd..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextHandle.java
+++ /dev/null
@@ -1,30 +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.isis.commons.internal.plugins.ioc;
-
-public interface ConversationContextHandle extends AutoCloseable {
-
-    void resume(String cid);
-
-    /**
-     * Refined to not throw a catched exception
-     */
-    @Override void close();
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextService.java b/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextService.java
deleted file mode 100644
index 78eea53..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextService.java
+++ /dev/null
@@ -1,32 +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.isis.commons.internal.plugins.ioc;
-
-public interface ConversationContextService {
-
-    ConversationContextHandle startTransientConversation();
-
-    static void closeHandle(ConversationContextHandle conversationContextHandle) {
-        if(conversationContextHandle!=null) {
-            conversationContextHandle.close();
-        }
-    }
-
-
-}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextServiceDefault.java b/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextServiceDefault.java
deleted file mode 100644
index a61ca95..0000000
--- a/commons/src/main/java/org/apache/isis/commons/internal/plugins/ioc/ConversationContextServiceDefault.java
+++ /dev/null
@@ -1,38 +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.isis.commons.internal.plugins.ioc;
-
-/**
- * Acts as a no-op implementation, that is used as lowest priority default, whenever
- * service-provisioning can not find any alternative with higher priority.  
- * <p>
- * Introduced for CDI, no longer used since Spring.
-
- * @since 2.0
- *
- */
-//@Singleton @Alternative @Priority(PriorityConstants.PRIORITY_BELOW_DEFAULT)
-public class ConversationContextServiceDefault implements ConversationContextService {
-
-    @Override
-    public ConversationContextHandle startTransientConversation() {
-        return null; // don't return a handle
-    }
-
-}
diff --git a/commons/src/test/java/org/apache/isis/commons/internal/cdi/CDITest.java b/commons/src/test/java/org/apache/isis/commons/internal/cdi/CDITest.java
deleted file mode 100644
index 7d97ba2..0000000
--- a/commons/src/test/java/org/apache/isis/commons/internal/cdi/CDITest.java
+++ /dev/null
@@ -1,128 +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.isis.commons.internal.cdi;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.util.List;
-
-import javax.annotation.CheckForNull;
-import javax.inject.Inject;
-
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.isis.commons.internal.ioc.cdi._CDI;
-
-class CDITest {
-
-    private Field stringField1;
-    private Field stringField2;
-    private Field stringField3;
-
-    @BeforeEach
-    void setUp() throws Exception {
-        stringField1 = Customer.class.getDeclaredField("stringField1");
-        stringField2 = Customer.class.getDeclaredField("stringField2");
-        stringField3 = Customer.class.getDeclaredField("stringField3");
-    }
-
-    @AfterEach
-    void tearDown() throws Exception {
-    }
-
-    // -- STAGED TEST CLASS
-
-    static class Customer {
-
-        @Inject  
-        String stringField1;
-
-        @Inject @CheckForNull //arbitrary non qualifier
-        String stringField2;
-
-        @Inject @ValidQualifierForTesting
-        String stringField3;
-    }
-
-    // ---
-
-    @Test
-    void qualifierDetection() {
-
-        //when
-        ValidQualifierForTesting[] annotations = stringField3.getAnnotationsByType(ValidQualifierForTesting.class);
-
-        //then
-        assertNotNull(annotations);
-        assertEquals(1, annotations.length);
-
-        //when 
-        ValidQualifierForTesting annotation = annotations[0];
-
-        //then
-        assertNotNull(annotation);
-        Assertions.assertTrue(_CDI.isQualifier(annotation));
-
-    }
-
-
-    @Test
-    void noQualifier() {
-
-        //when
-        List<Annotation> qualifiers = _CDI.filterQualifiers(stringField1.getAnnotations());
-
-        //then
-        assertNotNull(qualifiers);
-        assertEquals(0, qualifiers.size());
-
-    }
-
-    @Test
-    void noQualifier_arbitraryAnnotation() {
-
-        //when
-        List<Annotation> qualifiers = _CDI.filterQualifiers(stringField2.getAnnotations());
-
-        //then
-        assertNotNull(qualifiers);
-        assertEquals(0, qualifiers.size());
-
-    }
-
-    @Test
-    void singleQualifier() {
-
-        //when
-        List<Annotation> qualifiers = _CDI.filterQualifiers(stringField3.getAnnotations());
-
-        //then
-        assertNotNull(qualifiers);
-        assertEquals(1, qualifiers.size());
-
-    }
-
-}
diff --git a/commons/src/test/java/org/apache/isis/commons/internal/cdi/ValidQualifierForTesting.java b/commons/src/test/java/org/apache/isis/commons/internal/cdi/ValidQualifierForTesting.java
deleted file mode 100644
index 47316ef..0000000
--- a/commons/src/test/java/org/apache/isis/commons/internal/cdi/ValidQualifierForTesting.java
+++ /dev/null
@@ -1,35 +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.isis.commons.internal.cdi;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-@Target(FIELD)
-@interface ValidQualifierForTesting {
-
-
-}