### Question:
CDMRoleSimulator implements RoleSimulator { public List<Role> getModelRoles(Object model) { java.util.List<Role> ret=new java.util.Vector<Role>(); if (model instanceof org.pi4soa.cdl.Package) { java.util.List<ParticipantType> partTypes=((org.pi4soa.cdl.Package)model).getTypeDefinitions().getParticipantTypes(); for (ParticipantType pt : partTypes) { ret.add(getRole(pt)); } @SuppressWarnings("unchecked") java.util.List<Participant> parts=((org.pi4soa.cdl.Package)model).getParticipants(); for (Participant p : parts) { ret.add(getRole(p)); } } return(ret); }  String getName(); boolean isSupported(SimulationModel model); Object getModel(SimulationModel model, ResourceLocator locator); List<Role> getModelRoles(Object model); void initialize(SimulationContext context); Object getModelForRole(Object model, Role role, ResourceLocator locator); void onEvent(SimulationContext context, Event event,
							SimulationHandler handler); void close(SimulationContext context);  }### Answer:
@Test public void testGetModelRoles() { String filename="cdm/PurchaseGoods.cdm"; java.io.InputStream is= ClassLoader.getSystemResourceAsStream(filename); try { SimulationModel sm=new SimulationModel(filename, is); CDMRoleSimulator rsim=new CDMRoleSimulator(); Object model=rsim.getModel(sm, null); java.util.List<Role> roles=rsim.getModelRoles(model); if (roles.size() != 3) { fail("Incorrect number of roles, expecting 3, but got: "+roles.size()); } if (roles.get(0).getName().equals("{http: fail("First role name incorrect"); } if (roles.get(1).getName().equals("{http: fail("Second role name incorrect"); } if (roles.get(2).getName().equals("{http: fail("Third role name incorrect"); } } catch(Exception e) { e.printStackTrace(); fail("Failed to get model roles: "+e); } }