/** * Builds the probe. * * @param probe The probe builder. * @return The probe builder. */ @ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader(Constants.IMPORT_PACKAGE, "*,org.apache.ignite.osgi.activators;resolution:=\"optional\""); return probe; }
TestAddress address = probe.addTest(testClass, s.getMethod().getName(), index); manager.storeTestMethod(address, s);
/** * Lazily creates a probe builder. The same probe builder will be reused for all test classes, * unless the default builder is overridden in a given class. * * @param testClassInstance instance of test class * @return probe builder * @throws IOException when probe cannot be created * @throws ExamConfigurationException when user-defined probe cannot be created */ public TestProbeBuilder createProbeBuilder(Object testClassInstance) throws IOException, ExamConfigurationException { if (defaultProbeBuilder == null) { defaultProbeBuilder = system.createProbe(); } TestProbeBuilder probeBuilder = overwriteWithUserDefinition(currentTestClass, testClassInstance); if (probeBuilder.getTempDir() == null) { probeBuilder.setTempDir(defaultProbeBuilder.getTempDir()); } return probeBuilder; }
@Override public void runTest(TestDescription description, TestListener listener) throws Exception { assert (description != null) : "TestDescription must not be null."; if (description.getMethodName() == null) { return; } TestContainer container = testContainers.get(0); TestProbeBuilder probeBuilder = probes.get(0); container.start(); container.installProbe(probeBuilder.build().getStream()); try { container.runTest(description, listener); } finally { container.stop(); } } }
address = probe.addTest(testClass, s.getMethod().getName());
@Override public void beforeSuite() { for (TestContainer container : testContainers) { try { container.start(); } catch (IOException e1) { new TestContainerException("start of container failed", e1); } for (TestProbeBuilder builder : probes) { LOG.debug("installing probe " + builder); try { container.installProbe(builder.build().getStream()); } catch (IOException e) { throw new TestContainerException("Unable to build the probe.", e); } } } }
probe.setHeader( Constants.BUNDLE_ACTIVATOR, "org.hibernate.osgi.test.client.OsgiTestActivator" ); return probe;
public static void addAllClassesInSameAndSubPackageOfPackage(TestProbeBuilder probe, String packageName) { getClasses(ReflectionUtil.class.getClassLoader(), packageName).forEach(eachClass -> probe.addTest(eachClass)); }
public void setUp() { for (TestContainer container : targetContainer) { try { container.start(); } catch (IOException e1) { throw new TestContainerException("Test-Container Setup failed", e1); } for (TestProbeBuilder builder : probes) { LOG.debug("installing probe " + builder); try { container.installProbe(builder.build().getStream()); } catch (IOException e) { throw new TestContainerException("Unable to build the probe.", e); } } } }
@ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader("Service-Component", "OSGI-INF/com.liveops.examples.osgi.helloworld.internal.HelloImpl.xml"); return probe; }
/** * Adds all tests of the suite to the reactor and creates a probe builder. * <p> * TODO This driver currently assumes that all test classes of the suite use the default probe * builder. It builds one probe containing all tests of the suite. This is why the * testClassInstance argument is just an arbitrary instance of one of the classes of the suite. * * @param reactor * unstaged reactor * @param testClassInstance * not used * @param testMethods * all methods of the suite. * @throws IOException * @throws ExamConfigurationException */ private void addTestsToReactor(ExamReactor reactor, Object testClassInstance, List<ITestNGMethod> testMethods) throws IOException, ExamConfigurationException { TestProbeBuilder probe = manager.createProbeBuilder(testClassInstance); probe.addTest(testClassInstance.getClass()); reactor.addProbe(probe); }
@ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { //make sure the needed imports are there. probe.setHeader(Constants.IMPORT_PACKAGE, "*,"+BENCHMARK_LIST); return probe; }
/** * Adds test methods to the reactor, mapping method names to test addresses which are used by * the probe invoker. * <p> * Note that when a collection of test classes is passed to an external JUnit runner like * Eclipse or Maven Surefire, this method is invoked (via the constructor of this runner) for * each class <em>before</em> the {@link #run(RunNotifier)} method is invoked for any class. * <p> * This way, we can register all test methods in the reactor before the actual test execution * starts. * * @param reactor * @param testClassInstance * @throws IOException * @throws ExamConfigurationException */ private void addTestsToReactor(ExamReactor reactor, Object testClassInstance) throws IOException, ExamConfigurationException { TestProbeBuilder probe = manager.createProbeBuilder(testClassInstance); probe.addTest(testClass); reactor.addProbe(probe); }
probe.addTest(testClass);
/** * This {@link ProbeBuilder} can be used to add OSGi metadata to the test * probe bundle. We only use it to give the bundle a nice human-readable name * of "org.opennms.core.test.karaf.test". */ @ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader(Constants.BUNDLE_MANIFESTVERSION, "2"); probe.setHeader(Constants.BUNDLE_SYMBOLICNAME, "org.opennms.core.test.karaf.test"); //probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "org.opennms.core.test.karaf,*,org.apache.felix.service.*;status=provisional"); return probe; }
/** * Adds all tests of the suite to the reactor and creates a probe builder. * <p> * TODO This driver currently assumes that all test classes of the suite use the default probe * builder. It builds one probe containing all tests of the suite. This is why the * testClassInstance argument is just an arbitrary instance of one of the classes of the suite. * * @param reactor * unstaged reactor * @param testClassInstance * not used * @param testMethods * all methods of the suite. * @throws IOException * @throws ExamConfigurationException */ private void addTestsToReactor(ExamReactor reactor, Object testClassInstance, List<ITestNGMethod> testMethods) throws IOException, ExamConfigurationException { TestProbeBuilder probe = manager.createProbeBuilder(testClassInstance); for (ITestNGMethod m : testMethods) { TestAddress address = probe.addTest(m.getRealClass(), m.getMethodName()); manager.storeTestMethod(address, m); } reactor.addProbe(probe); }
@ProbeBuilder public TestProbeBuilder configureTestBundle(TestProbeBuilder probe) { // this is necessary for the generated test bundle to access OSGi services in the container probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*,org.ojbc.*;status=provisional"); return probe; }
/** * This is used to customize the Probe that will contain the test. * We need to enable dynamic import of provisional bundles, to use the Console. * * @param probe * @return */ @ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional"); return probe; }
@ProbeBuilder public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) { probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional"); return probe; }