Search in sources :

Example 16 with BeanMetadataImpl

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

the class FavoriteUsingBlueprintTest method testFavs.

public void testFavs() throws Exception {
    BeanMetadataImpl meta = (BeanMetadataImpl) reg.getComponentDefinition("favoriteService");
    assertEquals(1, meta.getProperties().size());
    BeanProperty prop = propertyByName("favorites", meta);
    MapMetadata favorites = (MapMetadata) prop.getValue();
    assertEquals(3, favorites.getEntries().size());
    MapEntry me = favorites.getEntries().get(0);
    assertEquals("Dan", ((ValueMetadata) me.getKey()).getStringValue());
    assertEquals("Grey Goose", ((ValueMetadata) me.getValue()).getStringValue());
    me = favorites.getEntries().get(1);
    assertEquals("IndecisiveDan", ((ValueMetadata) me.getKey()).getStringValue());
    CollectionMetadata cm = (CollectionMetadata) me.getValue();
    assertEquals(2, cm.getValues().size());
    assertEquals("Malbec", ((ValueMetadata) cm.getValues().get(0)).getStringValue());
    assertEquals("0", ((ValueMetadata) ((BeanMetadata) cm.getValues().get(1)).getArguments().get(0).getValue()).getStringValue());
    me = favorites.getEntries().get(2);
    assertEquals("WithInnerBean", ((ValueMetadata) me.getKey()).getStringValue());
    BeanMetadata bm = (BeanMetadata) me.getValue();
    assertEquals(GinService.class.getName(), bm.getClassName());
    assertEquals("Bombay Sapphire", ((ValueMetadata) bm.getProperties().get(0).getValue()).getStringValue());
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl) CollectionMetadata(org.osgi.service.blueprint.reflect.CollectionMetadata) MapEntry(org.osgi.service.blueprint.reflect.MapEntry) GinService(org.apache.xbean.blueprint.example.GinService) BeanMetadata(org.osgi.service.blueprint.reflect.BeanMetadata) MapMetadata(org.osgi.service.blueprint.reflect.MapMetadata) BeanProperty(org.osgi.service.blueprint.reflect.BeanProperty)

Example 17 with BeanMetadataImpl

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

the class GinUsingXBeanTest method testWine.

public void testWine() throws Exception {
    BeanMetadataImpl meta = (BeanMetadataImpl) reg.getComponentDefinition("ginService");
    checkPropertyValue("name", "Bombay Sapphire", meta);
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl)

Example 18 with BeanMetadataImpl

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

the class VodkaUsingBlueprintTest method testWine.

public void testWine() throws Exception {
    BeanMetadataImpl meta = (BeanMetadataImpl) reg.getComponentDefinition("vodkaService");
    checkPropertyValue("name", "Grey Goose", meta);
    checkPropertyValue("id", "vodkaService", meta);
    // Test more complex classes
    checkPropertyValue("vodkaClass", VodkaService.class.getName(), meta);
}
Also used : BeanMetadataImpl(org.apache.aries.blueprint.reflect.BeanMetadataImpl) VodkaService(org.apache.xbean.blueprint.example.VodkaService)

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