@Test public void testGetAllServicesForInstance() { GenericQueryResults.Builder<ServiceInfoBo> resultBuilder = GenericQueryResults.Builder.<ServiceInfoBo>create(); for (int i = 0; i < 5; i++) { resultBuilder.getResults().add(createServiceInfo("service" + i)); } when(dataObjectService.findMatching(eq(ServiceInfoBo.class), any(QueryByCriteria.class))).thenReturn(resultBuilder.build()); List<ServiceInfo> serviceInfos = serviceRegistry.getAllServicesForInstance("MyInstance"); assertEquals(5, serviceInfos.size()); }
@Override public List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException { if (StringUtils.isBlank(instanceId)) { throw new RiceIllegalArgumentException("instanceId cannot be blank"); } QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); builder.setPredicates(equal("instanceId",instanceId)); List<ServiceInfoBo> serviceInfoBos = getDataObjectService().findMatching( ServiceInfoBo.class,builder.build()).getResults(); return convertServiceInfoBoList(serviceInfoBos); }
ServiceRegistryImpl implements ServiceRegistry { @Override public List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException { if (StringUtils.isBlank(instanceId)) { throw new RiceIllegalArgumentException("instanceId cannot be blank"); } QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); builder.setPredicates(equal("instanceId",instanceId)); List<ServiceInfoBo> serviceInfoBos = getDataObjectService().findMatching( ServiceInfoBo.class,builder.build()).getResults(); return convertServiceInfoBoList(serviceInfoBos); } }
ServiceRegistryImpl implements ServiceRegistry { @Override public List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException { if (StringUtils.isBlank(instanceId)) { throw new RiceIllegalArgumentException("instanceId cannot be blank"); } QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); builder.setPredicates(equal("instanceId",instanceId)); List<ServiceInfoBo> serviceInfoBos = getDataObjectService().findMatching( ServiceInfoBo.class,builder.build()).getResults(); return convertServiceInfoBoList(serviceInfoBos); }  }
ServiceRegistryImpl implements ServiceRegistry { @Override public List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException { if (StringUtils.isBlank(instanceId)) { throw new RiceIllegalArgumentException("instanceId cannot be blank"); } QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); builder.setPredicates(equal("instanceId",instanceId)); List<ServiceInfoBo> serviceInfoBos = getDataObjectService().findMatching( ServiceInfoBo.class,builder.build()).getResults(); return convertServiceInfoBoList(serviceInfoBos); }  @Override List<ServiceInfo> getOnlineServicesByName(QName serviceName); @Override List<ServiceInfo> getAllOnlineServices(); @Override List<ServiceInfo> getAllServices(); @Override List<ServiceInfo> getAllServicesForInstance(String instanceId); @Override List<ServiceInfo> getAllServicesForApplication(String applicationId); @Override ServiceDescriptor getServiceDescriptor(String serviceDescriptorId); @Override List<ServiceDescriptor> getServiceDescriptors(List<String> serviceDescriptorIds); @Override ServiceEndpoint publishService(ServiceEndpoint serviceEndpoint); @Override List<ServiceEndpoint> publishServices(List<ServiceEndpoint> serviceEndpoints); @Override ServiceEndpoint removeServiceEndpoint(String serviceId); @Override List<ServiceEndpoint> removeServiceEndpoints(List<String> serviceIds); @Override RemoveAndPublishResult removeAndPublish(List<String> removeServiceIds,
			List<ServiceEndpoint> publishServiceEndpoints); @Override boolean updateStatus(String serviceId, ServiceEndpointStatus status); @Override List<String> updateStatuses(List<String> serviceIds, ServiceEndpointStatus status); @Override void takeInstanceOffline(String instanceId); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ServiceRegistryImpl implements ServiceRegistry { @Override public List<ServiceInfo> getAllServicesForInstance(String instanceId) throws RiceIllegalArgumentException { if (StringUtils.isBlank(instanceId)) { throw new RiceIllegalArgumentException("instanceId cannot be blank"); } QueryByCriteria.Builder builder = QueryByCriteria.Builder.create(); builder.setPredicates(equal("instanceId",instanceId)); List<ServiceInfoBo> serviceInfoBos = getDataObjectService().findMatching( ServiceInfoBo.class,builder.build()).getResults(); return convertServiceInfoBoList(serviceInfoBos); }  @Override List<ServiceInfo> getOnlineServicesByName(QName serviceName); @Override List<ServiceInfo> getAllOnlineServices(); @Override List<ServiceInfo> getAllServices(); @Override List<ServiceInfo> getAllServicesForInstance(String instanceId); @Override List<ServiceInfo> getAllServicesForApplication(String applicationId); @Override ServiceDescriptor getServiceDescriptor(String serviceDescriptorId); @Override List<ServiceDescriptor> getServiceDescriptors(List<String> serviceDescriptorIds); @Override ServiceEndpoint publishService(ServiceEndpoint serviceEndpoint); @Override List<ServiceEndpoint> publishServices(List<ServiceEndpoint> serviceEndpoints); @Override ServiceEndpoint removeServiceEndpoint(String serviceId); @Override List<ServiceEndpoint> removeServiceEndpoints(List<String> serviceIds); @Override RemoveAndPublishResult removeAndPublish(List<String> removeServiceIds,
			List<ServiceEndpoint> publishServiceEndpoints); @Override boolean updateStatus(String serviceId, ServiceEndpointStatus status); @Override List<String> updateStatuses(List<String> serviceIds, ServiceEndpointStatus status); @Override void takeInstanceOffline(String instanceId); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }