Package org.apache.aries.blueprint

Examples of org.apache.aries.blueprint.TestBlueprintContainer


public class AggregateConverterTest extends TestCase {

    private AggregateConverter service;

    protected void setUp() {
        service = new AggregateConverter(new TestBlueprintContainer(null));
    }
View Full Code Here


        assertEquals(4, ((List) o[1]).get(1));
        //assertEquals((Object) new int[] { 1, 2 }, (Object) service.convert(Arrays.asList(1, 2), int[].class));
    }
   
    public void testCustom() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new RegionConverter());
        s.registerConverter(new EuRegionConverter());
       
        // lookup on a specific registered converter type
        Object result;
        result = s.convert(new Object(), Region.class);
        assertTrue(result instanceof Region);
        assertFalse(result instanceof EuRegion);
               
        result = s.convert(new Object(), EuRegion.class);
        assertTrue(result instanceof EuRegion);
       
        // find first converter that matches the type
        s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new AsianRegionConverter());
        s.registerConverter(new EuRegionConverter());
        s.registerConverter(new NullMarkerConverter());
       
        result = s.convert(new Object(), Region.class);
View Full Code Here

public class AggregateConverterTest extends TestCase {

    private AggregateConverter service;

    protected void setUp() throws Exception {
        service = new AggregateConverter(new TestBlueprintContainer(null));
    }
View Full Code Here

        assertEquals(4, ((List) o[1]).get(1));
        //assertEquals((Object) new int[] { 1, 2 }, (Object) service.convert(Arrays.asList(1, 2), int[].class));
    }
   
    public void testCustom() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new RegionConverter());
        s.registerConverter(new EuRegionConverter());
       
        // lookup on a specific registered converter type
        Object result;
        result = s.convert(new Object(), Region.class);
        assertTrue(result instanceof Region);
        assertFalse(result instanceof EuRegion);
               
        result = s.convert(new Object(), EuRegion.class);
        assertTrue(result instanceof EuRegion);
       
        // find first converter that matches the type
        s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new AsianRegionConverter());
        s.registerConverter(new EuRegionConverter());
        s.registerConverter(new NullMarkerConverter());
       
        result = s.convert(new Object(), Region.class);
View Full Code Here

        result = s.convert(new Object(), NullMarker.class);
        assertNull(result);
    }

    public void testGenericAssignable() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));

        assertNotNull(s.convert(new RegionIterable(), new GenericType(Iterable.class, new GenericType(Region.class))));

        try {
            s.convert(new ArrayList<Region>(), new GenericType(Iterable.class, new GenericType(Region.class)));
View Full Code Here

        }

    }

    public void testGenericCollection() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));

        try {
            s.convert(new ArrayList(), new GenericType(Iterable.class, new GenericType(Region.class)));
            fail("Conversion should have thrown an exception");
        } catch (Exception e) {
View Full Code Here

public class AggregateConverterTest extends TestCase {

    private AggregateConverter service;

    protected void setUp() {
        service = new AggregateConverter(new TestBlueprintContainer(null));
    }
View Full Code Here

        assertEquals(4, ((List) o[1]).get(1));
        //assertEquals((Object) new int[] { 1, 2 }, (Object) service.convert(Arrays.asList(1, 2), int[].class));
    }
   
    public void testCustom() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new RegionConverter());
        s.registerConverter(new EuRegionConverter());
       
        // lookup on a specific registered converter type
        Object result;
        result = s.convert(new Object(), Region.class);
        assertTrue(result instanceof Region);
        assertFalse(result instanceof EuRegion);
               
        result = s.convert(new Object(), EuRegion.class);
        assertTrue(result instanceof EuRegion);
       
        // find first converter that matches the type
        s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new AsianRegionConverter());
        s.registerConverter(new EuRegionConverter());
       
        result = s.convert(new Object(), Region.class);
        // TODO: check with the spec about the result
View Full Code Here

public class AggregateConverterTest extends TestCase {

    private AggregateConverter service;

    protected void setUp() throws Exception {
        service = new AggregateConverter(new TestBlueprintContainer(null));
    }
View Full Code Here

        assertEquals(4, ((List) o[1]).get(1));
        //assertEquals((Object) new int[] { 1, 2 }, (Object) service.convert(Arrays.asList(1, 2), int[].class));
    }
   
    public void testCustom() throws Exception {
        AggregateConverter s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new RegionConverter());
        s.registerConverter(new EuRegionConverter());
       
        // lookup on a specific registered converter type
        Object result;
        result = s.convert(new Object(), Region.class);
        assertTrue(result instanceof Region);
        assertFalse(result instanceof EuRegion);
               
        result = s.convert(new Object(), EuRegion.class);
        assertTrue(result instanceof EuRegion);
       
        // find first converter that matches the type
        s = new AggregateConverter(new TestBlueprintContainer(null));
        s.registerConverter(new AsianRegionConverter());
        s.registerConverter(new EuRegionConverter());
        s.registerConverter(new NullMarkerConverter());
       
        result = s.convert(new Object(), Region.class);
View Full Code Here

TOP

Related Classes of org.apache.aries.blueprint.TestBlueprintContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.