]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.osgi/src/org/simantics/scl/osgi/internal/ServiceBasedTestRepository.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.osgi / src / org / simantics / scl / osgi / internal / ServiceBasedTestRepository.java
1 package org.simantics.scl.osgi.internal;
2
3 import java.util.Collection;
4
5 import org.osgi.framework.BundleContext;
6 import org.osgi.util.tracker.ServiceTracker;
7 import org.simantics.scl.compiler.testing.TestRunnable;
8 import org.simantics.scl.compiler.testing.repository.TestRepository;
9
10 public class ServiceBasedTestRepository implements TestRepository {
11
12     ServiceTracker<TestRepository, TestRepository> repositories;
13
14     public ServiceBasedTestRepository(BundleContext context) {
15         repositories = new ServiceTracker<TestRepository, TestRepository>(
16                 context, TestRepository.class, null);
17         repositories.open();
18     }
19
20     @Override
21     public void collectTests(Collection<TestRunnable> tests) {
22         Object[] services = repositories.getServices();
23         if(services != null)
24             for(Object repository : services)
25                 ((TestRepository)repository).collectTests(tests);
26     }
27     
28 }