Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/container/ContainerDiscoveryTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/container/ContainerDiscoveryTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/container/ContainerDiscoveryTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/container/ContainerDiscoveryTest.java
 Sat Apr 14 01:09:09 2018
@@ -14,53 +14,9 @@
 
 package org.apache.aries.cdi.container.internal.container;
 
-import static org.apache.aries.cdi.container.test.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.DefinitionException;
-
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import 
org.apache.aries.cdi.container.internal.configuration.ConfigurationModel;
-import org.apache.aries.cdi.container.internal.model.AbstractModelBuilder;
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
-import org.apache.aries.cdi.container.internal.util.Sets;
-import org.apache.aries.cdi.container.test.beans.Bar;
-import org.apache.aries.cdi.container.test.beans.BarAnnotated;
-import org.apache.aries.cdi.container.test.beans.BarReference;
-import org.apache.aries.cdi.container.test.beans.BarWithConfig;
-import org.apache.aries.cdi.container.test.beans.BarWithReference;
-import org.apache.aries.cdi.container.test.beans.Config;
-import org.apache.aries.cdi.container.test.beans.Foo;
-import org.apache.aries.cdi.container.test.beans.FooAnnotated;
-import org.apache.aries.cdi.container.test.beans.FooReference;
-import org.apache.aries.cdi.container.test.beans.FooWithConfig;
-import org.apache.aries.cdi.container.test.beans.FooWithReference;
-import org.jboss.weld.resources.spi.ResourceLoader;
-import org.jboss.weld.serialization.spi.ProxyServices;
-import org.junit.Test;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.annotations.ConfigurationPolicy;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
-import org.osgi.service.cdi.annotations.ReferencePolicy;
-import org.osgi.service.cdi.annotations.ReferencePolicyOption;
-import org.osgi.service.cdi.annotations.ReferenceScope;
-import org.osgi.service.cdi.annotations.ServiceScope;
-import org.osgi.util.converter.TypeReference;
-
 public class ContainerDiscoveryTest {
 
-       @Test
+/*     @Test
        public void testBeansOnly() throws Exception {
                AbstractModelBuilder builder = 
getModelBuilder(Collections.singletonList("OSGI-INF/cdi/beans-only.xml"), null);
 
@@ -496,5 +452,5 @@ public class ContainerDiscoveryTest {
                assertEquals(target, referenceModel.getTarget());
                assertEquals(types, referenceModel.getTypes());
        }
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/EventsTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/EventsTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/EventsTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/EventsTest.java
 Sat Apr 14 01:09:09 2018
@@ -14,33 +14,9 @@
 
 package org.apache.aries.cdi.container.internal.model;
 
-import static org.apache.aries.cdi.container.test.TestUtil.*;
-import static org.junit.Assert.*;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.literal.AnyLiteral;
-import org.apache.aries.cdi.container.internal.reference.ReferenceCallback;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
-import org.apache.aries.cdi.container.test.MockCdiContainerAndComponents;
-import org.apache.aries.cdi.container.test.MockServiceReference;
-import org.apache.aries.cdi.container.test.beans.Foo;
-import org.apache.aries.cdi.container.test.beans.ObserverFoo;
-import org.junit.Test;
-import org.osgi.framework.Constants;
-import org.osgi.service.cdi.CdiEvent;
-
 public class EventsTest {
 
-       @Test
+/*     @Test
        public void test_Event() throws Exception {
                try (MockCdiContainerAndComponents container = new 
MockCdiContainerAndComponents(
                                "test", ObserverFoo.class.getName())) {
@@ -93,5 +69,5 @@ public class EventsTest {
                        assertEquals(0, observerFoo.foos().size());
                }
        }
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ModelTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ModelTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ModelTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/model/ModelTest.java
 Sat Apr 14 01:09:09 2018
@@ -14,168 +14,36 @@
 
 package org.apache.aries.cdi.container.internal.model;
 
-import static org.apache.aries.cdi.container.test.TestUtil.*;
-import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
 
-import org.apache.aries.cdi.container.internal.component.ComponentModel;
-import 
org.apache.aries.cdi.container.internal.configuration.ConfigurationModel;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
-import org.apache.aries.cdi.container.test.beans.BarReference;
-import org.apache.aries.cdi.container.test.beans.Foo;
-import org.apache.aries.cdi.container.test.beans.FooReference;
+import org.apache.aries.cdi.container.test.TestUtil;
 import org.junit.Test;
-import org.osgi.service.cdi.annotations.ConfigurationPolicy;
 
-public class ModelTest {
+public class ModelTest extends TestUtil {
 
        @Test
-       public void testModelWithBeansOnly() throws Exception {
-               AbstractModelBuilder builder = 
getModelBuilder("OSGI-INF/cdi/beans-only.xml");
+       public void testModelWithSingleBean() throws Exception {
+               AbstractModelBuilder builder = getModelBuilder(
+                       
"OSGI-INF/cdi/org.apache.aries.cdi.container.test.beans.Bar.xml");
                BeansModel beansModel = builder.build();
                assertNotNull(beansModel);
 
                Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames(), (c1, c2) -> c1.compareTo(c2));
-               assertEquals(2, beanClassNames.size());
+               assertEquals(1, beanClassNames.size());
                assertEquals("org.apache.aries.cdi.container.test.beans.Bar", 
beanClassNames.iterator().next());
        }
 
        @Test
-       public void testModelWithConfiguration() throws Exception {
-               AbstractModelBuilder builder = 
getModelBuilder("OSGI-INF/cdi/beans-configuration.xml");
-               BeansModel beansModel = builder.build();
-               assertNotNull(beansModel);
-
-               Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames());
-               assertEquals(2, beanClassNames.size());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.BarWithConfig", 
beanClassNames.iterator().next());
-
-               Collection<ComponentModel> componentModels = 
beansModel.getComponentModels();
-               assertEquals(2, componentModels.size());
-               Iterator<ComponentModel> components = 
componentModels.iterator();
-
-               ComponentModel componentModel = components.next();
-               Collection<ConfigurationModel> configurations = 
sort(componentModel.getConfigurations());
-               Iterator<ConfigurationModel> confIterator = 
configurations.iterator();
-
-               ConfigurationModel configurationModel = confIterator.next();
-               assertArrayEquals(new String[] {"$"}, 
configurationModel.getPid());
-               assertEquals(ConfigurationPolicy.OPTIONAL, 
configurationModel.getConfigurationPolicy());
-               assertEquals("org.apache.aries.cdi.container.test.beans.Bar", 
configurationModel.getType().getTypeName());
-
-               configurationModel = confIterator.next();
-               assertArrayEquals(new String[] {"$"}, 
configurationModel.getPid());
-               assertEquals(ConfigurationPolicy.REQUIRE, 
configurationModel.getConfigurationPolicy());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.Config", 
configurationModel.getType().getTypeName());
-
-               componentModel = components.next();
-               configurations = sort(componentModel.getConfigurations());
-               configurationModel = configurations.iterator().next();
-               assertArrayEquals(new String[] {"$", "foo.config"}, 
configurationModel.getPid());
-               assertEquals(ConfigurationPolicy.OPTIONAL, 
configurationModel.getConfigurationPolicy());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.Config", 
configurationModel.getType().getTypeName());
-       }
-
-       @Test
-       public void testModelWithReferences() throws Exception {
-               AbstractModelBuilder builder = 
getModelBuilder("OSGI-INF/cdi/beans-references.xml");
-               BeansModel beansModel = builder.build();
-               assertNotNull(beansModel);
-
-               Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames());
-               assertEquals(2, beanClassNames.size());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.BarWithReference", 
beanClassNames.iterator().next());
-
-               Collection<ComponentModel> componentModels = 
sort(beansModel.getComponentModels());
-               assertEquals(2, componentModels.size());
-               Iterator<ComponentModel> iterator = componentModels.iterator();
-
-               ComponentModel componentModel = iterator.next();
-               ReferenceModel referenceModel = 
componentModel.getReferences().iterator().next();
-               assertEquals(BarReference.class, referenceModel.getBeanClass());
-
-               componentModel = iterator.next();
-               referenceModel = 
componentModel.getReferences().iterator().next();
-               assertEquals(FooReference.class, referenceModel.getBeanClass());
-       }
-
-       @Test
-       public void testModelWithServices() throws Exception {
-               AbstractModelBuilder builder = 
getModelBuilder("OSGI-INF/cdi/beans-services.xml");
-               BeansModel beansModel = builder.build();
-               assertNotNull(beansModel);
-
-               Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames());
-               assertEquals(2, beanClassNames.size());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.FooService", 
beanClassNames.iterator().next());
-
-               Collection<ComponentModel> componentModels = 
sort(beansModel.getComponentModels(), (a, b) -> 
a.getName().compareTo(b.getName()));
-               assertEquals(2, componentModels.size());
-
-               Iterator<ComponentModel> iterator = componentModels.iterator();
-
-               ComponentModel componentModel = iterator.next();
-               List<String> provides = componentModel.getProvides();
-               assertEquals(0, provides.size());
-
-               componentModel = iterator.next();
-               provides = componentModel.getProvides();
-               assertEquals(2, provides.size());
-
-               assertEquals(Foo.class.getName(), provides.get(0));
-               assertEquals(Cloneable.class.getName(), provides.get(1));
-               String[] serviceProperties = componentModel.getProperties();
-               assertEquals(33, serviceProperties.length);
-
-               assertEquals("foo:String=fum", serviceProperties[0]);
-               assertEquals("foo1:String=baz", serviceProperties[1]);
-               assertEquals("foo2:Long=345987643", serviceProperties[2]);
-               assertEquals("foo3:Double=3459.87643", serviceProperties[3]);
-               assertEquals("foo4:Float=3459.87", serviceProperties[4]);
-               assertEquals("foo5:Integer=724559", serviceProperties[5]);
-               assertEquals("foo6:Byte=127", serviceProperties[6]);
-               assertEquals("foo7:Character=X", serviceProperties[7]);
-               assertEquals("foo8:Boolean=true", serviceProperties[8]);
-               assertEquals("foo9:Short=32767", serviceProperties[9]);
-               assertEquals("foo11:String=frog", serviceProperties[10]);
-               assertEquals("foo11:String=drum", serviceProperties[11]);
-               assertEquals("foo12:Long=345987643", serviceProperties[12]);
-               assertEquals("foo12:Long=34", serviceProperties[13]);
-               assertEquals("foo13:Double=3459.87643", serviceProperties[14]);
-               assertEquals("foo13:Double=34.3456", serviceProperties[15]);
-               assertEquals("foo14:Float=3459.87", serviceProperties[16]);
-               assertEquals("foo14:Float=35.23", serviceProperties[17]);
-               assertEquals("foo15:Integer=724559", serviceProperties[18]);
-               assertEquals("foo15:Integer=345", serviceProperties[19]);
-               assertEquals("foo16:Byte=127", serviceProperties[20]);
-               assertEquals("foo16:Byte=23", serviceProperties[21]);
-               assertEquals("foo17:Character=X", serviceProperties[22]);
-               assertEquals("foo17:Character=t", serviceProperties[23]);
-               assertEquals("foo18:Boolean=true", serviceProperties[24]);
-               assertEquals("foo18:Boolean=false", serviceProperties[25]);
-               assertEquals("foo19:Short=32767", serviceProperties[26]);
-               assertEquals("foo19:Short=2345", serviceProperties[27]);
-               assertEquals("foo20:String=bar", serviceProperties[28]);
-               assertEquals("foo21:List<Short>=32767", serviceProperties[29]);
-               assertEquals("foo21:List<Short>=2345", serviceProperties[30]);
-               assertEquals("foo22:Set<Short>=32767", serviceProperties[31]);
-               assertEquals("foo22:Set<Short>=2345", serviceProperties[32]);
-       }
-
-       @Test
-       public void testModelWithAllDescriptors() throws Exception {
+       public void testModelWithDefaultResources() throws Exception {
                AbstractModelBuilder builder = getModelBuilder(null);
                BeansModel beansModel = builder.build();
                assertNotNull(beansModel);
 
-               Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames());
-               assertEquals(8, beanClassNames.size());
-               
assertEquals("org.apache.aries.cdi.container.test.beans.FooService", 
beanClassNames.iterator().next());
+               Collection<String> beanClassNames = 
sort(beansModel.getBeanClassNames(), (c1, c2) -> c1.compareTo(c2));
+               assertEquals(5, beanClassNames.size());
+               assertEquals("org.apache.aries.cdi.container.test.beans.Bar", 
beanClassNames.iterator().next());
        }
-
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/ConfigurationPhaseTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/ConfigurationPhaseTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/ConfigurationPhaseTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/phase/ConfigurationPhaseTest.java
 Sat Apr 14 01:09:09 2018
@@ -14,30 +14,9 @@
 
 package org.apache.aries.cdi.container.internal.phase;
 
-import static org.apache.aries.cdi.container.test.TestUtil.*;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.aries.cdi.container.internal.container.ContainerDiscovery;
-import org.apache.aries.cdi.container.internal.container.ContainerState;
-import org.apache.aries.cdi.container.internal.model.AbstractModelBuilder;
-import org.apache.aries.cdi.container.internal.model.BeansModel;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.Constants;
-import org.osgi.service.cdi.CdiEvent;
-import org.osgi.service.cm.ManagedService;
-
 public class ConfigurationPhaseTest {
 
-       @Test
+/*     @Test
        public void testOnlyBeans() throws Exception {
                AbstractModelBuilder builder = 
getModelBuilder(Collections.singletonList("OSGI-INF/cdi/beans-only.xml"), null);
 
@@ -197,5 +176,5 @@ public class ConfigurationPhaseTest {
                entry.getValue().updated(properties);
                Assert.assertEquals(CdiEvent.Type.CREATED, 
containerState.lastState());
        }
-
+*/
 }

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_PropertiesTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_PropertiesTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_PropertiesTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_PropertiesTest.java
 Sat Apr 14 01:09:09 2018
@@ -15,21 +15,22 @@
 package org.apache.aries.cdi.container.internal.reference;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.Callable;
+import java.util.Optional;
 
-import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
+import org.apache.aries.cdi.container.internal.util.Sets;
 import org.apache.aries.cdi.container.test.MockInjectionPoint;
 import org.junit.Test;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
+import org.osgi.service.cdi.annotations.Reference;
 import org.osgi.util.converter.TypeReference;
 
 public class ReferenceModel_PropertiesTest {
@@ -42,7 +43,7 @@ public class ReferenceModel_PropertiesTe
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
@@ -51,70 +52,54 @@ public class ReferenceModel_PropertiesTe
                        Map<String, Object>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
        @Test
        public void withServiceDefined_cardinality() throws Exception {
                Type type = new TypeReference<
-                       Map<String, Object>
+                       Optional<Map<String, Object>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.OPTIONAL).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
-               assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Optional.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.OPTIONAL, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
-       @Test(expected = IllegalArgumentException.class)
-       public void withServiceDefined_cardinality_multiple() throws Exception {
-               Type type = new TypeReference<
-                       Map<String, Object>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.MULTIPLE).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void withServiceDefined_cardinality_atleastone() throws 
Exception {
-               Type type = new TypeReference<
-                       Map<String, Object>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
-       }
-
        @Test
        public void withServiceDefinedAsWildCard() throws Exception {
                Type type = new TypeReference<
                        Map<String, ?>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
@@ -126,7 +111,7 @@ public class ReferenceModel_PropertiesTe
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -137,7 +122,7 @@ public class ReferenceModel_PropertiesTe
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
@@ -146,14 +131,16 @@ public class ReferenceModel_PropertiesTe
                        Collection<Map<String, Object>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
@@ -163,53 +150,35 @@ public class ReferenceModel_PropertiesTe
                        Collection<Map<String, Object>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
-       @Test(expected = IllegalArgumentException.class)
-       public void collectionWithServiceDefined_cardinality_mandatory() throws 
Exception {
-               Type type = new TypeReference<
-                       Collection<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.MANDATORY).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void collectionWithServiceDefined_cardinality_optional() throws 
Exception {
-               Type type = new TypeReference<
-                       Collection<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.OPTIONAL).build();
-       }
-
        @Test
        public void collectionWithServiceDefined_Wildcard() throws Exception {
                Type type = new TypeReference<
                        Collection<Map<String, ?>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
@@ -221,7 +190,7 @@ public class ReferenceModel_PropertiesTe
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -232,7 +201,7 @@ public class ReferenceModel_PropertiesTe
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
@@ -241,14 +210,16 @@ public class ReferenceModel_PropertiesTe
                        List<Map<String, Object>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
@@ -258,158 +229,35 @@ public class ReferenceModel_PropertiesTe
                        List<Map<String, Object>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
 
-       @Test(expected = IllegalArgumentException.class)
-       public void listWithServiceDefined_cardinality_mandatory() throws 
Exception {
-               Type type = new TypeReference<
-                       List<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.MANDATORY).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void listWithServiceDefined_cardinality_optional() throws 
Exception {
-               Type type = new TypeReference<
-                       List<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.OPTIONAL).build();
-       }
-
        @Test
        public void listWithServiceDefined_Wildcard() throws Exception {
                Type type = new TypeReference<
                        List<Map<String, ?>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
        }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithoutServiceDefined() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithoutServiceDefined_Wildcard() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, ?>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-       }
