示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testExecutionListenerWithErrorBoundaryEvent()
        public virtual void testExecutionListenerWithErrorBoundaryEvent()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicInteger eventCount = new java.util.concurrent.atomic.AtomicInteger();
            AtomicInteger eventCount = new AtomicInteger();

            EmbeddedProcessApplication processApplication = new EmbeddedProcessApplicationAnonymousInnerClass4(this, eventCount);

            // register app so that it is notified about events
            managementService.registerProcessApplication(deploymentId, processApplication.Reference);

            // 1. (start)startEvent(end) -(take)-> (start)serviceTask(end) -(take)-> (start)endEvent(end) (8 Events)

            // start process instance
            runtimeService.startProcessInstanceByKey("executionListener");

            assertEquals(10, eventCount.get());

            // reset counter
            eventCount.set(0);

            // 2. (start)startEvent(end) -(take)-> (start)serviceTask(end)/(start)errorBoundaryEvent(end) -(take)-> (start)endEvent(end) (10 Events)

            // start process instance
            runtimeService.startProcessInstanceByKey("executionListener", Collections.singletonMap <string, object>("shouldThrowError", true));

            assertEquals(12, eventCount.get());
        }
示例#2
0
        /* ---- single consumer ---- */

        public override void Clear()
        {
            _queue.clear();
            // might go out of sync with queue here, but should be minor slippage.
            // Will not accumulate leaks either, but reset on every clear.
            _size.set(0);
        }
示例#3
0
 public virtual void Reset()
 {
     Hits.set(0);
     Recompilations.set(0);
     Misses.set(0);
     Discards.set(0);
     WaitTime.set(0);
 }
示例#4
0
        private void PeriodicallyPullUpdates()
        {
            while (!_halted)
            {
                int round = _targetTicket.get();
                if (_currentTicket.get() < round)
                {
                    DoPullUpdates();
                    _currentTicket.set(round);
                    continue;
                }

                LockSupport.parkNanos(ParkNanos);
            }
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBlockIfTheWrappedStartIsUnsuccessful() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotBlockIfTheWrappedStartIsUnsuccessful()
        {
            AtomicInteger status = new AtomicInteger();
            AtomicBoolean exited = new AtomicBoolean(false);

            BlockingBootstrapper bootstrapper = new BlockingBootstrapper(new BootstrapperAnonymousInnerClass2(this));

            (new Thread(() =>
            {
                status.set(bootstrapper.Start(HomeDir.directory("home-dir"), null, java.util.Collections.emptyMap()));
                exited.set(true);
            })).Start();

            assertEventually("Blocked unexpectedly", exited.get, @is(true), 10, TimeUnit.SECONDS);
            assertThat("Bootstrapper did not propagate exit status", status.get(), @is(1));
        }
示例#6
0
        public override TraversalBranch Next(TraversalContext metadata)
        {
            TraversalBranch branch        = NextBranchFromCurrentSelector(metadata, false);
            Entry           state         = StateForCurrentSelector;
            AtomicInteger   previousDepth = state.Depth;

            if (branch != null && branch.Length() == previousDepth.get())
            {               // Same depth as previous branch returned from this side.
                return(branch);
            }

            if (branch != null)
            {
                _totalDepth.set(CurrentSide(), branch.Length());
            }
            if ((_stopDescentOnResult && (metadata.NumberOfPathsReturned > 0)) || (_totalDepth.get() > (_maxDepth + 1)))
            {
                NextSelector();
                return(null);
            }

            if (branch != null)
            {
                previousDepth.set(branch.Length());
                state.Branch = branch;
            }
            BranchSelector  otherSelector = NextSelector();
            Entry           otherState    = StateForCurrentSelector;
            TraversalBranch otherBranch   = otherState.Branch;

            if (otherBranch != null)
            {
                otherState.Branch = null;
                return(otherBranch);
            }

            otherBranch = otherSelector.Next(metadata);
            if (otherBranch != null)
            {
                return(otherBranch);
            }
            else
            {
                return(branch);
            }
        }
示例#7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testExecutionListenerWithTimerBoundaryEvent()
        public virtual void testExecutionListenerWithTimerBoundaryEvent()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicInteger eventCount = new java.util.concurrent.atomic.AtomicInteger();
            AtomicInteger eventCount = new AtomicInteger();

            EmbeddedProcessApplication processApplication = new EmbeddedProcessApplicationAnonymousInnerClass5(this, eventCount);

            // register app so that it is notified about events
            managementService.registerProcessApplication(deploymentId, processApplication.Reference);

            // 1. (start)startEvent(end) -(take)-> (start)userTask(end) -(take)-> (start)endEvent(end) (8 Events)

            // start process instance
            runtimeService.startProcessInstanceByKey("executionListener");

            // complete task
            Task task = taskService.createTaskQuery().singleResult();

            taskService.complete(task.Id);

            assertEquals(10, eventCount.get());

            // reset counter
            eventCount.set(0);

            // 2. (start)startEvent(end) -(take)-> (start)userTask(end)/(start)timerBoundaryEvent(end) -(take)-> (start)endEvent(end) (10 Events)

            // start process instance
            runtimeService.startProcessInstanceByKey("executionListener");

            // fire timer event
            Job job = managementService.createJobQuery().singleResult();

            managementService.executeJob(job.Id);

            assertEquals(12, eventCount.get());
        }
示例#8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBlockUntilStoppedIfTheWrappedStartIsSuccessful() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBlockUntilStoppedIfTheWrappedStartIsSuccessful()
        {
            AtomicInteger status  = new AtomicInteger();
            AtomicBoolean exited  = new AtomicBoolean(false);
            AtomicBoolean running = new AtomicBoolean(false);

            BlockingBootstrapper bootstrapper = new BlockingBootstrapper(new BootstrapperAnonymousInnerClass(this, running));

            (new Thread(() =>
            {
                status.set(bootstrapper.Start(HomeDir.directory("home-dir"), null, java.util.Collections.emptyMap()));
                exited.set(true);
            })).Start();

            assertEventually("Wrapped was not started", running.get, @is(true), 10, TimeUnit.SECONDS);
            assertThat("Bootstrapper exited early", exited.get(), @is(false));

            bootstrapper.Stop();

            assertEventually("Wrapped was not stopped", running.get, @is(false), 10, TimeUnit.SECONDS);
            assertEventually("Bootstrapper did not exit", exited.get, @is(true), 10, TimeUnit.SECONDS);
            assertThat("Bootstrapper did not propagate exit status", status.get(), @is(0));
        }
示例#9
0
 public override void joinedCluster(InstanceId member, URI memberUri)
 {
     _port.set(memberUri.Port);
     _latch.Signal();
     _outerInstance.clients[0].removeClusterListener(this);
 }
示例#10
0
 /// <summary>
 /// Resets the id counter so that the next call to <seealso cref="initialValue(int)"/> will get {@code 0}.
 /// </summary>
 public virtual void ResetId()
 {
     _id.set(0);
 }
示例#11
0
 public static void reset()
 {
     invocations.set(0);
 }
示例#12
0
 /// <summary>
 /// Reset state to initial state disregard any current state or number of active clients
 /// </summary>
 public void Reset()
 {
     _clientState.set(INITIAL_STATE);
 }
 public void setLostPingCount(int count)
 {
     lostPingCount.set(count);
 }
 public static void resetId()
 {
     id.set(0);
 }
示例#15
0
 public virtual void AuthSuccess()
 {
     FailedAuthAttempts.set(0);
 }