Esempio n. 1
0
        public void BenchmarkDeleteScheduleItems()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);
            HermesActivity      activity      = client.CreateActivity("Test", activityType);

            HermesScheduleItem[] items = new HermesScheduleItem[StressTestsHelper.Iteration];

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                // Create the item
                items[i] = client.CreateScheduleItem(DateTime.Today, activity);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                IList <string> ids = new List <string>();
                ids.Add(items[i].Id);

                // Delete the items.
                client.DeleteScheduleItems(ids);
            }
            StressTestsHelper.Stop("DeleteScheduleItems");
        }
Esempio n. 2
0
        public void BenchmarkSaveScheduleItems()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);
            HermesActivity      activity      = client.CreateActivity("Test", activityType);

            // Create the item
            HermesScheduleItem item = client.CreateScheduleItem(DateTime.Today, activity);

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                item.Duration = i;

                IList <HermesScheduleItem> items = new List <HermesScheduleItem>();
                items.Add(item);

                // Save the item.
                IList <HermesScheduleItem> result = client.SaveScheduleItems(items);

                // Verify the result.
                Assert.IsNotNull(result, "Should not be null.");
            }
            StressTestsHelper.Stop("SaveScheduleItems");
        }
Esempio n. 3
0
 public void BenchmarkCreateActivityGroup()
 {
     StressTestsHelper.Start();
     for (int i = 0; i < StressTestsHelper.Iteration; i++)
     {
         HermesActivityGroup activityGroup = client.CreateActivityGroup("AG" + i);
         Assert.IsNotNull(activityGroup, "activityGroup should have been created.");
     }
     StressTestsHelper.Stop("CreateActivityGroup");
 }
Esempio n. 4
0
 public void BenchmarkCreateScheduleItemRequestStatus()
 {
     StressTestsHelper.Start();
     for (int i = 0; i < StressTestsHelper.Iteration; i++)
     {
         HermesScheduleItemRequestStatus status = client.CreateScheduleItemRequestStatus("S" + i, "Status" + i);
         Assert.IsNotNull(status, "status should have been created.");
     }
     StressTestsHelper.Stop("CreateScheduleItemRequestStatus");
 }
Esempio n. 5
0
        public void BenchmarkCreateActivityType()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesActivityType activityType = client.CreateActivityType("AT" + i, activityGroup);
                Assert.IsNotNull(activityType, "activityType should have been created.");
            }
            StressTestsHelper.Stop("CreateActivityType");
        }
Esempio n. 6
0
        public void BenchmarkGetScheduleItemRequestStatus()
        {
            HermesScheduleItemRequestStatus status = client.CreateScheduleItemRequestStatus("S1", "Status1");

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesScheduleItemRequestStatus result = client.GetScheduleItemRequestStatus(status.Id);
                Assert.IsNotNull(result, "result should have been created.");
            }
            StressTestsHelper.Stop("GetScheduleItemRequestStatus");
        }
Esempio n. 7
0
        public void BenchmarkGetActivityGroup()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesActivityGroup result = client.GetActivityGroup(activityGroup.Id);
                Assert.IsNotNull(result, "result should have been retrieved.");
            }
            StressTestsHelper.Stop("GetActivityGroup");
        }
Esempio n. 8
0
        public void BenchmarkGetActivityType()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesActivityType result = client.GetActivityType(activityType.Id);
                Assert.IsNotNull(result, "result should have been created.");
            }
            StressTestsHelper.Stop("GetActivityType");
        }
Esempio n. 9
0
        public void TearDown()
        {
            try
            {
                scope.Complete();
                scope.Dispose();
            }
            catch
            {
                // This is required for failure tests
            }

            StressTestsHelper.ClearTestDatabase();
        }
Esempio n. 10
0
        public void BenchmarkGetAllScheduleItemRequestStatuses()
        {
            for (int i = 0; i < 10; i++)
            {
                client.CreateScheduleItemRequestStatus("S" + i, "Status" + i);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                IList <HermesScheduleItemRequestStatus> result = client.GetAllScheduleItemRequestStatuses();
                Assert.IsNotNull(result, "result should have been created.");
            }
            StressTestsHelper.Stop("GetAllScheduleItemRequestStatuses");
        }
Esempio n. 11
0
        public void BenchmarkGetAllActivityGroups()
        {
            for (int i = 0; i < 10; i++)
            {
                client.CreateActivityGroup("AG" + i);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                IList <HermesActivityGroup> result = client.GetAllActivityGroups();
                Assert.IsNotNull(result, "result should have been retrieved.");
            }
            StressTestsHelper.Stop("GetAllActivityGroups");
        }
Esempio n. 12
0
        public void BenchmarkDeleteScheduleItemStatus()
        {
            HermesScheduleItemStatus[] statuses = new HermesScheduleItemStatus[StressTestsHelper.Iteration];

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                statuses[i] = client.CreateScheduleItemStatus("S" + i, "Status" + i);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                client.DeleteScheduleItemStatus(statuses[i].Id);
            }
            StressTestsHelper.Stop("DeleteScheduleItemStatus");
        }
Esempio n. 13
0
        public void BenchmarkDeleteActivityGroup()
        {
            HermesActivityGroup[] activityGroups = new HermesActivityGroup[StressTestsHelper.Iteration];

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                activityGroups[i] = client.CreateActivityGroup("AG" + i);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                client.DeleteActivityGroup(activityGroups[i].Id);
            }
            StressTestsHelper.Stop("DeleteActivityGroup");
        }
