use of org.apache.aries.blueprint.pojos.PojoGenerics in project aries by apache.
the class WiringTest method testGenerics.
public void testGenerics() throws Exception {
ComponentDefinitionRegistryImpl registry = parse("/test-generics.xml");
Repository repository = new TestBlueprintContainer(registry).getRepository();
List<Integer> expectedList = new ArrayList<Integer>();
expectedList.add(new Integer(10));
expectedList.add(new Integer(20));
expectedList.add(new Integer(50));
Set<Long> expectedSet = new HashSet<Long>();
expectedSet.add(new Long(1000));
expectedSet.add(new Long(2000));
expectedSet.add(new Long(5000));
Map<Short, Boolean> expectedMap = new HashMap<Short, Boolean>();
expectedMap.put(new Short((short) 1), Boolean.TRUE);
expectedMap.put(new Short((short) 2), Boolean.FALSE);
expectedMap.put(new Short((short) 5), Boolean.TRUE);
Object obj;
PojoGenerics pojo;
obj = repository.create("method");
assertTrue(obj instanceof PojoGenerics);
pojo = (PojoGenerics) obj;
assertEquals(expectedList, pojo.getList());
assertEquals(expectedSet, pojo.getSet());
assertEquals(expectedMap, pojo.getMap());
obj = repository.create("constructorList");
assertTrue(obj instanceof PojoGenerics);
pojo = (PojoGenerics) obj;
assertEquals(expectedList, pojo.getList());
obj = repository.create("constructorSet");
assertTrue(obj instanceof PojoGenerics);
pojo = (PojoGenerics) obj;
assertEquals(expectedSet, pojo.getSet());
obj = repository.create("constructorMap");
assertTrue(obj instanceof PojoGenerics);
pojo = (PojoGenerics) obj;
assertEquals(expectedMap, pojo.getMap());
obj = repository.create("genericPojo");
assertTrue(obj instanceof Primavera);
assertEquals("string", ((Primavera) obj).prop);
obj = repository.create("doubleGenericPojo");
assertTrue(obj instanceof Primavera);
assertEquals("stringToo", ((Primavera) obj).prop);
}
Aggregations