@Override public RelativeTimeout getTimeout() { return delegate.getTimeout(); }
private void setFrameworkStartLevel() throws RemoteException, ExamConfigurationException { FrameworkStartLevelOption startLevelOption = system.getOption(FrameworkStartLevelOption.class); int startLevel = startLevelOption == null ? START_LEVEL_TEST_BUNDLE : startLevelOption .getStartLevel(); LOG.debug("Jump to startlevel [{}]", startLevel); long timeout = system.getTimeout().getValue(); boolean startLevelReached = remoteFramework.setFrameworkStartLevel(startLevel, timeout); if (!startLevelReached) { String msg = String.format("start level %d has not been reached within %d ms", startLevel, timeout); throw new TestContainerException(msg); } }
private void stopOrAbort() throws BundleException, InterruptedException { framework.stop(); long timeout = system.getTimeout().getValue(); Thread stopper = new Stopper(timeout); stopper.start(); stopper.join(timeout + 500); // If the framework is not stopped, then we're in trouble anyway, so we do not worry // about stopping the worker thread. if (framework.getState() != Bundle.RESOLVED) { String message = "Framework has not yet stopped after " + timeout + " ms. waitForStop did not return"; throw new TestContainerException(message); } }
private void stopOrAbort() throws BundleException, InterruptedException { framework.stop(); long timeout = system.getTimeout().getValue(); Thread stopper = new Stopper(timeout); stopper.start(); stopper.join(timeout + 500); // If the framework is not stopped, then we're in trouble anyway, so we do not worry // about stopping the worker thread. if (framework.getState() != Bundle.RESOLVED) { String message = "Framework has not yet stopped after " + timeout + " ms. waitForStop did not return"; throw new TestContainerException(message); } }
@Override public void runTest(TestDescription description, TestListener listener) { String filterExpression = "(&(objectClass=org.ops4j.pax.exam.ProbeInvoker))"; try { ServerSocket serverSocket = new ServerSocket(port.getPort()); TestListenerTask task = new TestListenerTask(serverSocket, listener); ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit(task); RemoteServiceReference[] references = remoteFramework.getServiceReferences( filterExpression, system.getTimeout().getValue(), TimeUnit.MILLISECONDS); remoteFramework.invokeMethodOnService(references[0], "runTestClass", description.toString()); executor.shutdown(); serverSocket.close(); } catch (InvocationTargetException exc) { LOG.error("", exc.getCause()); throw new TestContainerException(exc.getCause()); } // CHECKSTYLE:SKIP catch (Exception exc) { throw new TestContainerException(exc); } }
+ " millis"); LOGGER.info("Wait for test container to finish its initialization " + subsystem.getTimeout()); Bundle.ACTIVE, subsystem.getTimeout());
+ " millis"); LOGGER.info("Wait for test container to finish its initialization " + subsystem.getTimeout()); Bundle.ACTIVE, subsystem.getTimeout());
long timeout = system.getTimeout().getValue(); if (!latch.await(timeout, TimeUnit.MILLISECONDS)) {
private void setFrameworkStartLevel() throws ExamConfigurationException { FrameworkStartLevel sl = framework.adapt(FrameworkStartLevel.class); final int startLevel = getStartLevel(); LOG.debug("Jump to startlevel: " + startLevel); final CountDownLatch latch = new CountDownLatch(1); framework.getBundleContext().addFrameworkListener(frameworkEvent -> { if (frameworkEvent.getType() == FrameworkEvent.STARTLEVEL_CHANGED) { if (sl.getStartLevel() == startLevel) { LOG.debug("requested start level reached"); latch.countDown(); } else { LOG.debug("start level {} requested, current start level is {}", startLevel, sl.getStartLevel()); } } }); sl.setStartLevel(startLevel); try { long timeout = system.getTimeout().getValue(); if (!latch.await(timeout, TimeUnit.MILLISECONDS)) { String msg = String.format("start level %d has not been reached within %d ms", startLevel, timeout); throw new TestContainerException(msg); } } catch (InterruptedException exc) { throw new TestContainerException(exc); } }
m_target = new RBCRemoteTarget( name, m_reg.getPort(), m_subsystem.getTimeout() ); LOG.info( "Wait for test container to finish its initialization " + ( m_subsystem.getTimeout() ) ); waitForState( SYSTEM_BUNDLE, Bundle.ACTIVE, m_subsystem.getTimeout() );
systemProperty(RMI_NAME_PROPERTY).value(name), systemProperty(EXAM_INJECT_PROPERTY).value("true"))); target = new RBCRemoteTarget(name, port, subsystem.getTimeout()); System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url"); runner.exec(environment, targetDirectory.resolve("wso2").resolve("default"), options); logger.debug("Wait for test container to finish its initialization " + subsystem.getTimeout()); waitForState(0, Bundle.ACTIVE, subsystem.getTimeout()); started = true; } catch (IOException e) {
systemProperty(RMI_NAME_PROPERTY).value(name), systemProperty(EXAM_INJECT_PROPERTY).value("true"))); target = new RBCRemoteTarget(name, port, subsystem.getTimeout()); System.setProperty("java.protocol.handler.pkgs", "org.ops4j.pax.url"); runner.exec(environment, targetDirectory.resolve("wso2").resolve("default"), options); logger.debug("Wait for test container to finish its initialization " + subsystem.getTimeout()); waitForState(0, Bundle.ACTIVE, subsystem.getTimeout()); started = true; } catch (IOException e) {
new KarafDistributionConfigurationConsoleOption(false, true) )); target = new RBCRemoteTarget(name, registry.getPort(), subsystem.getTimeout()); LOGGER.info("Wait for test container to finish its initialization " + subsystem.getTimeout()); Bundle.ACTIVE, subsystem.getTimeout()); } else { LOGGER
editConfigurationFileExtend("etc/system.properties", "jline.shutdownhook", "true"))); target = new RBCRemoteTarget(name, port, subsystem.getTimeout());
editConfigurationFileExtend("etc/system.properties", "jline.shutdownhook", "true"))); target = new RBCRemoteTarget(name, port, invokerPort, subsystem.getTimeout());