Search in sources :

Example 11 with BeanMetadataImpl

use of org.apache.aries.blueprint.reflect.BeanMetadataImpl in project geronimo-xbean by apache.

the class SoupUsingBlueprintTest method testSoup.

public void testSoup() throws Exception {
    BeanMetadataImpl soup = (BeanMetadataImpl) reg.getComponentDefinition("soupService");
    BeanMetadataImpl nestedBean = (BeanMetadataImpl) reg.getComponentDefinition("nestedBean");
    BeanMetadataImpl nestedValue = (BeanMetadataImpl) reg.getComponentDefinition("nestedValue");
    asssertValidSoup(soup);
    asssertValidSoup(nestedBean);
    asssertValidSoup(nestedValue);
// reg.;
// assertFalse(soup.exists());
// assertFalse(nestedBean.exists());
// assertFalse(nestedValue.exists());
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl)

Example 12 with BeanMetadataImpl

use of org.apache.aries.blueprint.reflect.BeanMetadataImpl in project geronimo-xbean by apache.

the class PizzaUsingXBeanWinBeanRefTest method testPizza.

public void testPizza() throws Exception {
    BeanMetadataImpl meta = (BeanMetadataImpl) reg.getComponentDefinition("pizzaService");
    BeanProperty p = propertyByName("topping", meta);
    assertTrue(p.getValue() instanceof RefMetadataImpl);
    assertEquals("topping", ((RefMetadataImpl) p.getValue()).getComponentId());
    checkPropertyValue("cheese", "#Edam", meta);
    checkPropertyValue("size", "17", meta);
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl) RefMetadataImpl(org.apache.aries.blueprint.reflect.RefMetadataImpl) BeanProperty(org.osgi.service.blueprint.reflect.BeanProperty)

Example 13 with BeanMetadataImpl

use of org.apache.aries.blueprint.reflect.BeanMetadataImpl in project geronimo-xbean by apache.

the class RecipeUsingBlueprintTest method testRecipes.

public void testRecipes() throws Exception {
    BeanMetadataImpl svc = (BeanMetadataImpl) reg.getComponentDefinition("recipeService");
    List<Metadata> list = ((CollectionMetadataImpl) propertyByName("recipes", svc).getValue()).getValues();
    assertNotNull(list);
    assertEquals(2, list.size());
    BeanMetadataImpl r = (BeanMetadataImpl) list.get(0);
    checkPropertyValue("ingredients", "Food", r);
    checkPropertyValue("instructions", "Mash together", r);
    r = (BeanMetadataImpl) list.get(1);
    checkPropertyValue("ingredients", "Food", r);
    checkPropertyValue("instructions", "Mash together", r);
    BeanMetadataImpl topRecipe = (BeanMetadataImpl) propertyByName("topRecipe", svc).getValue();
    assertNotNull(topRecipe);
    checkPropertyValue("ingredients", "Food", topRecipe);
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl) Metadata(org.osgi.service.blueprint.reflect.Metadata) CollectionMetadataImpl(org.apache.aries.blueprint.reflect.CollectionMetadataImpl)

Example 14 with BeanMetadataImpl

use of org.apache.aries.blueprint.reflect.BeanMetadataImpl in project geronimo-xbean by apache.

the class ComponentTest method test.

protected void test(String file) throws Exception {
    ComponentDefinitionRegistry f = BlueprintTestSupport.parse(file).getComponentDefinitionRegistry();
    BeanMetadataImpl meta = (BeanMetadataImpl) f.getComponentDefinition("container");
    assertNotNull(meta);
    CollectionMetadata list = (CollectionMetadata) BlueprintTestSupport.propertyByName("beans", meta).getValue();
    assertEquals(1, list.getValues().size());
    assertEquals(InnerBean.class.getName(), ((BeanMetadata) list.getValues().get(0)).getClassName());
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl) ComponentDefinitionRegistry(org.apache.aries.blueprint.ComponentDefinitionRegistry) CollectionMetadata(org.osgi.service.blueprint.reflect.CollectionMetadata) InnerBean(org.apache.xbean.blueprint.example.InnerBean)

Example 15 with BeanMetadataImpl

use of org.apache.aries.blueprint.reflect.BeanMetadataImpl in project geronimo-xbean by apache.

the class PizzaUsingBlueprintTest method testPizza.

public void testPizza() throws Exception {
    BeanMetadataImpl meta = (BeanMetadataImpl) reg.getComponentDefinition("pizzaService");
    // pizza.makePizza();
    checkPropertyValue("topping", "Salami", meta);
    checkPropertyValue("cheese", "Edam", meta);
    checkPropertyValue("size", "17", meta);
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl)

Aggregations

BeanMetadataImpl (org.apache.aries.blueprint.reflect.BeanMetadataImpl)18 CollectionMetadata (org.osgi.service.blueprint.reflect.CollectionMetadata)4 CollectionMetadataImpl (org.apache.aries.blueprint.reflect.CollectionMetadataImpl)3 RefMetadataImpl (org.apache.aries.blueprint.reflect.RefMetadataImpl)3 BeanProperty (org.osgi.service.blueprint.reflect.BeanProperty)3 Metadata (org.osgi.service.blueprint.reflect.Metadata)3 BeanMetadata (org.osgi.service.blueprint.reflect.BeanMetadata)2 ValueMetadata (org.osgi.service.blueprint.reflect.ValueMetadata)2 URI (java.net.URI)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Dictionary (java.util.Dictionary)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 Properties (java.util.Properties)1 ExecutorService (java.util.concurrent.ExecutorService)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ComponentDefinitionRegistry (org.apache.aries.blueprint.ComponentDefinitionRegistry)1 NamespaceHandlerSet (org.apache.aries.blueprint.parser.NamespaceHandlerSet)1 IdRefMetadataImpl (org.apache.aries.blueprint.reflect.IdRefMetadataImpl)1