/** * Invoked when a test method finishes (whether passing or failing) */ protected void finished(Description description) { try { taskContext.pop(); } catch (Exception ex) { // ignore } }
/** * Creates a new actor task context and pushes it to the current thread context stack. * * @return the new execution context */ public static ActorTaskContext pushNew() { final ActorTaskContext context = new ActorTaskContext(); context.push(); return context; }
public ActorTaskContext cloneContext() { ActorTaskContext tc = new ActorTaskContext(); tc.actor = actor; tc.runtime = runtime; tc.properties().putAll(properties()); return tc; }
final ActorTaskContext oldContext = ActorTaskContext.current(); final ActorTaskContext context = oldContext != null ? oldContext.cloneContext() : new ActorTaskContext(); context.setProperty(ORBIT_TRANSACTION_ID, transactionId); final Transaction transaction = Actor.getReference(Transaction.class, transactionId); context.push(); if (oldContext == null) context.pop();
protected void starting(Description description) { logger = loggerExtension.getLogger(description.getMethodName()); taskContext.push(); taskContext.setProperty(TEST_NAME_PROP, description.getMethodName()); taskContext.setProperty(ActorBaseTest.class.getName(), description); testDescription = description; }
/** * Sets the runtime associated with the current thread. * <p> * It also tries to set the static runtime if the previous one got garbage collected. * </p> * <p> It's not necessary to "unset" the runtime because: * <ol> * <li>there should normally exist only one (only test cases are expected to have more than one)</li> * <li>it is already a weak reference</li> * <li>if another runtime is using the same thread later (shared thread pools) it will set the runtime before each usage</li> * </ol></p> * * @param runtimeRef a reference to the runtime */ public static void setRuntime(final WeakReference<? extends BasicRuntime> runtimeRef) { if (runtimeRef.get() instanceof ActorRuntime) { final ActorTaskContext context = ActorTaskContext.current(); if (context != null) { context.setRuntime((ActorRuntime) runtimeRef.get()); } } currentRuntime.set(runtimeRef); lastRuntime = runtimeRef; }
final ActorTaskContext context = ActorTaskContext.current(); if (context != null) final ActorRuntime runtime = context.getRuntime(); if (runtime != null)
protected void starting(Description description) { logger = loggerExtension.getLogger(description.getMethodName()); taskContext.push(); taskContext.setProperty(TEST_NAME_PROP, description.getMethodName()); taskContext.setProperty(ActorBaseTest.class.getName(), description); testDescription = description; }
private String getFrom(final RemoteReference reference, final Method method) final ActorTaskContext context = ActorTaskContext.current(); String from; if (context != null && context.getActor() != null) final RemoteReference contextReference = RemoteReference.from(context.getActor()); from = RemoteReference.getInterfaceClass(contextReference).getSimpleName() + ":"
/** * Invoked when a test method finishes (whether passing or failing) */ protected void finished(Description description) { try { taskContext.pop(); } catch (Exception ex) { // ignore } }
private String getFrom(final RemoteReference reference, final Method method) final ActorTaskContext context = ActorTaskContext.current(); String from; if (context != null && context.getActor() != null) final RemoteReference contextReference = RemoteReference.from(context.getActor()); from = RemoteReference.getInterfaceClass(contextReference).getSimpleName() + ":"