Beispiel #1
0
        public virtual void testQueryByOccurredAfterAndOccurredBefore()
        {
            // given
            DateTime startTime = new DateTime();

            ClockUtil.CurrentTime = startTime;

            DateTime hourAgo = new DateTime();

            hourAgo.AddHours(-1);
            DateTime hourFromNow = new DateTime();

            hourFromNow.AddHours(1);

            IDictionary <string, object> variables = new Dictionary <string, object>();

            variables["stringVar"] = "test";
            runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery();

            // then
            assertEquals(0, query.occurredAfter(hourFromNow).occurredBefore(hourFromNow).count());
            assertEquals(1, query.occurredAfter(hourAgo).occurredBefore(hourFromNow).count());
            assertEquals(0, query.occurredAfter(hourFromNow).occurredBefore(hourAgo).count());
            assertEquals(0, query.occurredAfter(hourAgo).occurredBefore(hourAgo).count());
        }
Beispiel #2
0
        public virtual void testQueryByInvalidOccurredAfterDate()
        {
            // given
            IDictionary <string, object> variables1 = new Dictionary <string, object>();

            variables1["stringVar"] = "test";
            runtimeService.startProcessInstanceByKey(PROCESS_KEY, variables1);

            // when
            HistoricDetailQuery query = historyService.createHistoricDetailQuery();

            try
            {
                // when
                query.occurredAfter(null);
                fail("A ProcessEngineException was expected.");
            }
            catch (ProcessEngineException)
            {
                // then fails
            }
        }