@Test public void testGetSupportedModel() { 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); if (model == null) { fail("No model returned"); } if ((model instanceof org.pi4soa.cdl.Package) == false) { fail("Model not cdl package: "+model); } } catch(Exception e) { e.printStackTrace(); fail("Failed to get supported model: "+e); } }
public Object getModel(SimulationModel model, ResourceLocator locator) { Object ret=null; if (model.getName().endsWith(CDM_FILE_EXTENSION)) { try { ret = CDLManager.load(model.getContents()); } catch(Exception e) { logger.log(Level.SEVERE, "Failed to load CDM model", e); } } return(ret); }
CDMRoleSimulator implements RoleSimulator { public Object getModel(SimulationModel model, ResourceLocator locator) { Object ret=null; if (model.getName().endsWith(CDM_FILE_EXTENSION)) { try { ret = CDLManager.load(model.getContents()); } catch(Exception e) { logger.log(Level.SEVERE, "Failed to load CDM model", e); } } return(ret); } }
CDMRoleSimulator implements RoleSimulator { public Object getModel(SimulationModel model, ResourceLocator locator) { Object ret=null; if (model.getName().endsWith(CDM_FILE_EXTENSION)) { try { ret = CDLManager.load(model.getContents()); } catch(Exception e) { logger.log(Level.SEVERE, "Failed to load CDM model", e); } } return(ret); }  }
CDMRoleSimulator implements RoleSimulator { public Object getModel(SimulationModel model, ResourceLocator locator) { Object ret=null; if (model.getName().endsWith(CDM_FILE_EXTENSION)) { try { ret = CDLManager.load(model.getContents()); } catch(Exception e) { logger.log(Level.SEVERE, "Failed to load CDM model", e); } } 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); }
CDMRoleSimulator implements RoleSimulator { public Object getModel(SimulationModel model, ResourceLocator locator) { Object ret=null; if (model.getName().endsWith(CDM_FILE_EXTENSION)) { try { ret = CDLManager.load(model.getContents()); } catch(Exception e) { logger.log(Level.SEVERE, "Failed to load CDM model", e); } } 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);  }