Esempio n. 14
0
        public void BenchmarkSaveScheduleItemStatus()
        {
            HermesScheduleItemStatus[] statuses = new HermesScheduleItemStatus[StressTestsHelper.Iteration];

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                statuses[i]             = client.CreateScheduleItemStatus("S" + i, "Status" + i);
                statuses[i].Description = "NewStatus" + i;
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesScheduleItemStatus result = client.SaveScheduleItemStatus(statuses[i]);
            }
            StressTestsHelper.Stop("SaveScheduleItemStatus");
        }
Esempio n. 15
0
        public void BenchmarkGetAllActivityTypes()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");

            for (int i = 0; i < 10; i++)
            {
                client.CreateActivityType("AT" + i, activityGroup);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                IList <HermesActivityType> result = client.GetAllActivityTypes();
                Assert.IsNotNull(result, "result should have been created.");
            }
            StressTestsHelper.Stop("GetAllActivityTypes");
        }
Esempio n. 16
0
        public void BenchmarkDeleteActivity()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);

            HermesActivity[] activities = new HermesActivity[StressTestsHelper.Iteration];
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                activities[i] = client.CreateActivity("Test", activityType);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                client.DeleteActivity(activities[i].Id);
            }
            StressTestsHelper.Stop("DeleteActivity");
        }
Esempio n. 17
0
        public void BenchmarkCreateScheduleItem()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);
            HermesActivity      activity      = client.CreateActivity("Test", activityType);

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                // Create the item
                HermesScheduleItem item = client.CreateScheduleItem(DateTime.Today, activity);

                // Verify the result.
                HermesScheduleItem result = client.GetScheduleItem(item.Id);

                Assert.IsNotNull(result, "HermesScheduleItem gotten should not be null.");
            }
            StressTestsHelper.Stop("CreateScheduleItem");
        }
Esempio n. 18
0
        public void BenchmarkSaveScheduleItemRequestStatus()
        {
            HermesScheduleItemRequestStatus[] statuses =
                new HermesScheduleItemRequestStatus[StressTestsHelper.Iteration];

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                statuses[i]             = client.CreateScheduleItemRequestStatus("S" + i, "Status" + i);
                statuses[i].Description = "NewDesc" + i;
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesScheduleItemRequestStatus result = client.SaveScheduleItemRequestStatus(statuses[i]);
                Assert.IsNotNull(result, "Should not be null.");
            }
            StressTestsHelper.Stop("SaveScheduleItemRequestStatus");
        }
Esempio n. 19
0
        public void SetUp()
        {
            // Setup some reference data in the DB
            StressTestsHelper.ClearTestDatabase();
            StressTestsHelper.SetupTestDatabase();

            // Create Message Headers
            CreateMessageHeaders();

            HermesAuthorizationMediator.Configuration = StressTestsHelper.CreateMediatorConfig();

            // Open transaction for calls from service
            TransactionOptions options = new TransactionOptions();

            options.IsolationLevel = IsolationLevel.RepeatableRead;
            scope = new TransactionScope(TransactionScopeOption.RequiresNew, options);

            // Get some entities already present in database. These are used by the tests.
            CreateReferenceEntities();
        }
Esempio n. 20
0
        public void BenchmarkSaveActivity()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);

            HermesActivity[] activities = new HermesActivity[StressTestsHelper.Iteration];
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                activities[i] = client.CreateActivity("Test" + i, activityType);
                activities[i].Abbreviation = "abbr" + i;
                activities[i].ActivityType = activityType;
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                HermesActivity activity = client.SaveActivity(activities[i]);
                Assert.IsNotNull(activity, "Should not be null.");
            }
            StressTestsHelper.Stop("SaveActivity");
        }
Esempio n. 21
0
        public void BenchmarkGetScheduleItemEditCopy()
        {
            HermesActivityGroup activityGroup = client.CreateActivityGroup("AG1");
            HermesActivityType  activityType  = client.CreateActivityType("AT1", activityGroup);
            HermesActivity      activity      = client.CreateActivity("Test", activityType);

            HermesScheduleItem[] items  = new HermesScheduleItem[StressTestsHelper.Iteration];
            HermesScheduleItem   parent = client.CreateScheduleItem(DateTime.Today, activity);

            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                // Create the item
                items[i] = client.CreateScheduleItemEditCopy(parent);
            }

            StressTestsHelper.Start();
            for (int i = 0; i < StressTestsHelper.Iteration; i++)
            {
                client.GetScheduleItemEditCopy(parent);
            }
            StressTestsHelper.Stop("GetScheduleItemEditCopy");
        }
Esempio n. 22
0
        public void TestFixtureSetUp()
        {
            StressTestsHelper.LoadConfiguration();

            // Create service for direct testing
            service = new HermesScheduleItemService();

            // Host the HermesScheduleItemService
            HostHermesScheduleItemServiceAndOpenClient();

            // Host the HermesAuditTrailSaveService
            HostHermesAuditTrailSaveService();

            // Host the HermesAuditTrailRetrieveService
            HostHermesAuditTrailRetrieveServiceAndOpenClient();

            // Host the GenericNoteService
            HostGenericNoteServiceAndOpenClient();

            // Host the HermesAuthorizationService
            HostAuthService();
        }