Ejemplo n.º 1
0
        /// <summary>
        /// Runs HelloREEF using the IREEFClient passed into the constructor.
        /// </summary>
        private void Run()
        {
            // The driver configuration contains all the needed bindings.
            var helloDriverConfiguration = DriverConfiguration.ConfigurationModule
                                           .Set(DriverConfiguration.OnEvaluatorAllocated, GenericType <HelloDriver> .Class)
                                           .Set(DriverConfiguration.OnDriverStarted, GenericType <HelloDriver> .Class)
                                           .Set(DriverConfiguration.CustomTraceLevel, Level.Verbose.ToString())
                                           .Build();

            string applicationId = GetApplicationId();

            // The JobSubmission contains the Driver configuration as well as the files needed on the Driver.
            var helloJobRequest = _reefClient.NewJobRequestBuilder()
                                  .AddDriverConfiguration(helloDriverConfiguration)
                                  .AddGlobalAssemblyForType(typeof(HelloDriver))
                                  .AddGlobalAssembliesInDirectoryOfExecutingAssembly()
                                  .SetJobIdentifier(applicationId)
                                  .SetJavaLogLevel(JavaLoggingSetting.Verbose)
                                  .Build();

            IJobSubmissionResult jobSubmissionResult = _reefClient.SubmitAndGetJobStatus(helloJobRequest);

            // Wait for the Driver to complete.
            jobSubmissionResult?.WaitForDriverToFinish();
        }
Ejemplo n.º 2
0
        public ITestResult RunTest(JobRequestBuilder jobRequestBuilder)
        {
            // Setup the assert file.
            var assertFileName = Path.GetTempPath() + "/reef-test-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".json";

            jobRequestBuilder.AddDriverConfiguration(FileWritingAssertConfiguration.ConfigurationModule
                                                     .Set(FileWritingAssertConfiguration.FilePath, assertFileName)
                                                     .Build());
            var jobRequest = jobRequestBuilder.Build();

            LOG.Log(Level.Info, "Submitting job `{0}` for execution. Assert log in `{1}`",
                    jobRequest.JobIdentifier,
                    assertFileName);
            IJobSubmissionResult jobStatus = _client.SubmitAndGetJobStatus(jobRequest);

            if (jobStatus == null)
            {
                return(TestResult.Fail(
                           "JobStatus returned by the Client was null. This points to an environment setup problem."));
            }

            LOG.Log(Level.Verbose, "Waiting for job `{0}` to complete.", jobRequest.JobIdentifier);
            jobStatus.WaitForDriverToFinish();
            LOG.Log(Level.Verbose, "Job `{0}` completed.", jobRequest.JobIdentifier);

            return(ReadTestResult(assertFileName));
        }