aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alien11...@apache.org
Subject svn commit: r1781787 - in /aries/trunk/blueprint/plugin/blueprint-maven-plugin/src: main/java/org/apache/aries/blueprint/plugin/model/ test/java/org/apache/aries/blueprint/plugin/ test/java/org/apache/aries/blueprint/plugin/model/
Date Sun, 05 Feb 2017 18:29:53 GMT
Author: alien11689
Date: Sun Feb  5 18:29:53 2017
New Revision: 1781787

URL: http://svn.apache.org/viewvc?rev=1781787&view=rev
Log:
[REFACTOR] Separate bean and bean ref

Added:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java
      - copied, changed from r1781786, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Registry.java
Removed:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Registry.java
Modified:
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
    aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BlueprintTest.java

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Bean.java
Sun Feb  5 18:29:53 2017
@@ -26,6 +26,7 @@ import org.apache.aries.blueprint.plugin
 import org.apache.aries.blueprint.plugin.spi.FieldAnnotationHandler;
 import org.apache.aries.blueprint.plugin.spi.InjectLikeHandler;
 import org.apache.aries.blueprint.plugin.spi.MethodAnnotationHandler;
+import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
 import org.apache.aries.blueprint.plugin.spi.XmlWriter;
 
 import javax.xml.stream.XMLStreamException;
@@ -56,14 +57,12 @@ class Bean extends BeanRef implements Be
     protected final ContextEnricher contextEnricher;
 
     Bean(Class<?> clazz, ContextEnricher contextEnricher) {
-        super(clazz, BeanRef.getBeanName(clazz));
+        super(clazz, getBeanName(clazz), clazz.getAnnotations());
         this.contextEnricher = contextEnricher;
         Introspector introspector = new Introspector(clazz);
 
         setScope(clazz);
 
-        setQualifiersFromAnnotations(clazz.getAnnotations());
-
         handleCustomBeanAnnotations();
 
         handleFieldsAnnotation(introspector);
@@ -75,7 +74,7 @@ class Bean extends BeanRef implements Be
         attributes.put("scope", findSingleton(clazz) ? "singleton" : "prototype");
     }
 
