@Override
    public ServiceReference<?>[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
    	if (filter != null) {
            Collection<ServiceReference<?>> serviceReferences = filteredServiceRegistrations.get(filter);
            if (serviceReferences != null) {
            	return serviceReferences.toArray(new ServiceReference<?>[serviceReferences.size()]);
            }

            return new ServiceReference<?>[0];
    	}

    	// No filter, just return all of the references in the mock.
    	List<ServiceReference<?>> serviceReferences = new ArrayList<ServiceReference<?>>();
    	for (Entry<String, Collection<ServiceReference<?>>> serviceRegistrationEntry : serviceRegistrations.entrySet()) {
            for (ServiceReference<?> serviceRegistration : serviceRegistrationEntry.getValue()) {
                serviceReferences.add(serviceRegistration);
            }
        }

    	return serviceReferences.toArray(new ServiceReference<?>[serviceReferences.size()]);
    }
@ Override public ServiceReference < ? > [ ] getServiceReferences ( String clazz , String filter ) throws InvalidSyntaxException { if ( filter != null ) { Collection < ServiceReference < ? > > serviceReferences = filteredServiceRegistrations . get ( filter ) ; if ( serviceReferences != null ) { return serviceReferences . toArray ( new ServiceReference < ? > [ serviceReferences . size ( ) ] ) ; } return new ServiceReference < ? > [ 0 ] ; } List < ServiceReference < ? > > serviceReferences = new ArrayList < ServiceReference < ? > > ( ) ; for ( Entry < String , Collection < ServiceReference < ? > > > serviceRegistrationEntry : serviceRegistrations . entrySet ( ) ) { for ( ServiceReference < ? > serviceRegistration : serviceRegistrationEntry . getValue ( ) ) { serviceReferences . add ( serviceRegistration ) ; } } return serviceReferences . toArray ( new ServiceReference < ? > [ serviceReferences . size ( ) ] ) ; }
Get all {@link ServiceReference} object matching a class name and a filter.

<p><i>Note:</i> The clazz argument is mpt handled in any way.
If this is needed to make tests run as expected it must be implemented
For now, just return all of the references in the mock.

@param clazz a fully qualified class name
@param filter a filter expression matching a service and its parameters
@return an array of {@link ServiceReference} objects implementing the matching service, or an empty array if none can be found