1 package org.simantics.scl.osgi.internal;
\r
3 import java.util.Collection;
\r
5 import org.osgi.framework.BundleContext;
\r
6 import org.osgi.util.tracker.ServiceTracker;
\r
7 import org.simantics.scl.compiler.testing.TestRunnable;
\r
8 import org.simantics.scl.compiler.testing.repository.TestRepository;
\r
10 public class ServiceBasedTestRepository implements TestRepository {
\r
12 ServiceTracker<TestRepository, TestRepository> repositories;
\r
14 public ServiceBasedTestRepository(BundleContext context) {
\r
15 repositories = new ServiceTracker<TestRepository, TestRepository>(
\r
16 context, TestRepository.class, null);
\r
17 repositories.open();
\r
21 public void collectTests(Collection<TestRunnable> tests) {
\r
22 Object[] services = repositories.getServices();
\r
23 if(services != null)
\r
24 for(Object repository : services)
\r
25 ((TestRepository)repository).collectTests(tests);
\r