-    void resolve(BlueprintRegistry blueprintRegistry) {
+    void resolveDependency(BlueprintRegistry blueprintRegistry) {
         resolveArguments(blueprintRegistry);
         resolveFields(blueprintRegistry);
         resolveMethods(blueprintRegistry);
@@ -173,8 +172,7 @@ class Bean extends BeanRef implements Be
             }
 
             if (ref == null && value == null) {
-                BeanRef template = new BeanRef(parameterTypes[i]);
-                template.setQualifiersFromAnnotations(annotations);
+                BeanRef template = new BeanRef(parameterTypes[i], annotations);
                 BeanRef bean = blueprintRegistry.getMatching(template);
                 if (bean != null) {
                     ref = bean.id;
@@ -262,4 +260,29 @@ class Bean extends BeanRef implements Be
         }
         writeAttributes(writer);
     }
+
+    BeanRef toBeanRef() {
+        return this;
+    }
+
+    static String getBeanName(Class<?> clazz) {
+        return getBeanName(clazz, clazz);
+    }
+
+    private static String getBeanName(Class<?> clazz, AnnotatedElement annotatedElement)
{
+        for (NamedLikeHandler namedLikeHandler : Handlers.NAMED_LIKE_HANDLERS) {
+            if (annotatedElement.getAnnotation(namedLikeHandler.getAnnotation()) != null)
{
+                String name = namedLikeHandler.getName(clazz, annotatedElement);
+                if (name != null) {
+                    return name;
+                }
+            }
+        }
+        String name = clazz.getSimpleName();
+        return getBeanNameFromSimpleName(name);
+    }
+
+    private static String getBeanNameFromSimpleName(String name) {
+        return name.substring(0, 1).toLowerCase() + name.substring(1, name.length());
+    }
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRef.java
Sun Feb  5 18:29:53 2017
@@ -19,51 +19,41 @@
 package org.apache.aries.blueprint.plugin.model;
 
 import org.apache.aries.blueprint.plugin.handlers.Handlers;
-import org.apache.aries.blueprint.plugin.spi.NamedLikeHandler;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.HashSet;
+import java.util.Set;
 
 class BeanRef implements Comparable<BeanRef> {
     public String id;
-    public Class<?> clazz;
-    private Map<Class<? extends Annotation>, Annotation> qualifiers = new HashMap<>();
+    public final Class<?> clazz;
+    private final Set<Annotation> qualifiers = new HashSet<>();
 
-    /**
-     * @param clazz interface or implementation class
-     */
-    BeanRef(Class<?> clazz) {
+    BeanRef(Class<?> clazz, String id, Annotation[] qualifiers) {
         this.clazz = clazz;
+        this.id = id;
+        setQualifiersFromAnnotations(qualifiers);
     }
 
-    BeanRef(Class<?> clazz, String id) {
-        this(clazz);
-        this.id = id;
+    BeanRef(Class<?> clazz, Annotation[] qualifiers) {
+        this.clazz = clazz;
+        setQualifiersFromAnnotations(qualifiers);
     }
 
     BeanRef(Field field) {
-        this(field.getType());
-        parseQualifiers(field);
+        this(field.getType(), field.getAnnotations());
     }
 
     BeanRef(Method method) {
-        this(method.getParameterTypes()[0]);
-        parseQualifiers(method);
-    }
-
-    private void parseQualifiers(AnnotatedElement annotatedElement) {
-        Annotation[] annotations = annotatedElement.getAnnotations();
-        setQualifiersFromAnnotations(annotations);
+        this(method.getParameterTypes()[0], method.getAnnotations());
     }
 
-    void setQualifiersFromAnnotations(Annotation[] annotations) {
+    private void setQualifiersFromAnnotations(Annotation[] annotations) {
         for (Annotation ann : annotations) {
             if (isQualifier(ann) != null) {
-                this.qualifiers.put(ann.annotationType(), ann);
+                this.qualifiers.add(ann);
             }
         }
     }
@@ -78,33 +68,12 @@ class BeanRef implements Comparable<Bean
         return null;
     }
 
-    static String getBeanName(Class<?> clazz) {
-        return getBeanName(clazz, clazz);
-    }
-
-    private static String getBeanName(Class<?> clazz, AnnotatedElement annotatedElement)
{
-        for (NamedLikeHandler namedLikeHandler : Handlers.NAMED_LIKE_HANDLERS) {
-            if (annotatedElement.getAnnotation(namedLikeHandler.getAnnotation()) != null)
{
-                String name = namedLikeHandler.getName(clazz, annotatedElement);
-                if (name != null) {
-                    return name;
-                }
-            }
-        }
-        String name = clazz.getSimpleName();
-        return getBeanNameFromSimpleName(name);
-    }
-
-    private static String getBeanNameFromSimpleName(String name) {
-        return name.substring(0, 1).toLowerCase() + name.substring(1, name.length());
-    }
-
     boolean matches(BeanRef template) {
-        boolean assignable = template.clazz.isAssignableFrom(this.clazz);
         if (template.id != null) {
             return template.id.equals(id);
         }
-        return assignable && qualifiers.values().containsAll(template.qualifiers.values());
+        boolean assignable = template.clazz.isAssignableFrom(this.clazz);
+        return assignable && qualifiers.containsAll(template.qualifiers);
     }
 
     @Override
@@ -122,17 +91,11 @@ class BeanRef implements Comparable<Bean
         if (!(o instanceof BeanRef)) return false;
         final BeanRef other = (BeanRef) o;
         if (!other.canEqual(this)) return false;
-        if (this.id == null ? other.id != null : !this.id.equals(other.id)) return false;
-        if (this.clazz == null ? other.clazz != null : !this.clazz.equals(other.clazz)) return
false;
-        return true;
+        return this.id == null ? other.id == null : this.id.equals(other.id);
     }
 
     public int hashCode() {
-        final int PRIME = 59;
-        int result = 1;
-        result = result * PRIME + (this.id == null ? 0 : this.id.hashCode());
-        result = result * PRIME + (this.clazz == null ? 0 : this.clazz.hashCode());
-        return result;
+        return 1 * 59 + (this.id == null ? 0 : this.id.hashCode());
     }
 
     protected boolean canEqual(Object other) {

Copied: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java
(from r1781786, aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Registry.java)
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java?p2=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java&p1=aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Registry.java&r1=1781786&r2=1781787&rev=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Registry.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/BeanRefStore.java
Sun Feb  5 18:29:53 2017
@@ -4,14 +4,23 @@ import java.util.Collection;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-class Registry {
+class BeanRefStore {
     private SortedSet<BeanRef> reg = new TreeSet<BeanRef>();
 
     void addBean(BeanRef beanRef) {
         reg.add(beanRef);
     }
 
-    Collection<BeanRef> getBeans(){
+    Collection<BeanRef> getBeans() {
         return reg;
     }
+
+    BeanRef getMatching(BeanRef template) {
+        for (BeanRef bean : reg) {
+            if (bean.matches(template)) {
+                return bean;
+            }
+        }
+        return null;
+    }
 }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/main/java/org/apache/aries/blueprint/plugin/model/Blueprint.java
Sun Feb  5 18:29:53 2017
@@ -28,9 +28,11 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamWriter;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -38,9 +40,10 @@ import java.util.TreeSet;
 public class Blueprint implements BlueprintRegistry, ContextEnricher, XmlWriter {
     private static final String NS_BLUEPRINT = "http://www.osgi.org/xmlns/blueprint/v1.0.0";
 
-    private Registry registry = new Registry();
-    private final Map<String, XmlWriter> blueprintWriters = new HashMap<>();
+    private final BeanRefStore beanRefStore = new BeanRefStore();
+    private final Map<String, XmlWriter> customWriters = new HashMap<>();
     private final BlueprintConfiguration blueprintConfiguration;
+    private final List<Bean> generatedBeans = new ArrayList<>();
 
     Blueprint(BlueprintConfiguration blueprintConfiguration, Class<?>... beanClasses)
{
         this(blueprintConfiguration, Arrays.asList(beanClasses));
@@ -49,8 +52,8 @@ public class Blueprint implements Bluepr
     public Blueprint(BlueprintConfiguration blueprintConfiguration, Collection<Class<?>>
beanClasses) {
         this.blueprintConfiguration = blueprintConfiguration;
         initContext();
-        addBeans(beanClasses);
-        resolve();
+        parseBeans(beanClasses);
+        resolveDependency();
     }
 
     private void initContext() {
@@ -59,19 +62,20 @@ public class Blueprint implements Bluepr
         }
     }
 
-    private void addBeans(Collection<Class<?>> beanClasses) {
+    private void parseBeans(Collection<Class<?>> beanClasses) {
         for (Class<?> clazz : beanClasses) {
-            addBean(clazz);
+            parseBean(clazz);
         }
     }
 
-    private void addBean(Class<?> clazz) {
+    private void parseBean(Class<?> clazz) {
         Bean bean = new Bean(clazz, this);
-        registry.addBean(bean);
+        beanRefStore.addBean(bean.toBeanRef());
+        generatedBeans.add(bean);
         addBeansFromFactories(bean);
     }
 
-    private void addBeansFromFactories(BeanRef factoryBean) {
+    private void addBeansFromFactories(Bean factoryBean) {
         for (Method method : factoryBean.clazz.getMethods()) {
             if (!isFactoryMethod(method)) {
                 continue;
@@ -79,15 +83,16 @@ public class Blueprint implements Bluepr
             String name = AnnotationHelper.findName(method.getAnnotations());
             Class<?> beanClass = method.getReturnType();
             BeanFromFactory beanFromFactory;
-            if (name != null) {
-                beanFromFactory = new BeanFromFactory(beanClass, name, factoryBean, method,
this);
-            } else {
+            if (name == null) {
                 beanFromFactory = new BeanFromFactory(beanClass, factoryBean, method, this);
+            } else {
+                beanFromFactory = new BeanFromFactory(beanClass, name, factoryBean, method,
this);
             }
             if (AnnotationHelper.findSingletons(method.getAnnotations())) {
                 beanFromFactory.setSingleton();
             }
-            registry.addBean(beanFromFactory);
+            beanRefStore.addBean(beanFromFactory.toBeanRef());
+            generatedBeans.add(beanFromFactory);
         }
     }
 
@@ -103,44 +108,32 @@ public class Blueprint implements Bluepr
         return isFactoryMethod;
     }
 
-    private void resolve() {
-        for (Bean bean : getBeans()) {
-            bean.resolve(this);
+    private void resolveDependency() {
+        for (Bean bean : generatedBeans) {
+            bean.resolveDependency(this);
         }
     }
 
     public BeanRef getMatching(BeanRef template) {
-        for (BeanRef bean : registry.getBeans()) {
-            if (bean.matches(template)) {
-                return bean;
-            }
-        }
-        return null;
+        return beanRefStore.getMatching(template);
     }
 
-    SortedSet<Bean> getBeans() {
-        TreeSet<Bean> beans = new TreeSet<Bean>();
-        for (BeanRef ref : registry.getBeans()) {
-            if (ref instanceof Bean) {
-                beans.add((Bean) ref);
-            }
-        }
-        return beans;
+    Collection<Bean> getBeans() {
+        return generatedBeans;
     }
 
-    Map<String, XmlWriter> getBlueprintWriters() {
-        return blueprintWriters;
+    Map<String, XmlWriter> getCustomWriters() {
+        return customWriters;
     }
 
     @Override
     public void addBean(String id, Class<?> clazz) {
-        registry.addBean(new BeanRef(clazz, id));
-
+        beanRefStore.addBean(new BeanRef(clazz, id, new Annotation[]{}));
     }
 
     @Override
     public void addBlueprintContentWriter(String id, XmlWriter blueprintWriter) {
-        blueprintWriters.put(id, blueprintWriter);
+        customWriters.put(id, blueprintWriter);
     }
 
     @Override
@@ -151,11 +144,11 @@ public class Blueprint implements Bluepr
     public void write(XMLStreamWriter writer) throws XMLStreamException {
         writeBlueprint(writer);
 
-        for (Bean bean : getBeans()) {
-            bean.write(writer);
+        for (Bean beanWriter : generatedBeans) {
+            beanWriter.write(writer);
         }
 
-        for (XmlWriter bw : getBlueprintWriters().values()) {
+        for (XmlWriter bw : customWriters.values()) {
             bw.write(writer);
         }
 

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/BlueprintFileWriterTest.java
Sun Feb  5 18:29:53 2017
@@ -79,11 +79,12 @@ public class BlueprintFileWriterTest {
     @BeforeClass
     public static void setUp() throws Exception {
         ClassFinder classFinder = new ClassFinder(BlueprintFileWriterTest.class.getClassLoader());
+        long start = System.currentTimeMillis();
         Set<Class<?>> beanClasses = findClasses(classFinder, Arrays.asList(
                 MyBean1.class.getPackage().getName(),
                 ReferenceListenerToProduceWithoutAnnotation.class.getPackage().getName()
         ));
-        Set<String> namespaces = new HashSet<String>(Arrays.asList(NS_JPA, NS_TX1));
+        Set<String> namespaces = new HashSet<>(Arrays.asList(NS_JPA, NS_TX1));
         Map<String, String> customParameters = new HashMap<>();
         customParameters.put("ex.t", "1");
         customParameters.put("example.p1", "v1");
@@ -92,9 +93,11 @@ public class BlueprintFileWriterTest {
         Blueprint blueprint = new Blueprint(blueprintConfiguration, beanClasses);
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         new BlueprintFileWriter(os).write(blueprint);
-        System.out.println(os.toString("UTF-8"));
 
         xmlAsBytes = os.toByteArray();
+        System.out.println("Generation took " + (System.currentTimeMillis() - start) + "
millis");
+        System.out.println(new String(xmlAsBytes, "UTF-8"));
+
         document = readToDocument(xmlAsBytes, false);
         xpath = XPathFactory.newInstance().newXPath();
     }

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BeanTest.java
Sun Feb  5 18:29:53 2017
@@ -55,7 +55,7 @@ public class BeanTest {
     @Test
     public void testParseMyBean1() {
         Bean bean = new Bean(MyBean1.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         assertEquals(MyBean1.class, bean.clazz);
         assertEquals("myBean1", bean.id); // Name derived from class name
         assertEquals(2, getPersistenceFields(bean).size());
@@ -79,7 +79,7 @@ public class BeanTest {
     @Test
     public void testParseMyBean3() {
         Bean bean = new Bean(MyBean3.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         assertEquals(MyBean3.class, bean.clazz);
         assertEquals("myBean3", bean.id); // Name derived from class name
         assertEquals("There should be no persistence fields", 0, getPersistenceFields(bean).size());
@@ -99,7 +99,7 @@ public class BeanTest {
     @Test
     public void testParseNamedBean() {
         Bean bean = new Bean(ServiceAImpl1.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         String definedName = ServiceAImpl1.class.getAnnotation(Named.class).value();
         assertEquals("my1", definedName);
         assertEquals("Name should be defined using @Named", definedName, bean.id);
@@ -112,7 +112,7 @@ public class BeanTest {
     @Test
     public void testBlueprintBundleContext() {
         Bean bean = new Bean(MyBean4.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         Property bcProp = bean.properties.iterator().next();
         assertEquals("bundleContext", bcProp.name);
         assertEquals("blueprintBundleContext", bcProp.ref);
@@ -183,7 +183,7 @@ public class BeanTest {
     @Test
     public void testParseBeanWithConstructorInject() {
         Bean bean = new Bean(MyBean5.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         assertEquals(MyBean5.class, bean.clazz);
         assertEquals("myBean5", bean.id); // Name derived from class name
         assertTrue("There should be no persistenceUnit", getPersistenceFields(bean).isEmpty());
@@ -202,7 +202,7 @@ public class BeanTest {
     @Test
     public void testParseBeanWithConfig() {
         Bean bean = new Bean(BeanWithConfig.class, blueprint);
-        bean.resolve(blueprint);
+        bean.resolveDependency(blueprint);
         assertEquals("There should be a property", 1, bean.properties.size());
         Property prop = bean.properties.iterator().next();
         assertEquals("title", prop.name);

Modified: aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BlueprintTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BlueprintTest.java?rev=1781787&r1=1781786&r2=1781787&view=diff
==============================================================================
--- aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BlueprintTest.java
(original)
+++ aries/trunk/blueprint/plugin/blueprint-maven-plugin/src/test/java/org/apache/aries/blueprint/plugin/model/BlueprintTest.java
Sun Feb  5 18:29:53 2017
@@ -30,6 +30,7 @@ import org.osgi.framework.BundleContext;
 import org.osgi.service.blueprint.container.BlueprintContainer;
 import org.osgi.service.blueprint.container.Converter;
 
+import java.lang.annotation.Annotation;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -58,7 +59,7 @@ public class BlueprintTest {
     }
 
     private Set<String> getOsgiServices(Blueprint blueprint) {
-        Set<String> blueprintWritersKeys = blueprint.getBlueprintWriters().keySet();
+        Set<String> blueprintWritersKeys = blueprint.getCustomWriters().keySet();
         Set<String> osgiServices = new HashSet<>();
         for (String blueprintWritersKey : blueprintWritersKeys) {
             if (blueprintWritersKey.startsWith("osgiService/")) {
@@ -70,7 +71,7 @@ public class BlueprintTest {
 
     private void assertSpecialRef(String expectedId, Class<?> clazz) {
         Blueprint blueprint = new Blueprint(blueprintConfiguration);
-        BeanRef ref = blueprint.getMatching(new BeanRef(clazz));
+        BeanRef ref = blueprint.getMatching(new BeanRef(clazz, new Annotation[]{}));
         assertEquals(expectedId, ref.id);
     }
 
@@ -85,7 +86,7 @@ public class BlueprintTest {
     @Test
     public void testProduced() throws NoSuchFieldException, SecurityException {
         Blueprint blueprint = new Blueprint(blueprintConfiguration, MyFactoryBean.class);
-        BeanFromFactory matching = (BeanFromFactory) blueprint.getMatching(new BeanRef(MyProduced.class));
+        BeanFromFactory matching = (BeanFromFactory) blueprint.getMatching(new BeanRef(MyProduced.class,
new Annotation[]{}));
         Assert.assertEquals(MyProduced.class, matching.clazz);
         Assert.assertEquals("myFactoryBean", matching.attributes.get("factory-ref"));
         Assert.assertEquals("create", matching.attributes.get("factory-method"));



Mime
View raw message