public override void SetRecordingJobConfiguration(string JobToken, ref RecordingJobConfiguration JobConfiguration) { ParametersValidation validation = new ParametersValidation(); validation.Add(ParameterType.String, "JobToken", JobToken); // ToDo: add parameters from configuration ExecuteVoidCommand(validation, RecordingServiceTest.SetRecordingJobConfigurationTest); }
protected RecordingJobConfiguration GetRecordingJobConfiguration(string token) { RecordingJobConfiguration configuration = null; RunStep(() => { configuration = Client.GetRecordingJobConfiguration(token); }, string.Format("Get Recording Job Configuration (token = '{0}')", token)); DoRequestDelay(); return(configuration); }
//CreateRecordingJob response with SourceToken.Type //[XmlReplySubstituteExtension("<?xml version=\"1.0\" encoding=\"utf-8\"?> <soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> <soap:Body> <CreateRecordingJobResponse xmlns=\"http://www.onvif.org/ver10/recording/wsdl\"> <JobToken>job001</JobToken> <JobConfiguration> <RecordingToken xmlns=\"http://www.onvif.org/ver10/schema\">recording001</RecordingToken> <Mode xmlns=\"http://www.onvif.org/ver10/schema\">Idle</Mode> <Priority xmlns=\"http://www.onvif.org/ver10/schema\">1</Priority> <Source xmlns=\"http://www.onvif.org/ver10/schema\"> <SourceToken Type=\"http://www.onvif.org/ver10/schema/Receiver\"> <Token>ReceiverToken001</Token> </SourceToken> <Tracks> <SourceTag /> <Destination /> </Tracks> </Source> </JobConfiguration> </CreateRecordingJobResponse> </soap:Body> </soap:Envelope>")] public override string CreateRecordingJob(ref RecordingJobConfiguration JobConfiguration) { ParametersValidation validation = new ParametersValidation(); JobConfiguration = RecordingServiceTest.TakeRecordingJobConfiguration(); string token = (string)ExecuteGetCommand(validation, RecordingServiceTest.CreateRecordingJobTest); return(token); }
public override RecordingJobConfiguration GetRecordingJobConfiguration(string JobToken) { RecordingJobConfiguration config = Search.SearchStorage.Instance.GetRecordingJobConfiguration(JobToken); if (config == null) { ReturnFault(new string[] { "Sender", "InvalidArgVal", "NoRecordingJob" }); } return(config); }
protected string CreateRecordingJob(ref RecordingJobConfiguration configuration, string stepName) { RecordingJobConfiguration config = configuration; string result = string.Empty; RunStep(() => { result = Client.CreateRecordingJob(ref config); }, stepName); DoRequestDelay(); configuration = config; return(result); }
public RecordingJobConfiguration GetRecordingJobConfiguration(string token) { RecordingJobConfiguration config = null; GetRecordingJobsResponseItem item = RecordingJobs.Where(j => j.JobToken == token).FirstOrDefault(); if (item != null) { config = item.JobConfiguration; } return(config); }
public void GetRecordingJobConfigurationTest() { RunTest(() => { //3. ONVIF Client will invoke GetRecordingsRequest message to retrieve complete recordings list. //4. Verify the GetRecordingsResponse message from the DUT. GetRecordingsResponseItem[] recordings = GetRecordings(); if (recordings != null && recordings.Length > 0) { List <string> recordingTokens = recordings.Select(R => R.RecordingToken).ToList(); //5. ONVIF Client will invoke GetRecordingJobsRequest message to retrieve complete // recording jobs list. //6. Verify the GetRecordingJobsResponse message from the DUT. GetRecordingJobsResponseItem[] jobs = GetRecordingJobs(); if (jobs != null) { foreach (GetRecordingJobsResponseItem job in jobs) { Assert(job.JobConfiguration != null, "Configuation is missing when information is received via GetRecordings", "Check that configuration is not missing"); Assert(recordingTokens.Contains(job.JobConfiguration.RecordingToken), string.Format("Recording with token '{0}' does not exist", job.JobConfiguration.RecordingToken), "Check that configuration is valid"); //7. ONVIF Client will invoke GetRecordingJobConfigurationRequest message (JobToken = “Token1”, where Token1 is the first JobItem.JobToken from the GetRecordingJobsResponse message) to retrieve recording job configuration. //8. Verify the GetRecordingJobConfigurationResponse message from the DUT. RecordingJobConfiguration configuration = GetRecordingJobConfiguration(job.JobToken); Assert(configuration != null, "The DUT did not returned configuration", "Check that the DUT returned requested information"); CompareConfigurations(job.JobConfiguration, configuration, "GetRecordingJobs", "GetRecordingJobConfiguration"); //9. Repeat steps 7-8 for all other recording jobs from the GetRecordingJobsResponse message. } } } }); }
public override string CreateRecordingJob(ref RecordingJobConfiguration JobConfiguration) { if (Search.SearchStorage.Instance.RecordingJobs.Count > 5) { ReturnFault(new string[] { "Receiver", "Action", "MaxRecordingJobs" }); } GetRecordingJobsResponseItem job = new GetRecordingJobsResponseItem(); job.JobToken = "job" + Guid.NewGuid().ToString().Substring(0, 8); job.JobConfiguration = JobConfiguration; if (JobConfiguration.Source != null) { foreach (RecordingJobSource source in JobConfiguration.Source) { if (source.AutoCreateReceiverSpecified && source.AutoCreateReceiver) { Receiver.Receiver receiver = new Receiver.Receiver(); receiver.Token = Guid.NewGuid().ToString(); receiver.Configuration = new CameraWebService.Receiver.ReceiverConfiguration(); receiver.Configuration.StreamSetup = new CameraWebService.Receiver.StreamSetup(); receiver.Configuration.MediaUri = string.Empty; receiver.Configuration.StreamSetup.Stream = CameraWebService.Receiver.StreamType.RTPUnicast; receiver.Configuration.StreamSetup.Transport = new CameraWebService.Receiver.Transport(); receiver.Configuration.StreamSetup.Transport.Protocol = CameraWebService.Receiver.TransportProtocol.RTSP; source.SourceToken = new SourceReference(); source.SourceToken.Token = receiver.Token; source.SourceToken.Type = "http://www.onvif.org/ver10/schema/Receiver"; Search.SearchStorage.Instance.Receivers.Add(receiver); } } } Search.SearchStorage.Instance.RecordingJobs.Add(job); Search.SearchStorage.Instance.JobStates.Add(job.JobToken, JobConfiguration.Mode); return(job.JobToken); }
public abstract void SetRecordingJobConfiguration(string JobToken, ref RecordingJobConfiguration JobConfiguration);
protected string CreateRecordingJob(ref RecordingJobConfiguration configuration) { return(CreateRecordingJob(ref configuration, "Create recording job")); }
public void RecordingJobConfigurationDiffPriorTest2() { string recordingToken = string.Empty; string profileToken = string.Empty; string jobToken = string.Empty; string jobTokenSecond = string.Empty; bool recordingCreated = false; bool isRecordingJobDeleted = false; bool isRecordingJobSecondDeleted = false; RunTest(() => { // A.15 - Selection or Creation of Recording for recording job creation on a Media profile GetRecordingForJobCreationMediaProfile(out recordingToken, out profileToken, out recordingCreated, 1); // pass test if there is no recording token and profile token if (recordingToken == string.Empty && profileToken == string.Empty) { return; } // create 1st recording job configuration var source = new RecordingJobSource { SourceToken = new SourceReference { Token = profileToken, Type = PROFILESOURCETYPE }, AutoCreateReceiverSpecified = false }; var jobConfiguration = new RecordingJobConfiguration { RecordingToken = recordingToken, Mode = ACTIVE, Priority = 1, Source = new[] { source } }; var confStand = (RecordingJobConfiguration)CopyObject(jobConfiguration); // create 1st recording job jobToken = CreateRecordingJob(ref jobConfiguration); Assert(!string.IsNullOrEmpty(jobToken), "Job token wasn't returned", "Check that job token was returned"); ValidateRecordingJobConfiguration(jobConfiguration, confStand); // wait Sleep(_operationDelay); // get job state RecordingJobStateInformation info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, ACTIVE); // create 1st recording job configuration var jobConfigurationSecond = confStand; jobConfigurationSecond.Priority = 2; confStand = (RecordingJobConfiguration)CopyObject(jobConfigurationSecond); // create 2nd recording job jobTokenSecond = CreateRecordingJob(ref jobConfigurationSecond); Assert(!string.IsNullOrEmpty(jobTokenSecond), "Job token wasn't returned", "Check that job token was returned"); ValidateRecordingJobConfiguration(jobConfigurationSecond, confStand); // wait Sleep(_operationDelay); // get job state info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, IDLE); // get job state info = GetRecordingJobState(jobTokenSecond); ValidateJobState(info, recordingToken, ACTIVE); // delete 2nd job DeleteRecordingJob(jobTokenSecond); isRecordingJobSecondDeleted = true; // wait Sleep(_operationDelay); // get job state info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, ACTIVE); // delete 1st job DeleteRecordingJob(jobToken); isRecordingJobDeleted = true; }, () => { if (!isRecordingJobDeleted && !string.IsNullOrEmpty(jobToken)) { DeleteRecordingJob(jobToken); } if (!isRecordingJobSecondDeleted && !string.IsNullOrEmpty(jobTokenSecond)) { DeleteRecordingJob(jobTokenSecond); } if (recordingCreated && !string.IsNullOrEmpty(recordingToken)) { DeleteRecording(recordingToken); } }); }
public OnvifCreateRecordingJob(string uri, string userName, string password, RecordingJobConfiguration config) : base(uri, userName, password) { Config = config; }
/// <summary> /// /// </summary> /// <param name="configuration1">Configuration from GetRecordingJobs</param> /// <param name="configuration2">Configuration from GetRecordingJobConfiguration</param> void CompareConfigurations(RecordingJobConfiguration configuration1, RecordingJobConfiguration configuration2, string descr1, string descr2) { BeginStep("Compare Recording Job Configurations"); StringBuilder dump = new StringBuilder("Configurations are different" + Environment.NewLine); bool equal = true; bool local; if (configuration1.Mode != configuration2.Mode) { equal = false; dump.AppendFormat(" Mode field is different{0}", Environment.NewLine); } if (configuration1.Priority != configuration2.Priority) { equal = false; dump.AppendFormat(" Priority field is different{0}", Environment.NewLine); } if (configuration1.RecordingToken != configuration2.RecordingToken) { equal = false; dump.AppendFormat(" RecordingToken field is different{0}", Environment.NewLine); } // Compare Source local = true; RecordingJobSource[] source1 = configuration1.Source; RecordingJobSource[] source2 = configuration2.Source; if (source1 != null && source2 != null) { // get intersection; // compare items in intersection Dictionary <RecordingJobSource, RecordingJobSource> common = new Dictionary <RecordingJobSource, RecordingJobSource>(); bool ok; ok = CompareRecordingJobSourceLists(source1, source2, common, descr1, descr2, dump); // for common only bool ok1 = CompareJobSources(common, dump); local = ok && ok1; } else { string messageFormat = " Source information is skipped when information is received via {0}" + Environment.NewLine; if (source1 == null && source2 != null) { local = false; dump.AppendFormat(messageFormat, descr1); } if (source2 == null && source1 != null) { local = false; dump.AppendFormat(messageFormat, descr2); } // both null is OK } equal = equal && local; // There is also Extensio field. // Extension contains only Any... // Dump total result if (!equal) { throw new AssertException(dump.ToStringTrimNewLine()); } StepPassed(); }
private string ValidateRecordingJobConfiguration(RecordingJobConfiguration actual, RecordingJobConfiguration expected) { //ONVIF Client will invoke CreateRecordingJobRequest message //(JobConfiguration.RecordingToken=RecordingToken1, JobConfiguration.Mode=Active, //JobConfiguration.Priority=2, JobConfiguration.Source.SourceToken.Token=”ProfileToken1”, //where ProfileToken1 is token of MediaProfile configured for recording, //JobConfiguration.Source.SourceToken.Type=”http://www.onvif.org/ver10/schema/Profile”, //JobConfiguration.Source.AutoCreateReceiver=false) to create a new recording job for //configured recording with Active state and higher priority. string receiverToken = string.Empty; bool ok = true; StringBuilder logger = new StringBuilder(); if (actual.RecordingToken != expected.RecordingToken) { ok = false; logger.Append(string.Format("Recording token is {0} but must be {1}{2}", actual.RecordingToken, expected.RecordingToken, Environment.NewLine)); } if (actual.Mode != expected.Mode) { ok = false; logger.Append(string.Format("Mode is {0} but must be {1}{2}", actual.Mode, expected.Mode, Environment.NewLine)); } if (actual.Priority != expected.Priority) { ok = false; logger.Append(string.Format("Priority is {0} but must be {1}{2}", actual.Priority, expected.Priority, Environment.NewLine)); } if (actual.Source != null) { if (actual.Source.Length != expected.Source.Length) { ok = false; logger.Append(string.Format("RecordingJobSource list size is {0} but must be {1}{2}", actual.Source.Length, expected.Source.Length, Environment.NewLine)); } else { if (actual.Source[0].AutoCreateReceiverSpecified == true && actual.Source[0].AutoCreateReceiver) { ok = false; logger.Append(string.Format( "AutoCreateReceiver is present in RecordingJobSource{0}", Environment.NewLine)); } else { if (actual.Source[0].SourceToken != null) { if (expected.Source[0].AutoCreateReceiverSpecified && expected.Source[0].AutoCreateReceiver) { receiverToken = actual.Source[0].SourceToken.Token; if (string.IsNullOrEmpty(receiverToken)) { ok = false; logger.Append(string.Format( "Receiver token is not present in RecordingJobSource{0}", Environment.NewLine)); } string receiverType = "http://www.onvif.org/ver10/schema/Receiver"; if (actual.Source[0].SourceToken.Type != receiverType) { ok = false; logger.Append(string.Format( "RecordingJobSource SourceToken.Type is \"{0}\" but must be \"{1}\"{2}", actual.Source[0].SourceToken.Type, receiverType, Environment.NewLine)); } } else { if (actual.Source[0].SourceToken.Token != expected.Source[0].SourceToken.Token) { ok = false; logger.Append(string.Format( "RecordingJobSource SourceToken.Token is {0} but must be {1}{2}", actual.Source[0].SourceToken.Token, expected.Source[0].SourceToken.Token, Environment.NewLine)); } if (actual.Source[0].SourceToken.Type != expected.Source[0].SourceToken.Type) { ok = false; logger.Append(string.Format( "RecordingJobSource SourceToken.Type is {0} but must be {1}{2}", actual.Source[0].SourceToken.Type, expected.Source[0].SourceToken.Type, Environment.NewLine)); } } } else { ok = false; logger.Append(string.Format("RecordingJobSource doesn't contain SourceToken{0}", Environment.NewLine)); } } } } else { ok = false; logger.Append( string.Format("RecordingJobConfiguration doesn't contain RecordingJobSource{0}", Environment.NewLine)); } Assert(ok, logger.ToStringTrimNewLine(), "Validate recording job configuration"); return(receiverToken); }
public abstract string CreateRecordingJob(ref RecordingJobConfiguration JobConfiguration);
public override void SetRecordingJobConfiguration(string JobToken, ref RecordingJobConfiguration JobConfiguration) { Search.SearchStorage.Instance.JobStates[JobToken] = JobConfiguration.Mode; }
public OnvifSetRecordingJobConfiguration(string uri, string userName, string password, string jobToken, RecordingJobConfiguration config) : base(uri, userName, password) { JobToken = jobToken; Config = config; }