-
-       @Test
-       public void instanceWithServiceDefined() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, Object>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       Map<String, Object>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void instanceWithServiceDefined_cardinality() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, Object>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       Map<String, Object>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
-
-               assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithServiceDefined_cardinality_mandatory() throws 
Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.MANDATORY).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithServiceDefined_cardinality_optional() throws 
Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, Object>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).cardinality(ReferenceCardinality.OPTIONAL).build();
-       }
-
-       @Test
-       public void instanceWithServiceDefined_Wildcard() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Map<String, ?>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       Map<String, ?>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(Map.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.PROPERTIES, 
referenceModel.getCollectionType());
-       }
-
 }
\ No newline at end of file

Added: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ReferenceServiceObjectsTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ReferenceServiceObjectsTest.java?rev=1829114&view=auto
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ReferenceServiceObjectsTest.java
 (added)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ReferenceServiceObjectsTest.java
 Sat Apr 14 01:09:09 2018
@@ -0,0 +1,306 @@
+/**
+ * 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.reference;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.apache.aries.cdi.container.internal.model.CollectionType;
+import org.apache.aries.cdi.container.internal.util.Sets;
+import org.apache.aries.cdi.container.test.MockInjectionPoint;
+import org.apache.aries.cdi.container.test.beans.Foo;
+import org.junit.Test;
+import org.osgi.service.cdi.annotations.Reference;
+import org.osgi.service.cdi.reference.ReferenceServiceObjects;
+import org.osgi.util.converter.TypeReference;
+
+public class ReferenceModel_ReferenceServiceObjectsTest {
+
+       @Test(expected = IllegalArgumentException.class)
+       public void withoutServiceDefined() throws Exception {
+               @SuppressWarnings("rawtypes")
+               Type type = new TypeReference<
+                       ReferenceServiceObjects
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void withoutServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       ReferenceServiceObjects<?>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test
+       public void withServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       ReferenceServiceObjects<Integer>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(ReferenceServiceObjects.class, 
referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void collectionWithoutServiceDefined() throws Exception {
+               @SuppressWarnings("rawtypes")
+               Type type = new TypeReference<
+                       Collection<ReferenceServiceObjects>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test
+       public void collectionWithServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       Collection<ReferenceServiceObjects<Integer>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(Collection.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test
+       public void collectionWithServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       Collection<ReferenceServiceObjects<Integer>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(Collection.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void listWithoutServiceDefined() throws Exception {
+               @SuppressWarnings("rawtypes")
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void listWithoutServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects<?>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test
+       public void listWithServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects<Integer>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(List.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test
+       public void listWithServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects<Integer>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(List.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void instanceWithoutServiceDefined() throws Exception {
+               @SuppressWarnings("rawtypes")
+               Type type = new TypeReference<
+                       Instance<ReferenceServiceObjects>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void instanceWithoutServiceDefined_typed() throws Exception {
+               Type type = new TypeReference<
+                       Instance<ReferenceServiceObjects<?>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       
///////////////////////////////////////////////////////////////////////////////
+
+       @Test
+       public void typed_withoutServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       ReferenceServiceObjects<Foo>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(ReferenceServiceObjects.class, 
referenceModel.getBeanClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void typed_withServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       ReferenceServiceObjects<Foo>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test
+       public void typed_collectionWithoutServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       Collection<ReferenceServiceObjects<Foo>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(Collection.class, referenceModel.getBeanClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void typed_collectionWithServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       Collection<ReferenceServiceObjects<Foo>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+
+       @Test
+       public void typed_listWithoutServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects<Foo>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+
+               assertEquals(List.class, referenceModel.getBeanClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
+               assertEquals(type, referenceModel.getInjectionPointType());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
+               assertEquals(CollectionType.SERVICEOBJECTS, 
referenceModel.getCollectionType());
+       }
+
+       @Test(expected = IllegalArgumentException.class)
+       public void typed_listWithServiceDefined() throws Exception {
+               Type type = new TypeReference<
+                       List<ReferenceServiceObjects<Foo>>
+               >(){}.getType();
+
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
+
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
+       }
+}
\ No newline at end of file

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceReferenceTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceReferenceTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceReferenceTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceReferenceTest.java
 Sat Apr 14 01:09:09 2018
@@ -15,22 +15,23 @@
 package org.apache.aries.cdi.container.internal.reference;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.Callable;
 
-import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
+import org.apache.aries.cdi.container.internal.util.Sets;
 import org.apache.aries.cdi.container.test.MockInjectionPoint;
 import org.apache.aries.cdi.container.test.beans.Foo;
 import org.junit.Test;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
+import org.osgi.service.cdi.annotations.Reference;
 import org.osgi.util.converter.TypeReference;
 
 public class ReferenceModel_ServiceReferenceTest {
@@ -44,7 +45,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -55,7 +56,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -66,28 +67,29 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
        public void withServiceDefined() throws Exception {
-               @SuppressWarnings("rawtypes")
                Type type = new TypeReference<
-                       ServiceReference
+                       ServiceReference<Integer>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
-       @Test
+       @Test(expected = IllegalArgumentException.class)
        public void withServiceDefined_wildcard() throws Exception {
                Type type = new TypeReference<
                        ServiceReference<?>
@@ -95,13 +97,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -113,7 +109,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -124,41 +120,25 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
        public void collectionWithServiceDefined() throws Exception {
-               @SuppressWarnings("rawtypes")
-               Type type = new TypeReference<
-                       Collection<ServiceReference>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void collectionWithServiceDefined_wildcard() throws Exception {
                Type type = new TypeReference<
-                       Collection<ServiceReference<?>>
+                       Collection<ServiceReference<Integer>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
@@ -171,7 +151,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -182,106 +162,25 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
        public void listWithServiceDefined() throws Exception {
-               @SuppressWarnings("rawtypes")
                Type type = new TypeReference<
-                       List<ServiceReference>
+                       List<ServiceReference<Integer>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void listWithServiceDefined_wildcard() throws Exception {
-               Type type = new TypeReference<
-                       List<ServiceReference<?>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithoutServiceDefined() throws Exception {
-               @SuppressWarnings("rawtypes")
-               Type type = new TypeReference<
-                       Instance<ServiceReference>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void instanceWithoutServiceDefined_wildcard() throws Exception {
-               Type type = new TypeReference<
-                       Instance<ServiceReference<?>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-       }
-
-       @Test
-       public void instanceWithServiceDefined() throws Exception {
-               @SuppressWarnings("rawtypes")
-               Type type = new TypeReference<
-                       Instance<ServiceReference>
-               >(){}.getType();
-               @SuppressWarnings("rawtypes")
-               Type injectionPointType = new TypeReference<
-                       ServiceReference
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void instanceWithServiceDefined_wildcard() throws Exception {
-               Type type = new TypeReference<
-                       Instance<ServiceReference<?>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       ServiceReference<?>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
@@ -295,16 +194,18 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Foo.class, referenceModel.getServiceClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
-       @Test
+       @Test(expected = IllegalArgumentException.class)
        public void typed_withoutServiceDefined_wildcardExt() throws Exception {
                Type type = new TypeReference<
                        ServiceReference<? extends Foo>
@@ -312,13 +213,7 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-
-               assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Foo.class, referenceModel.getServiceClass());
-               assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -327,9 +222,9 @@ public class ReferenceModel_ServiceRefer
                        ServiceReference<Foo>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
@@ -340,12 +235,14 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Foo.class, referenceModel.getServiceClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
@@ -355,9 +252,9 @@ public class ReferenceModel_ServiceRefer
                        Collection<ServiceReference<Foo>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
@@ -368,12 +265,14 @@ public class ReferenceModel_ServiceRefer
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Foo.class, referenceModel.getServiceClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
        }
 
@@ -383,51 +282,8 @@ public class ReferenceModel_ServiceRefer
                        List<ServiceReference<Foo>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-       }
-
-       @Test
-       public void typed_instanceWithoutServiceDefined() throws Exception {
-               Type type = new TypeReference<
-                       Instance<ServiceReference<Foo>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       ServiceReference<Foo>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               assertEquals(ServiceReference.class, 
referenceModel.getBeanClass());
-               assertEquals(Foo.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.REFERENCE, 
referenceModel.getCollectionType());
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void typed_instanceWithServiceDefined() throws Exception {
-               Type type = new TypeReference<
-                       Instance<ServiceReference<Foo>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void typed_instanceWithServiceDefined_wildcardExt() throws 
Exception {
-               Type type = new TypeReference<
-                       Instance<ServiceReference<? extends Foo>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-       }
-
 }
\ No newline at end of file

Modified: 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceTest.java
URL: 
http://svn.apache.org/viewvc/aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceTest.java?rev=1829114&r1=1829113&r2=1829114&view=diff
==============================================================================
--- 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceTest.java
 (original)
+++ 
aries/trunk/cdi/cdi-extender/src/test/java/org/apache/aries/cdi/container/internal/reference/ReferenceModel_ServiceTest.java
 Sat Apr 14 01:09:09 2018
@@ -15,21 +15,24 @@
 package org.apache.aries.cdi.container.internal.reference;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.Callable;
 
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.aries.cdi.container.internal.model.CollectionType;
-import org.apache.aries.cdi.container.internal.reference.ReferenceModel;
+import org.apache.aries.cdi.container.internal.util.Sets;
 import org.apache.aries.cdi.container.test.MockInjectionPoint;
 import org.apache.aries.cdi.container.test.beans.Foo;
 import org.junit.Test;
-import org.osgi.service.cdi.annotations.ReferenceCardinality;
+import org.osgi.service.cdi.annotations.Reference;
 import org.osgi.util.converter.TypeReference;
 
 public class ReferenceModel_ServiceTest {
@@ -37,116 +40,91 @@ public class ReferenceModel_ServiceTest
        @Test
        public void single() throws Exception {
                Type type = new TypeReference<
-                       Callable<?>
+                       Integer
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
-               assertEquals(Callable.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MANDATORY, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertFalse(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test
        public void single_cardinality() throws Exception {
                Type type = new TypeReference<
-                       Callable<?>
+                       Optional<Integer>
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.OPTIONAL).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
-               assertEquals(Callable.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Optional.class, referenceModel.getBeanClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.OPTIONAL, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertTrue(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test(expected = IllegalArgumentException.class)
-       public void single_cardinality_multiple() throws Exception {
-               Type type = new TypeReference<
-                       Callable<?>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.MULTIPLE).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
-       public void single_cardinality_atleastone() throws Exception {
-               Type type = new TypeReference<
-                       Callable<?>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
        public void single_incompatibleSpecified() throws Exception {
                Type type = new TypeReference<
-                       Callable<String>
+                       Integer
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Foo.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Foo.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
        public void collection() throws Exception {
                Type type = new TypeReference<
-                       Collection<Callable<String>>
+                       Collection<Foo>
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Foo.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test
        public void collection_cardinality() throws Exception {
                Type type = new TypeReference<
-                       Collection<Callable<String>>
+                       Collection<Integer>
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test(expected = IllegalArgumentException.class)
-       public void collection_cardinality_mandatory() throws Exception {
-               Type type = new TypeReference<
-                       Collection<Callable<String>>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.MANDATORY).build();
-       }
-
-       @Test(expected = IllegalArgumentException.class)
        public void collection_cardinality_optional() throws Exception {
                Type type = new TypeReference<
                        Collection<Callable<String>>
@@ -154,7 +132,7 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.OPTIONAL).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -163,9 +141,9 @@ public class ReferenceModel_ServiceTest
                        Collection<Callable<String>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Foo.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Foo.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -176,57 +154,63 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test
        public void collection_specified_Wilcard() throws Exception {
                Type type = new TypeReference<
-                       Collection<?>
+                       Collection<Integer>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(Collection.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test
        public void list() throws Exception {
                Type type = new TypeReference<
-                       List<Callable<String>>
+                       List<Integer>
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
        @Test
        public void list_cardinality() throws Exception {
                Type type = new TypeReference<
-                       List<Callable<String>>
+                       List<Integer>
                >(){}.getType();
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
+               ReferenceModel referenceModel = new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
 
                assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
+               assertEquals(Integer.class, referenceModel.getServiceType());
                assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
+               assertFalse(referenceModel.dynamic());
+               assertTrue(referenceModel.optional());
+               assertFalse(referenceModel.unary());
                assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
        }
 
@@ -238,7 +222,7 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.MANDATORY).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -249,7 +233,7 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.OPTIONAL).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -258,9 +242,9 @@ public class ReferenceModel_ServiceTest
                        List<Callable<String>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Foo.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Foo.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -271,64 +255,18 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
-       @Test
+       @Test(expected = IllegalArgumentException.class)
        public void list_specified_wildcard() throws Exception {
                Type type = new TypeReference<
                        List<?>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Integer.class, "")));
 
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Callable.class).build();
-
-               assertEquals(List.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(type, referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void instance() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Callable<String>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       Callable<String>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
-
-               assertEquals(Callable.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.MULTIPLE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
-       }
-
-       @Test
-       public void instance_cardinality() throws Exception {
-               Type type = new TypeReference<
-                       Instance<Callable<String>>
-               >(){}.getType();
-               Type injectionPointType = new TypeReference<
-                       Callable<String>
-               >(){}.getType();
-
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
-
-               ReferenceModel referenceModel = new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.AT_LEAST_ONE).build();
-
-               assertEquals(Callable.class, referenceModel.getBeanClass());
-               assertEquals(Callable.class, referenceModel.getServiceClass());
-               assertEquals(injectionPointType, 
referenceModel.getInjectionPointType());
-               assertEquals(ReferenceCardinality.AT_LEAST_ONE, 
referenceModel.getCardinality());
-               assertEquals(CollectionType.SERVICE, 
referenceModel.getCollectionType());
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -339,7 +277,7 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.MANDATORY).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -350,7 +288,7 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).cardinality(ReferenceCardinality.OPTIONAL).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -359,9 +297,9 @@ public class ReferenceModel_ServiceTest
                        Instance<Callable<String>>
                >(){}.getType();
 
-               InjectionPoint injectionPoint = new MockInjectionPoint(type);
+               InjectionPoint injectionPoint = new MockInjectionPoint(type, 
Sets.hashSet(Reference.Literal.of(Foo.class, "")));
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).service(Foo.class).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
 
        @Test(expected = IllegalArgumentException.class)
@@ -372,7 +310,6 @@ public class ReferenceModel_ServiceTest
 
                InjectionPoint injectionPoint = new MockInjectionPoint(type);
 
-               new 
ReferenceModel.Builder(injectionPoint.getQualifiers()).annotated(injectionPoint.getAnnotated()).build();
+               new 
ReferenceModel.Builder().injectionPoint(injectionPoint).build();
        }
-
 }
\ No newline at end of file


Reply via email to