Exemplo n.º 1
0
        private static void GenerateExcelForMP(string[] args)
        {
            try
            {
                bool exportAlertGeneratingWorkflowsOnly = false;

                ManagementPack mp = LoadManagementPack(args);

                DatasetCreator datasetCreator = new DatasetCreator(mp);

                ReportGenerator reportGenerator = new ReportGenerator(datasetCreator.Dataset, mp);

                exportAlertGeneratingWorkflowsOnly = (args.Length == 3 && string.Compare(args[2], "AlertGeneratingWorkflowsOnly", true) == 0);
                if (exportAlertGeneratingWorkflowsOnly)
                {
                    Console.WriteLine("AlertGeneratingWorkflowsOnly command line switch doesn't work with Excel export, only HTML.");
                }

                reportGenerator.GenerateExcelReport(args[1]);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
        private static IEnumerable <BasicDataset> Predict(List <string[]> csvData, IPredictionAlgorithm predictionAlgorithm, out IEnumerable <BasicDataset> datasets)
        {
            DatasetCreator datasetCreator = new DatasetCreator();

            datasets = datasetCreator.CreateFromCsv(csvData).ToList();

            return(Predict(datasets.ToList(), predictionAlgorithm));
        }
        private static IEnumerable <BasicDataset> Predict(List <string[]> csvData, IPredictionAlgorithm predictionAlgorithm)
        {
            DatasetCreator datasetCreator = new DatasetCreator();

            List <BasicDataset> stockList = datasetCreator.CreateFromCsv(csvData).ToList();

            return(Predict(stockList, predictionAlgorithm));
        }
Exemplo n.º 4
0
        private static void GenerateHTMLForMP(string[] args)
        {
            try
            {
                bool exportAlertGeneratingWorkflowsOnly = false;

                ManagementPack mp = LoadManagementPack(args);

                DatasetCreator datasetCreator = new DatasetCreator(mp);

                ReportGenerator reportGenerator = new ReportGenerator(datasetCreator.Dataset,mp);

                exportAlertGeneratingWorkflowsOnly = (args.Length == 3 && string.Compare(args[2],"AlertGeneratingWorkflowsOnly",true) == 0);

                reportGenerator.GenerateHTMLReport(args[1], exportAlertGeneratingWorkflowsOnly);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Exemplo n.º 5
0
        private static void GenerateHTMLForMP(string[] args)
        {
            try
            {
                bool exportAlertGeneratingWorkflowsOnly = false;

                ManagementPack mp = LoadManagementPack(args);

                DatasetCreator datasetCreator = new DatasetCreator(mp);

                ReportGenerator reportGenerator = new ReportGenerator(datasetCreator.Dataset, mp);

                exportAlertGeneratingWorkflowsOnly = (args.Length == 3 && string.Compare(args[2], "AlertGeneratingWorkflowsOnly", true) == 0);

                reportGenerator.GenerateHTMLReport(args[1], exportAlertGeneratingWorkflowsOnly);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Exemplo n.º 6
0
        private static void GenerateExcelForMP(string[] args)
        {
            try
            {
                bool exportAlertGeneratingWorkflowsOnly = false;

                ManagementPack mp = LoadManagementPack(args);

                DatasetCreator datasetCreator = new DatasetCreator(mp);

                ReportGenerator reportGenerator = new ReportGenerator(datasetCreator.Dataset, mp);

                exportAlertGeneratingWorkflowsOnly = (args.Length == 3 && string.Compare(args[2], "AlertGeneratingWorkflowsOnly", true) == 0);
                if (exportAlertGeneratingWorkflowsOnly)
                    Console.WriteLine("AlertGeneratingWorkflowsOnly command line switch doesn't work with Excel export, only HTML.");

                reportGenerator.GenerateExcelReport(args[1]);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Exemplo n.º 7
0
        //[InlineData(false, true)]
        //[InlineData(true, true)]
        public async Task AddStudyAndSandboxAndVm_WithRequiredRole_ShouldSucceed(bool isAdmin, bool isSponsor)
        {
            Trace.WriteLine("START AddStudyAndSandboxAndVm_WithRequiredRole_ShouldSucceed");
            await WithBasicSeeds();

            SetScenario(isEmployee: true, isAdmin: isAdmin, isSponsor: isSponsor);

            //CREATE STUDY
            var studyCreateConversation = await StudyCreator.CreateAndExpectSuccess(_restHelper);
            CreateStudyAsserts.ExpectSuccess(studyCreateConversation.Request, studyCreateConversation.Response);

            //CREATE STUDY SPECIFIC DATASET
            var datasetSeedResponse = await DatasetCreator.Create(_restHelper, studyCreateConversation.Response.Content.Id);
            var datasetCreateRequest = datasetSeedResponse.Request;
            var datasetResponseWrapper = datasetSeedResponse.Response;
            CreateDatasetAsserts.ExpectSuccess(datasetCreateRequest, datasetResponseWrapper);

            var createDatasetResponse = datasetResponseWrapper.Content;

            //CREATE SANDBOX
            var sandboxSeedResponse = await SandboxCreator.CreateAndExpectSuccess(_restHelper, studyCreateConversation.Response.Content.Id);
            var sandboxCreateRequest = sandboxSeedResponse.Request;
            var sandboxResponseWrapper = sandboxSeedResponse.Response;

            SandboxDetailsAsserts.NewlyCreatedExpectSuccess(sandboxCreateRequest, sandboxResponseWrapper);

            var sandboxResponse = sandboxResponseWrapper.Content;

            //ADD DATASET TO SANDBOX
            var addDatasetToSandboxResponse = await SandboxOperations.AddDataset(_restHelper, sandboxResponse.Id, createDatasetResponse.Id);
            var sandboxDatasetResponseWrapper = addDatasetToSandboxResponse.Response;
            AddDatasetToSandboxAsserts.ExpectSuccess(createDatasetResponse.Id, createDatasetResponse.Name, createDatasetResponse.Classification, "Open", sandboxDatasetResponseWrapper);

            //CREATE VM
            var virtualMachineSeedResponse = await VirtualMachineCreator.Create(_restHelper, sandboxResponse.Id);
            var virtualMachineCreateRequest = virtualMachineSeedResponse.Request;
            var virtualMachineResponseWrapper = virtualMachineSeedResponse.Response;

            CreateVirtualMachineAsserts.ExpectSuccess(virtualMachineCreateRequest, sandboxResponse.Region, virtualMachineResponseWrapper);

            //GET SANDBOX RESOURCE LIST AND ASSERT RESULT BEFORE CREATION
            var sandboxResourcesPreProvisioningResponseWrapper = await _restHelper.Get<List<SandboxResourceLight>>($"api/sandboxes/{sandboxResponse.Id}/resources");
            SandboxResourceListAsserts.BeforeProvisioning(sandboxResourcesPreProvisioningResponseWrapper, virtualMachineResponseWrapper.Content.Name);

            //GET SANDBOX VM LIST AND ASSERT RESULT BEFORE CREATION
            var virtualMachinesPreProvisioningResponseWrapper = await GenericReader.ReadAndAssertExpectSuccess<List<VmDto>>(_restHelper, GenericReader.SandboxVirtualMachines(sandboxResponse.Id));
            SandboxVirtualMachineAsserts.BeforeProvisioning(virtualMachinesPreProvisioningResponseWrapper.Response, virtualMachineResponseWrapper.Content.Name);

            //SETUP INFRASTRUCTURE BY RUNNING A METHOD ON THE API            
            var processWorkQueueResponse = await ProcessWorkQueue();

            //GET SANDBOX RESOURCE LIST AND ASSERT RESULT
            var sandboxResourcesResponseWrapper = await _restHelper.Get<List<SandboxResourceLight>>($"api/sandboxes/{sandboxResponse.Id}/resources");
            SandboxResourceListAsserts.AfterProvisioning(sandboxResourcesResponseWrapper, virtualMachineResponseWrapper.Content.Name);

            //TODO: GET SANDBOX VM LIST AND ASSERT RESULT
            var virtualMachinesAfterProvisioningResponseWrapper = await GenericReader.ReadAndAssertExpectSuccess<List<VmDto>>(_restHelper, GenericReader.SandboxVirtualMachines(sandboxResponse.Id));
            SandboxVirtualMachineAsserts.AfterProvisioning(virtualMachinesAfterProvisioningResponseWrapper.Response, virtualMachineResponseWrapper.Content.Name);

            //Add some participants

            var studyParticipantResponse = await StudyParticipantAdderAndRemover.AddAndExpectSuccess(_restHelper, studyCreateConversation.Response.Content.Id, StudyRoles.SponsorRep,
                StudyParticipantAdderAndRemover.CreateParticipantLookupDto());

            var getStudy = await _restHelper.Get<StudyDetailsDto>($"api/studies/{studyCreateConversation.Response.Content.Id}");

            var studyParticipant = getStudy.Content.Participants.Find(x => x.UserId == studyParticipantResponse.Response.Content.UserId);

            AddStudyParticipantsAsserts.ExpectSuccess(StudyRoles.SponsorRep, studyParticipant, studyParticipantResponse.Response);

            var vmRuleExtended = await _restHelper.Get<VmRuleDto>($"api/virtualmachines/{virtualMachineResponseWrapper.Content.Id}/extended");

            //OPEN INTERNET
            var openInternetResponse = await SandboxOperations.OpenInternetForVm<VmRuleDto>(_restHelper, virtualMachineResponseWrapper.Content.Id);

            SandboxVirtualMachineRuleAsserts.ExpectSuccess(openInternetResponse.Response.Content, vmRuleExtended.Content);

            await SandboxOperations.CloseInternetForVm<VmRuleDto>(_restHelper, virtualMachineResponseWrapper.Content.Id);

            //MOVE TO NEXT PHASE
            var sandboxAfterMovingToNextPhase = await SandboxOperations.MoveToNextPhase<SandboxDetails>(_restHelper, sandboxResponseWrapper.Content.Id);

            SandboxDetailsAsserts.AfterPhaseShiftExpectSuccess(sandboxAfterMovingToNextPhase.Response);
            
            //DELETE VM
            var deleteVmConversation = await SandboxOperations.DeleteVm(_restHelper, virtualMachineResponseWrapper.Content.Id);
            ApiResponseBasicAsserts.ExpectNoContent(deleteVmConversation.Response);

            //RUN WORKER
            await ProcessWorkQueue();

            //ASSERT THAT VM DISSAPEARS
            var sandboxVmsAfterDelete = await _restHelper.Get<List<VmDto>>($"api/virtualmachines/forsandbox/{sandboxResponseWrapper.Content.Id}");

            SandboxVirtualMachineAsserts.AfterProvisioning(sandboxVmsAfterDelete, "vm-studyname-sandboxnam-integrationtest");

            //TRY TO DELETE STUDY, GET ERROR
            await StudyDeleter.DeleteAndExpectFailure(_restHelper, studyCreateConversation.Response.Content.Id);

            //DELETE SANDBOX
            await SandboxDeleter.DeleteAndExpectSuccess(_restHelper, sandboxResponseWrapper.Content.Id);

            //DELETE STUDY

            await StudyDeleter.DeleteAndExpectSuccess(_restHelper, studyCreateConversation.Response.Content.Id);
            Trace.WriteLine("START AddStudyAndSandboxAndVm_WithRequiredRole_ShouldSucceed");
        }