You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ro...@apache.org on 2019/11/22 22:03:49 UTC
[aries-cdi] 03/19: use our own logic for discover to avoid double
CDI container startup
This is an automated email from the ASF dual-hosted git repository.
rotty3000 pushed a commit to branch rotty3000/cdi-spi
in repository https://gitbox.apache.org/repos/asf/aries-cdi.git
commit cfa879f35954d6b59df067bd096a82c0c374c6fe
Author: Raymond Augé <ro...@apache.org>
AuthorDate: Wed Nov 20 14:08:10 2019 -0500
use our own logic for discover to avoid double CDI container startup
Signed-off-by: Raymond Augé <ro...@apache.org>
---
.../internal/container/ContainerDiscovery.java | 56 ---
.../internal/container/ContainerState.java | 10 +-
.../container/internal/container/Discovery.java | 397 +++++++++++++++++
.../internal/container/DiscoveryExtension.java | 496 ---------------------
.../internal/container/RuntimeExtension.java | 28 +-
.../internal/model/BeansModelBuilder.java | 5 +-
.../internal/model/ComponentPropertiesModel.java | 8 +-
.../model/ExtendedActivationTemplateDTO.java | 4 +-
.../model/ExtendedComponentTemplateDTO.java | 8 +-
.../container/internal/model/FactoryActivator.java | 2 +-
.../cdi/container/internal/model/OSGiBean.java | 6 +-
.../container/internal/model/ReferenceModel.java | 39 +-
.../container/internal/model/SingleActivator.java | 2 +-
.../cdi/container/internal/util/Annotates.java | 81 ++++
.../cdi/container/internal/util/Reflection.java | 87 ++++
.../ReferenceModel_BeanServiceObjectsTest.java | 92 ++--
.../model/ReferenceModel_PropertiesTest.java | 48 +-
.../model/ReferenceModel_ServiceReferenceTest.java | 84 ++--
.../internal/model/ReferenceModel_ServiceTest.java | 88 ++--
.../internal/model/ReferenceModel_TupleTest.java | 68 +--
.../container/internal/phase/TemplatesTests.java | 4 +-
.../aries/cdi/test/cases/ConfigurationTests.java | 2 +
22 files changed, 803 insertions(+), 812 deletions(-)
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java
deleted file mode 100644
index ecaa8d1..0000000
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerDiscovery.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Licensed 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.aries.cdi.container.internal.container;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.enterprise.inject.spi.Extension;
-
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.bootstrap.spi.Deployment;
-import org.jboss.weld.bootstrap.spi.Metadata;
-
-public class ContainerDiscovery {
-
- public ContainerDiscovery(ContainerState containerState) {
- String id = containerState.id() + "-discovery";
-
- BeansModel beansModel = containerState.beansModel();
-
- BeanDeploymentArchive beanDeploymentArchive = new ContainerDeploymentArchive(
- containerState.loader(), id, beansModel.getBeanClassNames(),
- beansModel.getBeansXml());
-
- ExtensionMetadata extension = new ExtensionMetadata(
- new DiscoveryExtension(containerState), id);
-
- List<Metadata<Extension>> extensions = Collections.singletonList(extension);
-
- Deployment deployment = new ContainerDeployment(
- Collections.singletonList(extension), beanDeploymentArchive);
-
- WeldBootstrap _bootstrap = new WeldBootstrap();
-
- _bootstrap.startExtensions(extensions);
- _bootstrap.startContainer(id, new ContainerEnvironment(), deployment);
- _bootstrap.startInitialization();
- _bootstrap.deployBeans();
- _bootstrap.shutdown();
- }
-
-}
\ No newline at end of file
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java
index a6c072f..f04cb9e 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/ContainerState.java
@@ -14,11 +14,9 @@
package org.apache.aries.cdi.container.internal.container;
-import static org.apache.aries.cdi.container.internal.util.Filters.asFilter;
-import static org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE;
-import static org.osgi.service.cdi.CDIConstants.CDI_CAPABILITY_NAME;
-import static org.osgi.service.cdi.CDIConstants.CDI_CONTAINER_ID;
-import static org.osgi.service.cdi.CDIConstants.CDI_EXTENSION_PROPERTY;
+import static org.apache.aries.cdi.container.internal.util.Filters.*;
+import static org.osgi.namespace.extender.ExtenderNamespace.*;
+import static org.osgi.service.cdi.CDIConstants.*;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -200,7 +198,7 @@ public class ContainerState {
_bundleClassLoader = bundleWiring.getClassLoader();
try {
- new ContainerDiscovery(this);
+ new Discovery(this).discover();
}
catch (Exception e) {
_log.error(l -> l.error("CCR Discovery resulted in errors on {}", bundle, e));
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Discovery.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Discovery.java
new file mode 100644
index 0000000..bd1cb97
--- /dev/null
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/Discovery.java
@@ -0,0 +1,397 @@
+/**
+ * Licensed 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.aries.cdi.container.internal.container;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.ObservesAsync;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.aries.cdi.container.internal.annotated.AnnotatedTypeImpl;
+import org.apache.aries.cdi.container.internal.model.BeansModel;
+import org.apache.aries.cdi.container.internal.model.ComponentPropertiesModel;
+import org.apache.aries.cdi.container.internal.model.ExtendedActivationTemplateDTO;
+import org.apache.aries.cdi.container.internal.model.ExtendedComponentTemplateDTO;
+import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
+import org.apache.aries.cdi.container.internal.model.OSGiBean;
+import org.apache.aries.cdi.container.internal.model.ReferenceModel;
+import org.apache.aries.cdi.container.internal.model.ReferenceModel.Builder;
+import org.apache.aries.cdi.container.internal.util.Annotates;
+import org.apache.aries.cdi.container.internal.util.Reflection;
+import org.osgi.service.cdi.ComponentType;
+import org.osgi.service.cdi.ConfigurationPolicy;
+import org.osgi.service.cdi.MaximumCardinality;
+import org.osgi.service.cdi.ServiceScope;
+import org.osgi.service.cdi.annotations.ComponentProperties;
+import org.osgi.service.cdi.annotations.ComponentScoped;
+import org.osgi.service.cdi.annotations.FactoryComponent;
+import org.osgi.service.cdi.annotations.PID;
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.cdi.annotations.SingleComponent;
+import org.osgi.service.cdi.reference.BindBeanServiceObjects;
+import org.osgi.service.cdi.reference.BindService;
+import org.osgi.service.cdi.reference.BindServiceReference;
+import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
+
+public class Discovery {
+
+ private static final List<Type> BIND_TYPES = Arrays.asList(BindService.class, BindBeanServiceObjects.class, BindServiceReference.class);
+
+ public Discovery(ContainerState containerState) {
+ _containerState = containerState;
+ _beansModel = _containerState.beansModel();
+ _containerTemplate = _containerState.containerDTO().template.components.get(0);
+ }
+
+ public void discover() {
+ _beansModel.getOSGiBeans().stream().forEach(osgiBean -> {
+ osgiBean.found(true);
+
+ AnnotatedType<?> annotatedType = new AnnotatedTypeImpl<>(osgiBean.getBeanClass());
+
+ try {
+ String beanName = Annotates.beanName(annotatedType);
+ Class<? extends Annotation> beanScope = Annotates.beanScope(annotatedType);
+ Map<String, Object> componentProperties = Annotates.componentProperties(annotatedType);
+ ServiceScope serviceScope = Annotates.serviceScope(annotatedType);
+ List<String> serviceTypes = Annotates.serviceClassNames(annotatedType);
+
+ if (annotatedType.isAnnotationPresent(SingleComponent.class)) {
+ doFactoryOrSingleComponent(osgiBean, osgiBean.getBeanClass(), annotatedType, beanName, serviceTypes, serviceScope, componentProperties, ComponentType.SINGLE);
+ }
+ else if (annotatedType.isAnnotationPresent(FactoryComponent.class)) {
+ doFactoryOrSingleComponent(osgiBean, osgiBean.getBeanClass(), annotatedType, beanName, serviceTypes, serviceScope, componentProperties, ComponentType.FACTORY);
+ }
+ else if (annotatedType.isAnnotationPresent(ComponentScoped.class)) {
+ _componentScoped.add(osgiBean);
+ }
+ else {
+ discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedType, null, beanScope, serviceTypes, serviceScope, componentProperties);
+ }
+ }
+ catch (Exception e) {
+ _containerState.error(e);
+
+ return;
+ }
+
+ annotatedType.getConstructors().stream().filter(this::isInject).flatMap(annotatedConstructor -> annotatedConstructor.getParameters().stream()).forEach(
+ annotatedParameter ->
+ processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
+ );
+
+ annotatedType.getFields().stream().filter(this::isInject).forEach(
+ annotatedField ->
+ processAnnotated(annotatedField, annotatedField.getBaseType(), Annotates.qualifiers(annotatedField), osgiBean)
+ );
+
+ annotatedType.getFields().stream().filter(this::isProduces).forEach(
+ annotatedField -> {
+ Class<? extends Annotation> beanScope = Annotates.beanScope(annotatedField);
+ Map<String, Object> componentProperties = Annotates.componentProperties(annotatedField);
+ ServiceScope serviceScope = Annotates.serviceScope(annotatedField);
+ List<String> serviceTypes = Annotates.serviceClassNames(annotatedField);
+
+ discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedField, annotatedField, beanScope, serviceTypes, serviceScope, componentProperties);
+ }
+ );
+
+ annotatedType.getMethods().stream().forEach(annotatedMethod -> {
+ if (isInjectOrProduces(annotatedMethod)) {
+ annotatedMethod.getParameters().stream().forEach(
+ annotatedParameter -> processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
+ );
+
+ if (isProduces(annotatedMethod)) {
+ Class<? extends Annotation> beanScope = Annotates.beanScope(annotatedMethod);
+ Map<String, Object> componentProperties = Annotates.componentProperties(annotatedMethod);
+ ServiceScope serviceScope = Annotates.serviceScope(annotatedMethod);
+ List<String> serviceTypes = Annotates.serviceClassNames(annotatedMethod);
+
+ discoverActivations(osgiBean, osgiBean.getBeanClass(), annotatedMethod, annotatedMethod, beanScope, serviceTypes, serviceScope, componentProperties);
+ }
+ }
+ else if (isDisposeOrObserves(annotatedMethod)) {
+ annotatedMethod.getParameters().subList(1, annotatedMethod.getParameters().size()).stream().forEach(
+ annotatedParameter -> processAnnotated(annotatedParameter, annotatedParameter.getBaseType(), Annotates.qualifiers(annotatedParameter), osgiBean)
+ );
+ }
+ });
+ });
+
+ postProcessComponentScopedBeans();
+ }
+
+ <X> boolean isInject(AnnotatedMember<X> annotatedMember) {
+ return (annotatedMember.isAnnotationPresent(Inject.class) && !annotatedMember.isStatic());
+ }
+
+ <X> boolean isInjectOrProduces(AnnotatedMember<X> annotatedMember) {
+ return (annotatedMember.isAnnotationPresent(Inject.class) && !annotatedMember.isStatic()) ||
+ annotatedMember.isAnnotationPresent(Produces.class);
+ }
+
+ <X> boolean isProduces(AnnotatedMember<X> annotatedMember) {
+ return annotatedMember.isAnnotationPresent(Produces.class);
+ }
+
+ <X> boolean isDisposeOrObserves(AnnotatedMethod<X> annotatedMethod) {
+ return !annotatedMethod.getParameters().isEmpty() && (annotatedMethod.getParameters().get(0).isAnnotationPresent(Disposes.class) ||
+ annotatedMethod.getParameters().get(0).isAnnotationPresent(Observes.class) ||
+ annotatedMethod.getParameters().get(0).isAnnotationPresent(ObservesAsync.class));
+ }
+
+ <X> void processAnnotated(Annotated annotated, Type injectionPointType, Set<Annotation> qualifiers, OSGiBean osgiBean) {
+ if (BIND_TYPES.contains(Reflection.getRawType(annotated.getBaseType()))) {
+ Builder builder = new ReferenceModel.Builder(annotated);
+
+ try {
+ ReferenceModel referenceModel = builder.type(injectionPointType).build();
+
+ osgiBean.addReference(referenceModel.toDTO());
+ }
+ catch (Exception e) {
+ _containerState.error(e);
+ }
+ }
+ else {
+ Reference reference = annotated.getAnnotation(Reference.class);
+ ComponentProperties componentProperties = annotated.getAnnotation(ComponentProperties.class);
+
+ if (reference != null) {
+ doReference(osgiBean, annotated, injectionPointType, reference, componentProperties);
+ }
+ else if (componentProperties != null) {
+ doComponentProperties(osgiBean, injectionPointType, qualifiers);
+ }
+ }
+ }
+
+ void postProcessComponentScopedBeans() {
+ _containerState.containerDTO().template.components.stream().filter(
+ template -> template.type != ComponentType.CONTAINER
+ ).map(
+ template -> (ExtendedComponentTemplateDTO)template
+ ).forEach(
+ template -> {
+
+ _componentScoped.forEach(
+ osgiBean -> {
+ if (osgiBean.getComponent() == null) {
+ osgiBean.setComponent(_containerState, template);
+ }
+
+ String className = osgiBean.getBeanClass().getName();
+ if (!template.beans.contains(className)) {
+ template.beans.add(className);
+ }
+ }
+ );
+ }
+ );
+ }
+
+ void doComponentProperties(OSGiBean osgiBean, Type injectionPointType, Set<Annotation> qualifiers) {
+ try {
+ ComponentPropertiesModel configurationModel = new ComponentPropertiesModel.Builder(
+ injectionPointType
+ ).declaringClass(
+ osgiBean.getBeanClass()
+ ).qualifiers(
+ qualifiers
+ ).build();
+
+ osgiBean.addConfiguration(_containerState, configurationModel.toDTO());
+ }
+ catch (Exception e) {
+ _containerState.error(e);
+ }
+ }
+
+ void discoverActivations(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, AnnotatedMember<?> producer, Class<? extends Annotation> scope, List<String> serviceTypeNames, ServiceScope serviceScope, Map<String, Object> componentProperties) {
+ String className = declaringClass.getName();
+
+ if (!_containerTemplate.beans.contains(className)) {
+ _containerTemplate.beans.add(className);
+ }
+
+ if (!serviceTypeNames.isEmpty()) {
+ if (!scope.equals(ApplicationScoped.class) &&
+ !scope.equals(Dependent.class)) {
+
+ _containerState.error(
+ new IllegalStateException(
+ String.format(
+ "@Service can only be used on @ApplicationScoped, @Dependent, @SingleComponent, and @FactoryComponent: %s",
+ osgiBean.getBeanClass())));
+
+ return;
+ }
+
+ ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
+ activationTemplate.cdiScope = scope;
+ activationTemplate.declaringClass = declaringClass;
+ activationTemplate.producer = producer;
+ activationTemplate.properties = componentProperties;
+ activationTemplate.scope = serviceScope;
+ activationTemplate.serviceClasses = serviceTypeNames;
+
+ _containerTemplate.activations.add(activationTemplate);
+ }
+
+ osgiBean.setComponent(_containerState, _containerTemplate);
+ }
+
+ void doFactoryOrSingleComponent(
+ OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, String beanName,
+ List<String> serviceTypes, ServiceScope serviceScope,
+ Map<String, Object> componentProperties, ComponentType componentType) {
+
+ Set<Annotation> qualifiers = Annotates.qualifiers(annotated);
+ qualifiers.removeIf(Named.class::isInstance);
+
+ ExtendedComponentTemplateDTO componentTemplate = new ExtendedComponentTemplateDTO();
+ componentTemplate.activations = new CopyOnWriteArrayList<>();
+
+ ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
+ activationTemplate.declaringClass = declaringClass;
+ activationTemplate.properties = Collections.emptyMap();
+ activationTemplate.scope = serviceScope;
+ activationTemplate.serviceClasses = serviceTypes;
+
+ componentTemplate.activations.add(activationTemplate);
+
+ componentTemplate.beanClass = declaringClass;
+ componentTemplate.qualifiers = qualifiers;
+ componentTemplate.beans = new CopyOnWriteArrayList<>();
+ componentTemplate.configurations = new CopyOnWriteArrayList<>();
+ componentTemplate.name = beanName;
+ componentTemplate.properties = componentProperties;
+ componentTemplate.references = new CopyOnWriteArrayList<>();
+ componentTemplate.type = componentType;
+
+ annotated.getAnnotations(PID.class).stream().forEach(
+ PID -> {
+ String pid = PID.value();
+
+ ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
+
+ configurationTemplate.declaringClass = declaringClass;
+ configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
+ configurationTemplate.pid = Optional.of(pid).map(
+ s -> (s.equals("$") || s.equals("")) ? componentTemplate.name : s
+ ).orElse(componentTemplate.name);
+
+ if (componentType == ComponentType.SINGLE) {
+ configurationTemplate.pid = (pid.equals("$") || pid.equals("")) ? componentTemplate.name : pid;
+ }
+
+ configurationTemplate.policy = PID.policy();
+
+ componentTemplate.configurations.add(configurationTemplate);
+ }
+ );
+
+ if (componentType == ComponentType.SINGLE) {
+ if (componentTemplate.configurations.isEmpty()) {
+ ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
+
+ configurationTemplate.declaringClass = declaringClass;
+ configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
+ configurationTemplate.pid = componentTemplate.name;
+ configurationTemplate.policy = ConfigurationPolicy.OPTIONAL;
+
+ componentTemplate.configurations.add(configurationTemplate);
+ }
+ }
+ else {
+ ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
+
+ configurationTemplate.declaringClass = declaringClass;
+ configurationTemplate.maximumCardinality = MaximumCardinality.MANY;
+ configurationTemplate.pid = Optional.ofNullable(
+ annotated.getAnnotation(FactoryComponent.class)
+ ).map(FactoryComponent::value).map(
+ v -> (v.equals("$") || v.equals("")) ? componentTemplate.name : v
+ ).orElse(componentTemplate.name);
+ configurationTemplate.policy = ConfigurationPolicy.REQUIRED;
+
+ componentTemplate.configurations.add(configurationTemplate);
+ }
+
+ componentTemplate.beans.add(declaringClass.getName());
+
+ _containerState.containerDTO().template.components.add(componentTemplate);
+
+ osgiBean.setComponent(_containerState, componentTemplate);
+ }
+
+ void doReference(OSGiBean osgiBean, Annotated annotated, Type injectionPointType, Reference reference, ComponentProperties componentProperties) {
+ if (componentProperties != null) {
+ _containerState.error(
+ new IllegalArgumentException(
+ String.format(
+ "Cannot use @Reference and @Configuration on the same injection point {}",
+ injectionPointType))
+ );
+
+ return;
+ }
+
+ Builder builder = null;
+
+ if (annotated instanceof AnnotatedParameter) {
+ builder = new ReferenceModel.Builder(annotated);
+ }
+ else {
+ builder = new ReferenceModel.Builder(annotated);
+ }
+
+ try {
+ ReferenceModel referenceModel = builder.type(injectionPointType).build();
+
+ osgiBean.addReference(referenceModel.toDTO());
+ }
+ catch (Exception e) {
+ _containerState.error(e);
+ }
+ }
+
+ private final BeansModel _beansModel;
+ private final Set<OSGiBean> _componentScoped = new HashSet<>();
+ private final ComponentTemplateDTO _containerTemplate;
+ private final ContainerState _containerState;
+
+}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java
deleted file mode 100644
index a4fa150..0000000
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/DiscoveryExtension.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/**
- * Licensed 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.aries.cdi.container.internal.container;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.DefinitionException;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionPoint;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.apache.aries.cdi.container.internal.model.ComponentPropertiesModel;
-import org.apache.aries.cdi.container.internal.model.ExtendedActivationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedComponentTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.ExtendedConfigurationTemplateDTO;
-import org.apache.aries.cdi.container.internal.model.OSGiBean;
-import org.apache.aries.cdi.container.internal.model.ReferenceModel;
-import org.apache.aries.cdi.container.internal.model.ReferenceModel.Builder;
-import org.apache.aries.cdi.container.internal.util.Annotates;
-import org.osgi.service.cdi.ComponentType;
-import org.osgi.service.cdi.ConfigurationPolicy;
-import org.osgi.service.cdi.MaximumCardinality;
-import org.osgi.service.cdi.ServiceScope;
-import org.osgi.service.cdi.annotations.ComponentProperties;
-import org.osgi.service.cdi.annotations.ComponentScoped;
-import org.osgi.service.cdi.annotations.FactoryComponent;
-import org.osgi.service.cdi.annotations.PID;
-import org.osgi.service.cdi.annotations.Reference;
-import org.osgi.service.cdi.annotations.SingleComponent;
-import org.osgi.service.cdi.reference.BindBeanServiceObjects;
-import org.osgi.service.cdi.reference.BindService;
-import org.osgi.service.cdi.reference.BindServiceReference;
-import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
-
-public class DiscoveryExtension implements Extension {
-
- public DiscoveryExtension(ContainerState containerState) {
- _containerState = containerState;
- _beansModel = _containerState.beansModel();
- _containerTemplate = _containerState.containerDTO().template.components.get(0);
- }
-
- <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> pat) {
- Class<X> declaringClass = Annotates.declaringClass(pat.getAnnotatedType());
-
- final String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- osgiBean.found(true);
- }
-
- <X> void processBindObject(@Observes ProcessInjectionPoint<X, BindService<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X> void processBindServiceObjects(@Observes ProcessInjectionPoint<X, BindBeanServiceObjects<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X> void processBindServiceReference(@Observes ProcessInjectionPoint<X, BindServiceReference<?>> pip) {
- processInjectionPoint0(pip, true);
- }
-
- <X, T> void processInjectionPoint(@Observes ProcessInjectionPoint<X, T> pip) {
- processInjectionPoint0(pip, false);
- }
-
- <X, T> void processInjectionPoint0(ProcessInjectionPoint<X, T> pip, boolean special) {
- InjectionPoint injectionPoint = pip.getInjectionPoint();
-
- Annotated annotated = injectionPoint.getAnnotated();
-
- Class<X> declaringClass = Annotates.declaringClass(annotated);
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- if (special) {
- doSpecial(osgiBean, annotated, injectionPoint.getType());
- }
- else {
- doOther(osgiBean, declaringClass, annotated, injectionPoint);
- }
- }
-
- <X> void processBean(@Observes ProcessBean<X> pb) {
- final Class<X> declaringClass = Annotates.declaringClass(pb);
-
- String className = declaringClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- if (osgiBean == null) {
- return;
- }
-
- osgiBean.found(true);
-
- final Annotated annotated = pb.getAnnotated();
-
- try {
- List<String> serviceTypes = Annotates.serviceClassNames(annotated);
- Map<String, Object> componentProperties = Annotates.componentProperties(annotated);
- ServiceScope serviceScope = Annotates.serviceScope(annotated);
-
- if (annotated.isAnnotationPresent(SingleComponent.class)) {
- doSingleComponent(osgiBean, declaringClass, annotated, pb.getBean(), serviceTypes, serviceScope, componentProperties);
- }
- else if (annotated.isAnnotationPresent(FactoryComponent.class)) {
- doFactoryComponent(osgiBean, declaringClass, annotated, pb.getBean(), serviceTypes, serviceScope, componentProperties);
- }
- else if (annotated.isAnnotationPresent(ComponentScoped.class)) {
- // Explicitly ignore this case
- }
- else {
- doContainerBean(osgiBean, declaringClass, annotated, pb, pb.getBean().getScope(), serviceTypes, serviceScope, componentProperties);
- }
- }
- catch (Exception e) {
- pb.addDefinitionError(e);
- }
- }
-
- void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager beanManager) {
- _containerState.containerDTO().template.components.stream().filter(
- template -> template.type != ComponentType.CONTAINER
- ).map(
- template -> (ExtendedComponentTemplateDTO)template
- ).forEach(
- template -> {
- Set<Bean<?>> visited = new HashSet<>();
- scanComponentBean(template, template.bean, beanManager, visited);
- }
- );
-
- _beansModel.getOSGiBeans().stream().forEach(
- osgiBean -> {
- if (!osgiBean.found()) {
- abd.addDefinitionError(
- new DefinitionException(
- String.format(
- "Did not find bean for %s",
- osgiBean.getBeanClass())));
- }
- }
- );
- }
-
- void doComponentProperties(OSGiBean osgiBean, Class<?> declaringClass, InjectionPoint injectionPoint) {
- try {
- ComponentPropertiesModel configurationModel = new ComponentPropertiesModel.Builder(
- injectionPoint.getType()
- ).declaringClass(
- declaringClass
- ).injectionPoint(
- injectionPoint
- ).build();
-
- osgiBean.addConfiguration(_containerState, configurationModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void doContainerBean(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, ProcessBean<?> pb, Class<? extends Annotation> scope, List<String> serviceTypeNames, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- String className = declaringClass.getName();
-
- if (!_containerTemplate.beans.contains(className)) {
- _containerTemplate.beans.add(className);
- }
-
- if (!serviceTypeNames.isEmpty()) {
- if (!scope.equals(ApplicationScoped.class) &&
- !scope.equals(Dependent.class)) {
-
- pb.addDefinitionError(
- new IllegalStateException(
- String.format(
- "@Service can only be used on @ApplicationScoped, @Dependent, @SingleComponent, and @FactoryComponent: %s",
- pb.getBean())));
- return;
- }
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.cdiScope = scope;
- activationTemplate.declaringClass = declaringClass;
- if (pb instanceof ProcessProducerField) {
- activationTemplate.producer = ((ProcessProducerField<?, ?>) pb).getAnnotatedProducerField();
- }
- else if (pb instanceof ProcessProducerMethod) {
- activationTemplate.producer = ((ProcessProducerMethod<?, ?>) pb).getAnnotatedProducerMethod();
- }
- activationTemplate.properties = componentProperties;
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypeNames;
-
- _containerTemplate.activations.add(activationTemplate);
- }
-
- osgiBean.setComponent(_containerState, _containerTemplate);
- }
-
- void doFactoryComponent(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, Bean<?> bean, List<String> serviceTypeNames, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- ExtendedComponentTemplateDTO componentTemplate = new ExtendedComponentTemplateDTO();
- componentTemplate.activations = new CopyOnWriteArrayList<>();
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.declaringClass = declaringClass;
- activationTemplate.properties = Collections.emptyMap();
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypeNames;
-
- componentTemplate.activations.add(activationTemplate);
-
- componentTemplate.bean = bean;
- componentTemplate.beans = new CopyOnWriteArrayList<>();
- componentTemplate.configurations = new CopyOnWriteArrayList<>();
- componentTemplate.name = bean.getName();
- componentTemplate.properties = componentProperties;
- componentTemplate.references = new CopyOnWriteArrayList<>();
- componentTemplate.type = ComponentType.FACTORY;
-
- annotated.getAnnotations(PID.class).stream().forEach(
- PID -> {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = Optional.of(PID.value()).map(
- s -> {
- if (s.equals("$") || s.equals("")) {
- return componentTemplate.name;
- }
- return s;
- }
- ).orElse(componentTemplate.name);
-
- configurationTemplate.policy = PID.policy();
-
- componentTemplate.configurations.add(configurationTemplate);
- }
- );
-
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.MANY;
- configurationTemplate.pid = Optional.ofNullable(
- annotated.getAnnotation(FactoryComponent.class)
- ).map(fc -> {
- if (fc.value().equals("$") || fc.value().equals("")) {
- return componentTemplate.name;
- }
- return fc.value();
- }).orElse(componentTemplate.name);
- configurationTemplate.policy = ConfigurationPolicy.REQUIRED;
-
- componentTemplate.configurations.add(configurationTemplate);
- componentTemplate.beans.add(declaringClass.getName());
-
- _containerState.containerDTO().template.components.add(componentTemplate);
-
- osgiBean.setComponent(_containerState, componentTemplate);
- }
-
- void doOther(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, InjectionPoint injectionPoint) {
- Reference reference = annotated.getAnnotation(Reference.class);
- ComponentProperties componentProperties = annotated.getAnnotation(ComponentProperties.class);
-
- if (reference != null) {
- doReference(osgiBean, annotated, injectionPoint, reference, componentProperties);
- }
- else if (componentProperties != null) {
- doComponentProperties(osgiBean, declaringClass, injectionPoint);
- }
- }
-
- void doReference(OSGiBean osgiBean, Annotated annotated, InjectionPoint injectionPoint, Reference reference, ComponentProperties componentProperties) {
- if (componentProperties != null) {
- _containerState.error(
- new IllegalArgumentException(
- String.format(
- "Cannot use @Reference and @Configuration on the same injection point {}",
- injectionPoint))
- );
-
- return;
- }
-
- Builder builder = null;
-
- if (annotated instanceof AnnotatedParameter) {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
-
- try {
- ReferenceModel referenceModel = builder.type(injectionPoint.getType()).build();
-
- osgiBean.addReference(referenceModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void doSingleComponent(OSGiBean osgiBean, Class<?> declaringClass, Annotated annotated, Bean<?> bean, List<String> serviceTypes, ServiceScope serviceScope, Map<String, Object> componentProperties) {
- ExtendedComponentTemplateDTO componentTemplate = new ExtendedComponentTemplateDTO();
- componentTemplate.activations = new CopyOnWriteArrayList<>();
-
- ExtendedActivationTemplateDTO activationTemplate = new ExtendedActivationTemplateDTO();
- activationTemplate.declaringClass = declaringClass;
- activationTemplate.properties = Collections.emptyMap();
- activationTemplate.scope = serviceScope;
- activationTemplate.serviceClasses = serviceTypes;
-
- componentTemplate.activations.add(activationTemplate);
-
- componentTemplate.bean = bean;
- componentTemplate.beans = new CopyOnWriteArrayList<>();
- componentTemplate.configurations = new CopyOnWriteArrayList<>();
- componentTemplate.name = bean.getName();
- componentTemplate.properties = componentProperties;
- componentTemplate.references = new CopyOnWriteArrayList<>();
- componentTemplate.type = ComponentType.SINGLE;
-
- annotated.getAnnotations(PID.class).stream().forEach(
- PID -> {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = Optional.of(PID.value()).map(
- s -> {
- if (s.equals("$") || s.equals("")) {
- return componentTemplate.name;
- }
- return s;
- }
- ).orElse(componentTemplate.name);
-
- if (PID.value().equals("$") || PID.value().equals("")) {
- configurationTemplate.pid = componentTemplate.name;
- }
- else {
- configurationTemplate.pid = PID.value();
- }
-
- configurationTemplate.policy = PID.policy();
-
- componentTemplate.configurations.add(configurationTemplate);
- }
- );
-
- if (componentTemplate.configurations.isEmpty()) {
- ExtendedConfigurationTemplateDTO configurationTemplate = new ExtendedConfigurationTemplateDTO();
-
- configurationTemplate.declaringClass = declaringClass;
- configurationTemplate.maximumCardinality = MaximumCardinality.ONE;
- configurationTemplate.pid = componentTemplate.name;
- configurationTemplate.policy = ConfigurationPolicy.OPTIONAL;
-
- componentTemplate.configurations.add(configurationTemplate);
- }
-
- componentTemplate.beans.add(declaringClass.getName());
-
- _containerState.containerDTO().template.components.add(componentTemplate);
-
- osgiBean.setComponent(_containerState, componentTemplate);
- }
-
- void doSpecial(OSGiBean osgiBean, Annotated annotated, Type injectionPointType) {
- Builder builder = null;
-
- if (annotated instanceof AnnotatedParameter) {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
-
- try {
- ReferenceModel referenceModel = builder.type(injectionPointType).build();
-
- osgiBean.addReference(referenceModel.toDTO());
- }
- catch (Exception e) {
- _containerState.error(e);
- }
- }
-
- void scanComponentBean(
- ExtendedComponentTemplateDTO template,
- Bean<?> bean,
- BeanManager beanManager,
- Set<Bean<?>> visited) {
-
- if (visited.contains(bean)) {
- return;
- }
-
- visited.add(bean);
-
- Class<?> beanClass = bean.getBeanClass();
-
- String className = beanClass.getName();
-
- OSGiBean osgiBean = _beansModel.getOSGiBean(className);
-
- ComponentTemplateDTO currentTemplate = osgiBean.getComponent();
-
- if (currentTemplate == null) {
- osgiBean.setComponent(_containerState, template);
- }
- else if (!currentTemplate.equals(template)) {
- throw new IllegalStateException("Something is wrong here");
- }
-
- if (!template.beans.contains(className)) {
- template.beans.add(className);
- }
-
- for (InjectionPoint injectionPoint : bean.getInjectionPoints()) {
- if (injectionPoint.getAnnotated().isAnnotationPresent(ComponentProperties.class) ||
- injectionPoint.getAnnotated().isAnnotationPresent(Reference.class)) {
-
- continue;
- }
-
- Set<Bean<?>> beans = beanManager.getBeans(
- injectionPoint.getType(),
- injectionPoint.getQualifiers().toArray(new Annotation[0]));
-
- Bean<?> next = beanManager.resolve(beans);
-
- if ((next == null) || next.getScope() != ComponentScoped.class) {
- continue;
- }
-
- scanComponentBean(template, next, beanManager, visited);
- }
- }
-
- private final BeansModel _beansModel;
- private final ComponentTemplateDTO _containerTemplate;
- private final ContainerState _containerState;
-
-}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
index 51e795e..697b6f6 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/container/RuntimeExtension.java
@@ -14,7 +14,7 @@
package org.apache.aries.cdi.container.internal.container;
-import static javax.interceptor.Interceptor.Priority.PLATFORM_AFTER;
+import static javax.interceptor.Interceptor.Priority.*;
import java.util.ArrayList;
import java.util.Dictionary;
@@ -37,7 +37,6 @@ import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMember;
import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
@@ -182,7 +181,12 @@ public class RuntimeExtension implements Extension {
for (ActivationTemplateDTO at : _containerTemplate.activations) {
ExtendedActivationTemplateDTO extended = (ExtendedActivationTemplateDTO)at;
- if (extended.declaringClass.equals(declaringClass) && Objects.equals(extended.producer, producer)) {
+ if (extended.declaringClass.equals(declaringClass) &&
+ (((extended.producer == null) && (producer == null)) ||
+ (extended.producer != null) &&
+ (producer != null) &&
+ Objects.equals(extended.producer.getJavaMember(), producer.getJavaMember()))) {
+
activationTemplate = extended;
break;
}
@@ -371,8 +375,8 @@ public class RuntimeExtension implements Extension {
ConfigurationTemplateDTO current = new ComponentPropertiesModel.Builder(injectionPoint.getType()).declaringClass(
declaringClass
- ).injectionPoint(
- injectionPoint
+ ).qualifiers(
+ injectionPoint.getQualifiers()
).build().toDTO();
return osgiBean.getComponent().configurations.stream().map(
@@ -398,19 +402,9 @@ public class RuntimeExtension implements Extension {
Annotated annotated = injectionPoint.getAnnotated();
- ReferenceModel.Builder builder = null;
-
- if (annotated instanceof AnnotatedField) {
- builder = new ReferenceModel.Builder((AnnotatedField<?>)annotated);
- }
- else if (annotated instanceof AnnotatedMethod) {
- builder = new ReferenceModel.Builder((AnnotatedMethod<?>)annotated);
- }
- else {
- builder = new ReferenceModel.Builder((AnnotatedParameter<?>)annotated);
- }
+ ReferenceModel.Builder builder = new ReferenceModel.Builder(annotated);
- ReferenceModel referenceModel = builder.injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = builder.type(injectionPoint.getType()).build();
ExtendedReferenceTemplateDTO current = referenceModel.toDTO();
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java
index 0ec959b..9e8b9c8 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/BeansModelBuilder.java
@@ -14,9 +14,8 @@
package org.apache.aries.cdi.container.internal.model;
-import static org.apache.aries.cdi.container.internal.util.Reflection.cast;
-import static org.osgi.service.cdi.CDIConstants.REQUIREMENT_BEANS_ATTRIBUTE;
-import static org.osgi.service.cdi.CDIConstants.REQUIREMENT_DESCRIPTOR_ATTRIBUTE;
+import static org.apache.aries.cdi.container.internal.util.Reflection.*;
+import static org.osgi.service.cdi.CDIConstants.*;
import java.net.URL;
import java.util.ArrayList;
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java
index 8530ca3..59c691d 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ComponentPropertiesModel.java
@@ -23,8 +23,6 @@ import java.util.LinkedHashSet;
import java.util.Objects;
import java.util.Set;
-import javax.enterprise.inject.spi.InjectionPoint;
-
import org.osgi.service.cdi.ConfigurationPolicy;
import org.osgi.service.cdi.MaximumCardinality;
import org.osgi.service.cdi.annotations.PID;
@@ -49,9 +47,9 @@ public class ComponentPropertiesModel {
return this;
}
- public Builder injectionPoint(InjectionPoint injectionPoint) {
- _qualifiers = injectionPoint.getQualifiers();
- _pid = injectionPoint.getAnnotated().getAnnotation(PID.class);
+ public Builder qualifiers(Set<Annotation> qualifiers) {
+ _qualifiers = qualifiers;
+ _pid = _qualifiers.stream().filter(PID.class::isInstance).map(PID.class::cast).findFirst().orElse(null);
return this;
}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java
index 89cc5d8..887aa12 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedActivationTemplateDTO.java
@@ -16,6 +16,8 @@ package org.apache.aries.cdi.container.internal.model;
import java.lang.annotation.Annotation;
+import javax.enterprise.inject.spi.AnnotatedMember;
+
import org.osgi.service.cdi.runtime.dto.template.ActivationTemplateDTO;
public class ExtendedActivationTemplateDTO extends ActivationTemplateDTO {
@@ -27,6 +29,6 @@ public class ExtendedActivationTemplateDTO extends ActivationTemplateDTO {
public Class<? extends Annotation> cdiScope;
- public Object producer;
+ public AnnotatedMember<?> producer;
}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java
index d150668..506c2e2 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ExtendedComponentTemplateDTO.java
@@ -14,11 +14,15 @@
package org.apache.aries.cdi.container.internal.model;
-import javax.enterprise.inject.spi.Bean;
+import java.lang.annotation.Annotation;
+import java.util.Set;
import org.osgi.service.cdi.runtime.dto.template.ComponentTemplateDTO;
public class ExtendedComponentTemplateDTO extends ComponentTemplateDTO {
- public Bean<?> bean;
+ public Class<?> beanClass;
+
+ public Set<Annotation> qualifiers;
+
}
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java
index 5853603..d358161 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/FactoryActivator.java
@@ -130,7 +130,7 @@ public class FactoryActivator extends InstanceActivator {
ExtendedComponentTemplateDTO extended = (ExtendedComponentTemplateDTO)_instance.template;
Set<Bean<?>> beans = beanManager.getBeans(
- extended.bean.getBeanClass(), extended.bean.getQualifiers().toArray(new Annotation[0]));
+ extended.beanClass, extended.qualifiers.toArray(new Annotation[0]));
Bean<? extends Object> bean = beanManager.resolve(beans);
if (activationTemplate.serviceClasses.isEmpty() /* immediate */) {
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java
index cfdd2ff..09c22c5 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/OSGiBean.java
@@ -14,8 +14,9 @@
package org.apache.aries.cdi.container.internal.model;
+import static java.util.Objects.*;
+
import java.util.List;
-import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -33,9 +34,8 @@ public class OSGiBean implements Comparable<OSGiBean> {
public static class Builder {
public Builder(Logs logs, Class<?> beanClass) {
- Objects.requireNonNull(beanClass);
_logs = logs;
- _beanClass = beanClass;
+ _beanClass = requireNonNull(beanClass);
}
public OSGiBean build() {
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceModel.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceModel.java
index b8f8ca8..df21438 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceModel.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/ReferenceModel.java
@@ -36,7 +36,6 @@ import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Qualifier;
@@ -62,46 +61,28 @@ public class ReferenceModel {
public static class Builder {
- public Builder() {}
-
- public Builder(AnnotatedField<?> annotated) {
- _annotated = annotated;
- _declaringClass = annotated.getDeclaringType().getJavaClass();
- }
-
- public Builder(AnnotatedMethod<?> annotated) {
- _annotated = annotated;
- _declaringClass = annotated.getDeclaringType().getJavaClass();
- }
-
- public Builder(AnnotatedParameter<?> annotated) {
+ public Builder(Annotated annotated) {
_annotated = annotated;
- _declaringClass = annotated.getDeclaringCallable().getDeclaringType().getJavaClass();
- }
-
- public ReferenceModel build() {
- Objects.requireNonNull(_annotated);
- Objects.requireNonNull(_declaringClass);
- Objects.requireNonNull(_type);
- return new ReferenceModel(_type, _declaringClass, _annotated);
- }
-
- public Builder injectionPoint(InjectionPoint injectionPoint) {
- _annotated = injectionPoint.getAnnotated();
- _type = injectionPoint.getType();
if (_annotated instanceof AnnotatedParameter) {
AnnotatedParameter<?> parameter = (AnnotatedParameter<?>)_annotated;
_declaringClass = parameter.getDeclaringCallable().getDeclaringType().getJavaClass();
}
- else if (_annotated instanceof AnnotatedField) {
+ else if ((_annotated instanceof AnnotatedField) ||
+ (_annotated instanceof AnnotatedMethod)) {
+
AnnotatedField<?> field = (AnnotatedField<?>)_annotated;
_declaringClass = field.getDeclaringType().getJavaClass();
}
+ }
- return this;
+ public ReferenceModel build() {
+ Objects.requireNonNull(_annotated);
+ Objects.requireNonNull(_declaringClass);
+ Objects.requireNonNull(_type);
+ return new ReferenceModel(_type, _declaringClass, _annotated);
}
public Builder type(Type type) {
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/SingleActivator.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/SingleActivator.java
index 0acd76b..a59d5a3 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/SingleActivator.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/model/SingleActivator.java
@@ -131,7 +131,7 @@ public class SingleActivator extends InstanceActivator {
ExtendedComponentTemplateDTO extended = (ExtendedComponentTemplateDTO)_instance.template;
Set<Bean<?>> beans = beanManager.getBeans(
- extended.bean.getBeanClass(), extended.bean.getQualifiers().toArray(new Annotation[0]));
+ extended.beanClass, extended.qualifiers.toArray(new Annotation[0]));
Bean<? extends Object> bean = beanManager.resolve(beans);
if (activationTemplate.serviceClasses.isEmpty() /* immediate */) {
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Annotates.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Annotates.java
index cf78a5c..e4facbe 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Annotates.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Annotates.java
@@ -14,16 +14,22 @@
package org.apache.aries.cdi.container.internal.util;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Executable;
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMember;
@@ -36,6 +42,9 @@ import javax.enterprise.inject.spi.ProcessProducerField;
import javax.enterprise.inject.spi.ProcessProducerMethod;
import javax.enterprise.inject.spi.ProcessSessionBean;
import javax.enterprise.inject.spi.ProcessSyntheticBean;
+import javax.inject.Named;
+import javax.inject.Qualifier;
+import javax.inject.Scope;
import org.jboss.weld.util.Types;
import org.osgi.service.cdi.ServiceScope;
@@ -48,6 +57,14 @@ public class Annotates {
// no instances
}
+ private static final Predicate<Annotation> isQualifier = annotation ->
+ !annotation.annotationType().equals(Qualifier.class) &&
+ annotation.annotationType().isAnnotationPresent(Qualifier.class);
+
+ private static final Predicate<Annotation> isScope = annotation ->
+ annotation.annotationType().isAnnotationPresent(Scope.class) ||
+ annotation.annotationType().isAnnotationPresent(NormalScope.class);
+
public static Map<String, Object> componentProperties(Annotated annotated) {
return Maps.merge(annotated.getAnnotations());
}
@@ -114,6 +131,31 @@ public class Annotates {
return (Class<X>)declaringClass;
}
+ public static Set<Annotation> qualifiers(Annotated annotated) {
+ return collect(annotated.getAnnotations()).stream().filter(isQualifier).collect(Collectors.toSet());
+ }
+
+ private static List<Annotation> collect(Collection<Annotation> annotations) {
+ List<Annotation> list = new ArrayList<>();
+ for (Annotation a1 : annotations) {
+ if (a1.annotationType().getName().startsWith("java.lang.annotation.")) continue;
+ list.add(a1);
+ }
+ list.addAll(inherit(list));
+ return list;
+ }
+
+ private static List<Annotation> inherit(Collection<Annotation> annotations) {
+ List<Annotation> list = new ArrayList<>();
+ for (Annotation a1 : annotations) {
+ for (Annotation a2 : collect(Arrays.asList(a1.annotationType().getAnnotations()))) {
+ if (list.contains(a2)) continue;
+ list.add(a2);
+ }
+ }
+ return list;
+ }
+
public static List<Class<?>> serviceClasses(Annotated annotated) {
List<Class<?>> serviceTypes = new ArrayList<>();
@@ -229,4 +271,43 @@ public class Annotates {
return ServiceScope.SINGLETON;
}
+ public static String beanName(Annotated annotated) {
+ return collect(annotated.getAnnotations()).stream().filter(Named.class::isInstance).map(Named.class::cast).findFirst().map(
+ named -> {
+ if (named.value().isEmpty()) {
+ if (annotated instanceof AnnotatedMethod) {
+ AnnotatedMethod<?> annotatedMethod = (AnnotatedMethod<?>)annotated;
+ String name = annotatedMethod.getJavaMember().getName();
+ if (name.startsWith("get")) {
+ name = name.substring(3);
+ }
+ else if (name.startsWith("is")) {
+ name = name.substring(2);
+ }
+ char c[] = name.toCharArray();
+ c[0] = Character.toLowerCase(c[0]);
+ return new String(c);
+ }
+ else if (annotated instanceof AnnotatedField) {
+ AnnotatedField<?> annotatedField = (AnnotatedField<?>)annotated;
+ return annotatedField.getJavaMember().getName();
+ }
+ else {
+ char c[] = Reflection.getRawType(annotated.getBaseType()).getSimpleName().toCharArray();
+ c[0] = Character.toLowerCase(c[0]);
+ return new String(c);
+ }
+ }
+
+ return named.value();
+ }
+ ).orElse(null);
+ }
+
+ public static Class<? extends Annotation> beanScope(Annotated annotated) {
+ Class<? extends Annotation> scope = collect(annotated.getAnnotations()).stream().filter(isScope).map(Annotation::annotationType).findFirst().orElse(null);
+
+ return (scope == null) ? Dependent.class : scope;
+ }
+
}
\ No newline at end of file
diff --git a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Reflection.java b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Reflection.java
index ac2789e..ae03c79 100644
--- a/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Reflection.java
+++ b/cdi-extender/src/main/java/org/apache/aries/cdi/container/internal/util/Reflection.java
@@ -14,15 +14,102 @@
package org.apache.aries.cdi.container.internal.util;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Stream;
+
public class Reflection {
private Reflection() {
// no instances
}
+ public static Stream<Constructor<?>> allConstructors(Class<?> declaringClass) {
+ Set<Constructor<?>> allconstructors = new HashSet<>();
+ allconstructors.addAll(Arrays.asList(declaringClass.getConstructors()));
+ allconstructors.addAll(Arrays.asList(declaringClass.getDeclaredConstructors()));
+ return allconstructors.stream().distinct();
+ }
+
+ public static Stream<Field> allFields(Class<?> declaringClass) {
+ Set<Field> allfields = new HashSet<>();
+ allfields.addAll(Arrays.asList(declaringClass.getFields()));
+ allfields.addAll(Arrays.asList(declaringClass.getDeclaredFields()));
+ return allfields.stream().distinct();
+ }
+
+ public static Stream<Method> allMethods(Class<?> declaringClass) {
+ Set<Method> allmethods = new HashSet<>();
+ allmethods.addAll(Arrays.asList(declaringClass.getMethods()));
+ allmethods.addAll(Arrays.asList(declaringClass.getDeclaredMethods()));
+ return allmethods.stream().distinct();
+ }
+
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj) {
return (T) obj;
}
+ public static Set<Type> getTypes(Type type) {
+ Set<Type> types = new HashSet<>();
+ types.add(type);
+ Class<?> rawType = getRawType(type);
+ if (rawType != null) {
+ for (Type iface : rawType.getGenericInterfaces()) {
+ types.addAll(getTypes(iface));
+ }
+ types.addAll(getTypes(rawType.getGenericSuperclass()));
+ }
+ types.remove(java.io.Serializable.class);
+ return types;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> Class<T> getRawType(Type type) {
+ if (type instanceof Class<?>) {
+ return (Class<T>) type;
+ }
+ if (type instanceof ParameterizedType) {
+ if (((ParameterizedType) type).getRawType() instanceof Class<?>) {
+ return (Class<T>) ((ParameterizedType) type).getRawType();
+ }
+ }
+ if (type instanceof TypeVariable<?>) {
+ TypeVariable<?> variable = (TypeVariable<?>) type;
+ Type[] bounds = variable.getBounds();
+ return getBound(bounds);
+ }
+ if (type instanceof WildcardType) {
+ WildcardType wildcard = (WildcardType) type;
+ return getBound(wildcard.getUpperBounds());
+ }
+ if (type instanceof GenericArrayType) {
+ GenericArrayType genericArrayType = (GenericArrayType) type;
+ Class<?> rawType = getRawType(genericArrayType.getGenericComponentType());
+ if (rawType != null) {
+ return (Class<T>) Array.newInstance(rawType, 0).getClass();
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ static <T> Class<T> getBound(Type[] bounds) {
+ if (bounds.length == 0) {
+ return (Class<T>) Object.class;
+ } else {
+ return getRawType(bounds[0]);
+ }
+ }
+
}
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_BeanServiceObjectsTest.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_BeanServiceObjectsTest.java
index d3236f8..2ee2ad3 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_BeanServiceObjectsTest.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_BeanServiceObjectsTest.java
@@ -45,7 +45,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -58,7 +58,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -75,7 +75,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -102,7 +102,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -127,7 +127,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -152,7 +152,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -173,7 +173,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -187,7 +187,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -200,7 +200,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -217,7 +217,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -244,7 +244,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -268,7 +268,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -294,7 +294,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -315,7 +315,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -329,7 +329,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -342,7 +342,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -359,7 +359,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -386,7 +386,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -411,7 +411,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -436,7 +436,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -457,7 +457,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -471,7 +471,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -485,7 +485,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
///////////////////////////////////////////////////////////////////////////////
@@ -504,7 +504,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -516,7 +516,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -532,7 +532,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -557,7 +557,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -581,7 +581,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -605,7 +605,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(BeanServiceObjects.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -625,7 +625,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", BeanServiceObjects.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -638,7 +638,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -650,7 +650,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -666,7 +666,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -691,7 +691,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -715,7 +715,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -739,7 +739,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -759,7 +759,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -772,7 +772,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -784,7 +784,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -800,7 +800,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Foo.class, referenceModel.getServiceType());
@@ -826,7 +826,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -850,7 +850,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -874,7 +874,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -894,7 +894,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -907,7 +907,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Instance.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -920,7 +920,7 @@ public class ReferenceModel_BeanServiceObjectsTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Instance.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
}
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_PropertiesTest.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_PropertiesTest.java
index f48ae90..7f00739 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_PropertiesTest.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_PropertiesTest.java
@@ -43,7 +43,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -60,7 +60,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -85,7 +85,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -110,7 +110,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -131,7 +131,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -144,7 +144,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -161,7 +161,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -186,7 +186,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -207,7 +207,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -220,7 +220,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -237,7 +237,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -262,7 +262,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -284,7 +284,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Map.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -300,7 +300,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Map.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -324,7 +324,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Optional.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -348,7 +348,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Map.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -368,7 +368,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -380,7 +380,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -396,7 +396,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -420,7 +420,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -440,7 +440,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -452,7 +452,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -468,7 +468,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -492,7 +492,7 @@ public class ReferenceModel_PropertiesTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceReferenceTest.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceReferenceTest.java
index a274c8e..4f641d0 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceReferenceTest.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceReferenceTest.java
@@ -44,7 +44,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -57,7 +57,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -74,7 +74,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -101,7 +101,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -125,7 +125,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -149,7 +149,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -170,7 +170,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -184,7 +184,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -197,7 +197,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -214,7 +214,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -241,7 +241,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -266,7 +266,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -291,7 +291,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -312,7 +312,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -326,7 +326,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -339,7 +339,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -356,7 +356,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -383,7 +383,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -408,7 +408,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -433,7 +433,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -454,7 +454,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
// parameters
@@ -469,7 +469,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -481,7 +481,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -497,7 +497,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -523,7 +523,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -546,7 +546,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -569,7 +569,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(ServiceReference.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -589,7 +589,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", ServiceReference.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -602,7 +602,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -614,7 +614,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -630,7 +630,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -656,7 +656,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -680,7 +680,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -704,7 +704,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -724,7 +724,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -737,7 +737,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -749,7 +749,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -765,7 +765,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -791,7 +791,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -815,7 +815,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -839,7 +839,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -859,7 +859,7 @@ public class ReferenceModel_ServiceReferenceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
}
\ No newline at end of file
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceTest.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceTest.java
index 1252c85..3a8a436 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceTest.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_ServiceTest.java
@@ -48,7 +48,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Integer.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -69,7 +69,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -86,7 +86,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -111,7 +111,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Integer.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -132,7 +132,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -149,7 +149,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -170,7 +170,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -183,7 +183,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -197,7 +197,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -210,7 +210,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -227,7 +227,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -254,7 +254,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -279,7 +279,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -304,7 +304,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -325,7 +325,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -339,7 +339,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -352,7 +352,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -369,7 +369,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -396,7 +396,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -421,7 +421,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -446,7 +446,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -467,7 +467,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
// params
@@ -485,7 +485,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Integer.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Integer.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -505,7 +505,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Callable.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -521,7 +521,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Optional.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -545,7 +545,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Integer.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Integer.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -565,7 +565,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Callable.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -581,7 +581,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Optional.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Optional.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -601,7 +601,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Integer.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -613,7 +613,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Optional.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -626,7 +626,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -638,7 +638,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -654,7 +654,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -680,7 +680,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -704,7 +704,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -728,7 +728,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -748,7 +748,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", Collection.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -761,7 +761,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -773,7 +773,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -789,7 +789,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -815,7 +815,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -839,7 +839,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -863,7 +863,7 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -883,6 +883,6 @@ public class ReferenceModel_ServiceTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getMethod("set", List.class).getParameters()[0]);
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
}
\ No newline at end of file
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_TupleTest.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_TupleTest.java
index 605724c..97bcbef 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_TupleTest.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ReferenceModel_TupleTest.java
@@ -45,7 +45,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -58,7 +58,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -71,7 +71,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -88,7 +88,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -113,7 +113,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -134,7 +134,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -147,7 +147,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -161,7 +161,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -174,7 +174,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -187,7 +187,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -200,7 +200,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -214,7 +214,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -231,7 +231,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -256,7 +256,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -281,7 +281,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -306,7 +306,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -327,7 +327,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -340,7 +340,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -354,7 +354,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -367,7 +367,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -380,7 +380,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -393,7 +393,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -406,7 +406,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -423,7 +423,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Map.Entry.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -445,7 +445,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -462,7 +462,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Foo.class, referenceModel.getServiceType());
@@ -487,7 +487,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(Collection.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -508,7 +508,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -522,7 +522,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test
@@ -539,7 +539,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Foo.class, referenceModel.getServiceType());
@@ -564,7 +564,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- ReferenceModel referenceModel = new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ ReferenceModel referenceModel = new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
assertEquals(List.class, referenceModel.getBeanClass());
assertEquals(Integer.class, referenceModel.getServiceType());
@@ -585,7 +585,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -598,7 +598,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
@Test(expected = IllegalArgumentException.class)
@@ -611,7 +611,7 @@ public class ReferenceModel_TupleTest extends AbstractTestBase {
InjectionPoint injectionPoint = new MockInjectionPoint(C.class.getField("m"));
- new ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+ new ReferenceModel.Builder(injectionPoint.getAnnotated()).type(injectionPoint.getType()).build();
}
}
\ No newline at end of file
diff --git a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/TemplatesTests.java b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/TemplatesTests.java
index d854f66..b4d4892 100644
--- a/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/TemplatesTests.java
+++ b/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/TemplatesTests.java
@@ -148,7 +148,7 @@ public class TemplatesTests extends BaseCDIBundleTest {
assertEquals(Arrays.asList("org.apache.aries.cdi.container.test.beans.Bar"), at.serviceClasses);
}
- assertEquals(1, ct.beans.size());
+ assertEquals(2, ct.beans.size());
assertEquals(1, ct.configurations.size());
assertEquals("barService", ct.name);
assertEquals(Maps.of(), ct.properties);
@@ -233,7 +233,7 @@ public class TemplatesTests extends BaseCDIBundleTest {
assertEquals(Arrays.asList("org.apache.aries.cdi.container.test.beans.Bar"), at.serviceClasses);
}
- assertEquals(1, ct.beans.size());
+ assertEquals(2, ct.beans.size());
assertEquals("org.apache.aries.cdi.container.test.beans.BarService", ct.beans.get(0));
assertEquals(1, ct.configurations.size());
assertEquals("barService", ct.name);
diff --git a/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/ConfigurationTests.java b/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/ConfigurationTests.java
index d9c1375..93272e0 100644
--- a/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/ConfigurationTests.java
+++ b/cdi-itests/src/main/java/org/apache/aries/cdi/test/cases/ConfigurationTests.java
@@ -112,6 +112,8 @@ public class ConfigurationTests extends AbstractTestCase {
p2.put("ports", new int[] {80});
configurationB.update(p2);
+ Thread.sleep(200); // give it a few cycles to make sure the configuration update has gone through
+
stA = new ServiceTracker<BeanService, BeanService>(
bundleContext, bundleContext.createFilter(
"(&(objectClass=org.apache.aries.cdi.test.interfaces.BeanService)(bean=A))"), null);