@Test @Rollback(false) public void testRetrieveCISSharedService() throws Exception{ Service s = servicesList.get(0); List<String> cisIdList = serReg.retrieveCISSharedService(s.getServiceIdentifier()); assertTrue(cisIdList.size()==2); Set<String> expectedResults = new HashSet<String>(); expectedResults.add(_cisTestId);expectedResults.add(_cisTestId1); assertTrue(cisIdList.containsAll(expectedResults)); s.getServiceIdentifier().setServiceInstanceIdentifier("not_Existing"); cisIdList = serReg.retrieveCISSharedService(s.getServiceIdentifier()); assertTrue(cisIdList.isEmpty()); }
@Override public List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier) { List<String> returnedServiceList = new ArrayList<String>(); Session session = null; try { session = sessionFactory.openSession(); Criteria c = session.createCriteria(ServiceSharedInCISDAO.class); if (serviceIdentifier != null) { if (serviceIdentifier.getIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.identifier", serviceIdentifier.getIdentifier().toString())); } if (serviceIdentifier.getServiceInstanceIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.instanceId", serviceIdentifier.getServiceInstanceIdentifier())); } } List<ServiceSharedInCISDAO> serviceSharedInCISDAOList = c.list(); for (ServiceSharedInCISDAO serviceSharedInCISDAO : serviceSharedInCISDAOList) { returnedServiceList.add(serviceSharedInCISDAO.getCISId()); } } catch(Exception ex){ log.error("Error RetrievingCISSharedService: " + ex.getMessage()); ex.printStackTrace(); } if(session != null) session.close(); return returnedServiceList; }
ServiceRegistry implements IServiceRegistry { @Override public List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier) { List<String> returnedServiceList = new ArrayList<String>(); Session session = null; try { session = sessionFactory.openSession(); Criteria c = session.createCriteria(ServiceSharedInCISDAO.class); if (serviceIdentifier != null) { if (serviceIdentifier.getIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.identifier", serviceIdentifier.getIdentifier().toString())); } if (serviceIdentifier.getServiceInstanceIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.instanceId", serviceIdentifier.getServiceInstanceIdentifier())); } } List<ServiceSharedInCISDAO> serviceSharedInCISDAOList = c.list(); for (ServiceSharedInCISDAO serviceSharedInCISDAO : serviceSharedInCISDAOList) { returnedServiceList.add(serviceSharedInCISDAO.getCISId()); } } catch(Exception ex){ log.error("Error RetrievingCISSharedService: " + ex.getMessage()); ex.printStackTrace(); } if(session != null) session.close(); return returnedServiceList; } }
ServiceRegistry implements IServiceRegistry { @Override public List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier) { List<String> returnedServiceList = new ArrayList<String>(); Session session = null; try { session = sessionFactory.openSession(); Criteria c = session.createCriteria(ServiceSharedInCISDAO.class); if (serviceIdentifier != null) { if (serviceIdentifier.getIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.identifier", serviceIdentifier.getIdentifier().toString())); } if (serviceIdentifier.getServiceInstanceIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.instanceId", serviceIdentifier.getServiceInstanceIdentifier())); } } List<ServiceSharedInCISDAO> serviceSharedInCISDAOList = c.list(); for (ServiceSharedInCISDAO serviceSharedInCISDAO : serviceSharedInCISDAOList) { returnedServiceList.add(serviceSharedInCISDAO.getCISId()); } } catch(Exception ex){ log.error("Error RetrievingCISSharedService: " + ex.getMessage()); ex.printStackTrace(); } if(session != null) session.close(); return returnedServiceList; } ServiceRegistry(); }
ServiceRegistry implements IServiceRegistry { @Override public List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier) { List<String> returnedServiceList = new ArrayList<String>(); Session session = null; try { session = sessionFactory.openSession(); Criteria c = session.createCriteria(ServiceSharedInCISDAO.class); if (serviceIdentifier != null) { if (serviceIdentifier.getIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.identifier", serviceIdentifier.getIdentifier().toString())); } if (serviceIdentifier.getServiceInstanceIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.instanceId", serviceIdentifier.getServiceInstanceIdentifier())); } } List<ServiceSharedInCISDAO> serviceSharedInCISDAOList = c.list(); for (ServiceSharedInCISDAO serviceSharedInCISDAO : serviceSharedInCISDAOList) { returnedServiceList.add(serviceSharedInCISDAO.getCISId()); } } catch(Exception ex){ log.error("Error RetrievingCISSharedService: " + ex.getMessage()); ex.printStackTrace(); } if(session != null) session.close(); return returnedServiceList; } ServiceRegistry(); @Override void registerServiceList(List<Service> servicesList); @Override void unregisterServiceList(List<Service> servicesList); @Override List<Service> retrieveServicesInCSSNode(String CSSID); @Override List<Service> retrieveServicesInCSS(String CSSID); @Override List<Service> retrieveServicesSharedByCIS(String CISID); @Override List<Service> findServices(Service filter); @Override List<Service> findServices(Service filter, String cisId); @Override void notifyServiceIsSharedInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override void removeServiceSharingInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override Service retrieveService(ServiceResourceIdentifier serviceIdentifier); @Override boolean changeStatusOfService(
			ServiceResourceIdentifier serviceIdentifier,
			ServiceStatus serviceStatus); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); @Override boolean deleteServiceCSS(String CSSId); @Override boolean clearServiceSharedCIS(String CISId); @Override boolean updateRegisteredService(Service service); @Override List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier); }
ServiceRegistry implements IServiceRegistry { @Override public List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier) { List<String> returnedServiceList = new ArrayList<String>(); Session session = null; try { session = sessionFactory.openSession(); Criteria c = session.createCriteria(ServiceSharedInCISDAO.class); if (serviceIdentifier != null) { if (serviceIdentifier.getIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.identifier", serviceIdentifier.getIdentifier().toString())); } if (serviceIdentifier.getServiceInstanceIdentifier() != null) { c.add(Restrictions.like("serviceResourceIdentifier.instanceId", serviceIdentifier.getServiceInstanceIdentifier())); } } List<ServiceSharedInCISDAO> serviceSharedInCISDAOList = c.list(); for (ServiceSharedInCISDAO serviceSharedInCISDAO : serviceSharedInCISDAOList) { returnedServiceList.add(serviceSharedInCISDAO.getCISId()); } } catch(Exception ex){ log.error("Error RetrievingCISSharedService: " + ex.getMessage()); ex.printStackTrace(); } if(session != null) session.close(); return returnedServiceList; } ServiceRegistry(); @Override void registerServiceList(List<Service> servicesList); @Override void unregisterServiceList(List<Service> servicesList); @Override List<Service> retrieveServicesInCSSNode(String CSSID); @Override List<Service> retrieveServicesInCSS(String CSSID); @Override List<Service> retrieveServicesSharedByCIS(String CISID); @Override List<Service> findServices(Service filter); @Override List<Service> findServices(Service filter, String cisId); @Override void notifyServiceIsSharedInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override void removeServiceSharingInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override Service retrieveService(ServiceResourceIdentifier serviceIdentifier); @Override boolean changeStatusOfService(
			ServiceResourceIdentifier serviceIdentifier,
			ServiceStatus serviceStatus); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); @Override boolean deleteServiceCSS(String CSSId); @Override boolean clearServiceSharedCIS(String CISId); @Override boolean updateRegisteredService(Service service); @Override List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier);  }