Esempio n. 1
0
        static void Main(string[] args)
        {
            Uri oDataUri = new Uri(ODataEntityPath, UriKind.Absolute);
            var context  = new Resources(oDataUri);


            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };


            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });

            StreamWriter stream = File.CreateText(filePath);

            stream.WriteLine("Entity, TestType, Workload, Duration");
            stream.Flush();
            stream.Close();

            Console.WriteLine("Connected To " + ClientConfiguration.Default.UriString);

            SalesValues values;

            int loopCount = 100;

            Stopwatch sw = new Stopwatch();

            values = SalesOrderHeaderV2Tester.getRandomCombination();

            for (int i = 0; i < loopCount; i++)
            {
                SalesOrderHeaderV2Tester.createAndDeleteWithSimpleEntity(context, filePath, SalesOrderTester.TestType.Repetitive, SalesOrderTester.TestWorkload.DeleteSimple, "USMF", "US-010");
            }

            for (int i = 0; i < loopCount; i++)
            {
                SalesOrderHeaderV2Tester.createAndDeleteWithCompoundEntity(context, filePath, SalesOrderTester.TestType.Repetitive, SalesOrderTester.TestWorkload.DeleteCompound, "USMF", "US-010");
            }

            for (int i = 0; i < loopCount; i++)
            {
                SalesOrderHeaderV2Tester.createAndDeleteWithSingleEntity(context, filePath, SalesOrderTester.TestType.Repetitive, SalesOrderTester.TestWorkload.DeleteSingle, "USMF", "US-010");
            }

            Console.WriteLine("Complete. Press enter.");
            Console.ReadLine();
        }
        static void CallChildThread(Resources context, ref Logger logger, int threadCount)
        {
            string      x = "";
            SalesValues values;
            int         loopCount = 100;

            List <String> logs = new List <string>();

            int threadId = Thread.CurrentThread.ManagedThreadId;

            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };

            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });


            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                logs.Add(SalesOrderHeaderV2Tester.runOneReadThread(context, threadCount, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadThread, values.SalesId, values.DataAreaId));
            }


            logger.addList(logs);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Uri oDataUri = new Uri(ODataEntityPath, UriKind.Absolute);
            var context  = new Resources(oDataUri);

            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };


            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });



            StreamWriter stream = File.CreateText(filePath);

            stream.WriteLine("Entity,TestType, Workload, Duration");
            stream.Flush();
            stream.Close();

            Console.WriteLine("Warming....");
            context.SalesOrderHeadersV2.FirstOrDefault();
            context.SalesOrderHeadersV2EntityDSReadOnly.FirstOrDefault();
            context.SalesOrderHeadersV2EntityOnlySalesTable.FirstOrDefault();
            context.SalesOrderHeadersV2EntityReadOnly.FirstOrDefault();
            context.SalesOrderHeadersV2EntityReadOnlyNoGlobalization.FirstOrDefault();
            context.SalesOrderHeaderV2ExistAddrReadOnlys.FirstOrDefault();
            context.AAXSalesTables.FirstOrDefault();
            context.AAXSalesTablesReadOnly.FirstOrDefault();


            Console.WriteLine("Starting...");

            SalesValues values;

            #region SalesOrderHeaderV2 Tests
            Console.WriteLine("Starting SalesOrderHeaderV2 Tests");
            //random read
            for (int i = 0; i < 100; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneReadCustomThrottling(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read, values.SalesId, values.DataAreaId);
            }

            #endregion

            #region SalesOrderheaderV2ReadOnly Tests
            Console.WriteLine("Starting SalesOrderheaderV2ReadOnly Tests");
            //random read
            for (int i = 0; i < 100; i++)
            {
                values = SalesOrderHeaderV2EntityReadOnlyTester.getRandomCombination();
                SalesOrderHeaderV2EntityReadOnlyTester.runOneRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read, values.SalesId, values.DataAreaId);
            }

            #endregion


            Console.WriteLine("Complete. Press enter.");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Uri oDataUri = new Uri(ODataEntityPath, UriKind.Absolute);
            var context  = new Resources(oDataUri);


            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };


            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });


            StreamWriter stream = File.CreateText(filePath);

            stream.WriteLine("Entity,TestType, Workload, Duration");
            stream.Flush();
            stream.Close();

            Console.WriteLine("Connected To " + ClientConfiguration.Default.UriString);

            Console.Write("Warming.");

            context.SalesOrderHeadersV2.FirstOrDefault();
            Console.Write(".");
            Console.WriteLine(".");


            Console.WriteLine("Starting...");

            SalesValues values;

            #region SalesOrderHeaderV2 Tests
            Console.WriteLine("Starting SalesOrderHeaderV2 Tests");

            int loopCount = 100;

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read, values.SalesId, values.DataAreaId);
            }


            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomInventSite();
                SalesOrderHeaderV2Tester.runOneReadOnInventSiteId(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadInventSite, values.InventSiteId, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomInventLocation();
                SalesOrderHeaderV2Tester.runOneReadOnInventLocationId(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadInventLocation, values.InventLocationid, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomEmail();
                SalesOrderHeaderV2Tester.runOneReadOnSalesEmail(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadEmail, values.Email, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomSalesName();
                SalesOrderHeaderV2Tester.runOneReadOnSalesName(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadSalesName, values.SalesName, values.DataAreaId);
            }

            //--
            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReads(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10, values.DataAreaId, values.SalesId, 10);
            }


            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomInventSite();
                SalesOrderHeaderV2Tester.runReadsOnInventSiteId(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10InventSite, values.DataAreaId, values.InventSiteId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomInventLocation();
                SalesOrderHeaderV2Tester.runReadsOnInventLocationId(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10InventLocation, values.DataAreaId, values.InventLocationid, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomEmail();
                SalesOrderHeaderV2Tester.runReadsOnSalesEmail(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10Email, values.DataAreaId, values.Email, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomSalesName();
                SalesOrderHeaderV2Tester.runReadsOnSalesName(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10SalesName, values.DataAreaId, values.SalesName, 10);
            }

            #endregion

            //but is index over-specification an issue?
            //ReadCustIdx, ReadStatusCustAccidx, ReadSalesTypeIdx, ReadCustCreatedDateIdx,
            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneCustIdxRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadCustIdx, values.CustAccount, values.SalesId, values.PurchOrderFormNum, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneStatusCustAccountIdxRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadStatusCustAccidx, values.SalesStatus, values.CustAccount, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneSalesTypeIdxRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadSalesTypeIdx, values.SalesId, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runOneCustCreatedDateIdxRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadCustCreatedDateIdx, values.CustAccount, values.CreatedDateTime, values.DataAreaId);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomGarbageCombination();
                SalesOrderHeaderV2Tester.runOneGarbageRead(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadGarbage, values);
            }
            //


            Console.WriteLine("Complete. Press enter.");
            Console.ReadLine();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Uri oDataUri = new Uri(ODataEntityPath, UriKind.Absolute);
            var context  = new Resources(oDataUri);


            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };


            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });


            StreamWriter stream = File.CreateText(filePath);

            stream.WriteLine("Entity,TestType, Workload, Duration");
            stream.Flush();
            stream.Close();

            Console.WriteLine("Connected To " + ClientConfiguration.Default.UriString);

            SalesValues values;

            Console.Write("Warming.");
            context.SalesOrderHeadersV2.FirstOrDefault();
            Console.Write(".");
            Console.WriteLine(".");


            #region SalesOrderHeaderV2 Tests
            Console.WriteLine("Starting SalesOrderHeaderV2 Tests");

            int loopCount = 100;

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByAsc(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10WithOrderByAscOnIndex, values.DataAreaId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByDesc(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Ready10WithOrderByDescOnIndex, values.DataAreaId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByAscOnRequestedShippingDate(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10WithOrderByAscNotOnIndex, values.DataAreaId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByDescOnRequestedShippingDate(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10WithOrderByDescNotOnIndex, values.DataAreaId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByAscOnSalesOrderProcessingStatus(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10WithOrderByAscOnCalculatedField, values.DataAreaId, 10);
            }

            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                SalesOrderHeaderV2Tester.runReadsWithOrderByDescOnSalesOrderProcessingStatus(context, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.Read10WithOrderByDescOnCalculatedField, values.DataAreaId, 10);
            }

            //salesOrderProcessingStat


            #endregion



            Console.WriteLine("Complete. Press enter.");
            Console.ReadLine();
        }