public override string CreateRecording(RecordingConfiguration RecordingConfiguration) { ParametersValidation validation = new ParametersValidation(); // ToDo : add parameters for validation return((string)ExecuteGetCommand(validation, RecordingServiceTest.CreateRecordingTest)); }
public void RecordingConfigurationInvalidTokenTest() { string token = null; RunTest(() => { GetRecordingsResponseItem[] recordings = GetRecordings(); if (recordings == null || recordings.Length == 0) { RecordingConfiguration config = new RecordingConfiguration(); config.MaximumRetentionTime = _retentionTime; config.Content = "Recording from device"; config.Source = new RecordingSourceInformation(); config.Source.SourceId = _cameraAddress.Trim(); config.Source.Name = "CameraName"; config.Source.Location = "LocationDescription"; config.Source.Description = "SourceDescription"; config.Source.Address = _cameraAddress.Trim(); token = CreateRecording(config); } this.InvalidTokenTestBody((s) => Client.GetRecordingConfiguration(s), RunStep, "Recording Configuration", OnvifFaults.NoRecording); }, () => { if (token != null) { DeleteRecording(token); } }); }
public override void SetRecordingConfiguration(string RecordingToken, RecordingConfiguration RecordingConfiguration) { ParametersValidation validation = new ParametersValidation(); validation.Add(ParameterType.String, "RecordingToken", RecordingToken); // ToDo: add parameters from configuration passed ExecuteVoidCommand(validation, RecordingServiceTest.SetRecordingConfigurationTest); }
protected RecordingConfiguration GetRecordingConfiguration(string token) { RecordingConfiguration response = null; RunStep(() => { response = Client.GetRecordingConfiguration(token); }, string.Format("Get Recording Configuration (token = '{0}')", token)); DoRequestDelay(); return(response); }
protected string CreateRecording(RecordingConfiguration configuration, string stepName) { string result = string.Empty; RunStep(() => { result = Client.CreateRecording(configuration); }, stepName); DoRequestDelay(); return(result); }
protected void DeleteRecordingIfNecessary(GetRecordingsResponseItem[] recordings, out String recordingTokenDeleted, out RecordingConfiguration oldConfig) { bool isDeleted = false; oldConfig = null; recordingTokenDeleted = null; foreach (GetRecordingsResponseItem recording in recordings) { try { // Saving of old config to restore it later oldConfig = GetRecordingConfiguration(recording.RecordingToken); DeleteRecording(recording.RecordingToken); isDeleted = true; recordingTokenDeleted = recording.RecordingToken; break; } catch (FaultException exc) { if (exc.IsValidOnvifFault("Receiver/Action/CannotDelete")) { LogStepEvent(string.Format("Can't delete recording (token = {0})", recording.RecordingToken)); StepPassed(); } else { StepFailed(exc); } } } // In case if deleting of every recording caused "Receiver/Action/CannotDelete" fault Assert(isDeleted == true, "No one recording was deleted", "Checking if some recording was deleted"); // Checking if recording was deleted in reality if (isDeleted == true && recordingTokenDeleted != null) { GetRecordingsResponseItem[] recordingsRefreshed = GetRecordings(); String recordingTokenDeletedCopy = recordingTokenDeleted; GetRecordingsResponseItem recording = recordingsRefreshed.FirstOrDefault(r => r.RecordingToken == recordingTokenDeletedCopy); Assert(recording == null, string.Format("Recording (token = {0}) was not deleted in reality", recordingTokenDeleted), "Validation of deleted recording"); } }
void CompareConfigurations(RecordingConfiguration configuration1, RecordingConfiguration configuration2) { BeginStep("Compare Recording Configurations"); StringBuilder dump = new StringBuilder("Configurations are different" + Environment.NewLine); bool equal = StorageTestsUtils.CompareConfigurations(configuration1, configuration2, dump, "GetRecordings", "GetRecordingConfiguration"); if (!equal) { LogStepEvent(dump.ToStringTrimNewLine()); throw new AssertException("Configurations don't match"); } StepPassed(); }
public override RecordingConfiguration GetRecordingConfiguration(string RecordingToken) { Search.RecordingInformation info = Search.SearchStorage.Instance.Recordings.Where(r => r.RecordingToken == RecordingToken).FirstOrDefault(); RecordingConfiguration config = new RecordingConfiguration(); config.MaximumRetentionTime = "PT10S"; config.Content = info.Content; config.Source = new RecordingSourceInformation(); config.Source.Description = info.Source.Description; config.Source.Address = info.Source.Address; config.Source.Location = info.Source.Location; config.Source.Name = info.Source.Name; config.Source.SourceId = info.Source.SourceId; return(config); }
public override string CreateRecording(RecordingConfiguration RecordingConfiguration) { CameraWebService.Search.RecordingInformation recording = new CameraWebService.Search.RecordingInformation(); string token = "recording" + Guid.NewGuid().ToString().Substring(0, 8); recording.RecordingToken = token; recording.Source = new CameraWebService.Search.RecordingSourceInformation(); recording.Source.Description = RecordingConfiguration.Source.Description; recording.Source.Address = RecordingConfiguration.Source.Address; recording.Source.Location = RecordingConfiguration.Source.Location; recording.Source.Name = RecordingConfiguration.Source.Name; recording.Source.SourceId = RecordingConfiguration.Source.SourceId; recording.Content = RecordingConfiguration.Content; recording.RecordingStatus = CameraWebService.Search.RecordingStatus.Initiated; //RecordingConfiguration.MaximumRetentionTime; List <CameraWebService.Search.TrackInformation> trackList = new List <CameraWebService.Search.TrackInformation>(); trackList.Add(new CameraWebService.Search.TrackInformation() { Description = string.Empty, TrackType = CameraWebService.Search.TrackType.Video, TrackToken = "VIDEO001" }); trackList.Add(new CameraWebService.Search.TrackInformation() { Description = string.Empty, TrackType = CameraWebService.Search.TrackType.Audio, TrackToken = "AUDIO001" }); trackList.Add(new CameraWebService.Search.TrackInformation() { Description = string.Empty, TrackType = CameraWebService.Search.TrackType.Metadata, TrackToken = "META001" }); recording.Track = trackList.ToArray(); Search.SearchStorage.Instance.Recordings.Add(recording); return(token); }
public void RecordingConfigurationTest() { RunTest(() => { GetRecordingsResponseItem[] recordings = GetRecordings(); if (recordings != null) { foreach (GetRecordingsResponseItem item in recordings) { Assert(item.Configuration != null, "Configuration is missing in the structure with Recording information", "Check that Configuration is present"); RecordingConfiguration configuration = GetRecordingConfiguration(item.RecordingToken); Assert(configuration != null, "The DUT did not return Recording Configuration", "Check that the DUT returned Configuration"); CompareConfigurations(item.Configuration, configuration); } } }); }
public abstract void SetRecordingConfiguration(string RecordingToken, RecordingConfiguration RecordingConfiguration);
public void DynamicRecordingsConfigTest() { // token of deleted recording String recordingTokenDeleted = null; // token of created recording String recordingTokenCreated = null; bool recordingCreated = false; // deleted recording config RecordingConfiguration oldConfig = null; RecordingConfiguration config = new RecordingConfiguration(); config.Source = new RecordingSourceInformation(); config.Source.Description = "SourceDescription"; // A device shall support at least 128 characters. config.Source.SourceId = "http://source-id-for-test.com/identifier/for/the/source/chosen/by/the/client/that/creates/the/structure/0001/0002/0003/0004/005"; config.Source.Location = "LocationDescription"; // A device shall support at least 20 characters. config.Source.Name = "SourceNameForTest001"; // A device shall support at least 128 characters. config.Source.Address = "http://source-address-for-test.com/uri/provided/by/the/service/supplying/data/to/be/recorded/0001/0002/0003/0004/0005/0006/0007"; config.MaximumRetentionTime = "PT60S"; config.Content = "Create recording dynamic test"; RunTest(() => { // A.10 begins RecordingServiceCapabilities capabilities = GetServiceCapabilities(); Assert(capabilities != null, "Capabilities hasn't been returned", "Check that capabilities has been returned"); Assert(capabilities.DynamicRecordings == true, "Recording creating operation is unavailable", "Check that recording can be created"); GetRecordingsResponseItem[] recordings = GetRecordings(); if (capabilities.MaxRecordingsSpecified == true && recordings.Length == capabilities.MaxRecordings) { LogTestEvent(string.Format("Max limit of recordings is reached. Trying to delete some recording...{0}", Environment.NewLine)); DeleteRecordingIfNecessary(recordings, out recordingTokenDeleted, out oldConfig); } bool needToDeleteRecording = false; try { recordingTokenCreated = CreateRecording(config); recordingCreated = true; } catch (FaultException exc) { if (exc.IsValidOnvifFault("Receiver/Action/MaxRecordings")) { needToDeleteRecording = true; LogStepEvent("Can't create new recording because of Max Recording limit is reached"); StepPassed(); } else { StepFailed(exc); } } if (needToDeleteRecording == true) { LogTestEvent(string.Format("Max limit of recordings is reached. Trying to delete some recording...{0}", Environment.NewLine)); DeleteRecordingIfNecessary(recordings, out recordingTokenDeleted, out oldConfig); } if (recordingCreated == true) { RecordingConfiguration configRefreshed = GetRecordingConfiguration(recordingTokenCreated); // Validation of the result Assert(new CheckCondition(() => { if (configRefreshed.Source.Name == config.Source.Name && configRefreshed.Source.SourceId == config.Source.SourceId && configRefreshed.Source.Address == config.Source.Address) { return(true); } else { return(false); } }), "Settings were not applied", "Validation of applied settings"); } }, () => { bool needToRestore = false; if (recordingTokenCreated != null || recordingTokenDeleted != null) { needToRestore = true; } if (needToRestore) { LogTestEvent(string.Format("Restoring the initial settings...{0}", Environment.NewLine)); } if (recordingTokenCreated != null && recordingCreated == true) { DeleteRecording(recordingTokenCreated); } if (recordingTokenDeleted != null && oldConfig != null) { CreateRecording(oldConfig); } }); }
public void SetRecordingsConfigTest() { RecordingConfiguration oldConfig = null; RecordingConfiguration newConfig = null; String recordingToken = null; RunTest(() => { GetRecordingsResponseItem[] recordings = GetRecordings(); // Recording list validation Assert(recordings != null, "No recordings returned", "Check that recordings list is not empty"); StorageTestsUtils.ValidateFullRecordingsList(recordings, Assert); // Saving of old recording config oldConfig = recordings[0].Configuration; recordingToken = recordings[0].RecordingToken; newConfig = new RecordingConfiguration(); newConfig.Source = new RecordingSourceInformation(); // A device shall support at least 20 characters. newConfig.Source.Name = "SourceNameForTest001"; // A device shall support at least 128 characters. newConfig.Source.SourceId = "http://source-id-for-test.com/identifier/for/the/source/chosen/by/the/client/that/creates/the/structure/0001/0002/0003/0004/005"; // A device shall support at least 128 characters. newConfig.Source.Address = "http://source-address-for-test.com/uri/provided/by/the/service/supplying/data/to/be/recorded/0001/0002/0003/0004/0005/0006/0007"; // Other values without changing newConfig.Source.Location = oldConfig.Source.Location; newConfig.Source.Description = oldConfig.Source.Description; newConfig.Content = oldConfig.Content; newConfig.MaximumRetentionTime = oldConfig.MaximumRetentionTime; // Setting of recording config SetRecordingConfiguration(recordingToken, newConfig); RecordingConfiguration actualConfig = GetRecordingConfiguration(recordingToken); // Validation of the result Assert(new CheckCondition(() => { if (actualConfig.Source.Name == newConfig.Source.Name && actualConfig.Source.SourceId == newConfig.Source.SourceId && actualConfig.Source.Address == newConfig.Source.Address) { return(true); } else { return(false); } }), "Settings were not applied", "Validation of applied settings"); }, () => { if (newConfig != null) { LogTestEvent(string.Format("Restoring the initial settings...{0}", Environment.NewLine)); SetRecordingConfiguration(recordingToken, oldConfig, "Restore previous settings"); } }); }
public void GetTrackConfigurationInvalidTokenTest() { string recordingToken = string.Empty; bool isCreated = false; RunTest(() => { var recordings = GetRecordings(); string trackToken = string.Empty; if (recordings == null || recordings.Length == 0) { RecordingConfiguration config = new RecordingConfiguration(); config.MaximumRetentionTime = "PT0S"; config.Content = "Recording from device"; config.Source = new RecordingSourceInformation(); config.Source.SourceId = _cameraAddress.Trim(); config.Source.Name = "CameraName"; config.Source.Location = "LocationDescription"; config.Source.Description = "SourceDescription"; config.Source.Address = _cameraAddress.Trim(); try { recordingToken = CreateRecording(config); } catch (FaultException ex) { LogStepEvent(ex.Message); StepPassed(); return; } Assert(!string.IsNullOrEmpty(recordingToken), "Recording token hasn't been returned", "Check that recording token has been returned"); isCreated = true; recordings = GetRecordings(); Assert(recordings != null, "Recording list is empty", "Check that recording list is not empty"); var recording = recordings.FirstOrDefault(r => r.RecordingToken == recordingToken); Assert(recording != null, "Recording is absent", string.Format("Check that recording '{0}' is present in recording list", recordingToken)); Assert(recording.Tracks != null && recording.Tracks.Track != null && recording.Tracks.Track.Length > 0, "Track list is empty", string.Format("Check that track list of recording '{0}' is not empty", recordingToken)); trackToken = recording.Tracks.Track[0].TrackToken; } else { recordingToken = recordings[0].RecordingToken; trackToken = recordings[0].Tracks.Track[0].TrackToken; } this.InvalidTokenTestBody <string>((s, T) => Client.GetTrackConfiguration(T, s), recordingToken, RunStep, "Get Track Configuration", null, OnvifFaults.NoTrack); this.InvalidTokenTestBody <string>((s, T) => Client.GetTrackConfiguration(s, T), trackToken, RunStep, "Get Track Configuration", null, OnvifFaults.NoRecording); }, () => { if (isCreated) { DeleteRecording(recordingToken); } }); }
public static bool CompareConfigurations(RecordingConfiguration configuration1, RecordingConfiguration configuration2, StringBuilder dump, string descr1, string descr2) { bool equal = true; bool local; if (configuration1.Content != configuration2.Content) { equal = false; dump.AppendFormat("Content field is different: '{0}' in {1}, '{2}' in {3}{4}", configuration1.Content, descr1, configuration2.Content, descr2, Environment.NewLine); } // convert configuration1.MaximumRetentionTime var MaxRetTime1 = new TimeSpan(); try { MaxRetTime1 = System.Xml.XmlConvert.ToTimeSpan(configuration1.MaximumRetentionTime); } catch (Exception e) { dump.AppendFormat("Invalid format for Maximum Retention Time: {0} {1}", e.Message, Environment.NewLine); equal = false; return(equal); } // convert configuration2.MaximumRetentionTime var MaxRetTime2 = new TimeSpan(); try { MaxRetTime2 = System.Xml.XmlConvert.ToTimeSpan(configuration2.MaximumRetentionTime); } catch (Exception e) { dump.AppendFormat("Invalid format for Maximum Retention Time: {0} {1}", e.Message, Environment.NewLine); equal = false; return(equal); } // compare them if (MaxRetTime1 != MaxRetTime2) { equal = false; dump.AppendFormat("MaximumRetentionTime field is different: '{0}' ({1}) in {2}, '{3}' ({4}) in {5}{6}", configuration1.MaximumRetentionTime, MaxRetTime1.ToString(), descr1, configuration2.MaximumRetentionTime, MaxRetTime2.ToString(), descr2, Environment.NewLine); } RecordingSourceInformation source1 = configuration1.Source; RecordingSourceInformation source2 = configuration2.Source; local = StorageTestsUtils.CompareSourceInformation(source1, source2, descr1, descr2, null, dump); equal = equal && local; return(equal); }
public abstract string CreateRecording(RecordingConfiguration RecordingConfiguration);
protected void SetRecordingConfiguration(string recordingToken, RecordingConfiguration recordingConfiguration) { SetRecordingConfiguration(recordingToken, recordingConfiguration, "Set Recording Configuration"); }
protected string CreateRecording(RecordingConfiguration configuration) { return(CreateRecording(configuration, "Create recording")); }
public override void SetRecordingConfiguration(string RecordingToken, RecordingConfiguration RecordingConfiguration) { }
protected void CheckRecording(GetRecordingsResponseItem recording, RecordingConfiguration conf) { //var recording = recordings.Where(r => r.RecordingToken == recordingToken).FirstOrDefault(); //Assert(recording != null, // "recording list doesn't contain new recording", // "Check that recording list contains new recording after refresh"); bool ok = true; StringBuilder logger = new StringBuilder(); if (recording.Configuration.MaximumRetentionTime != conf.MaximumRetentionTime) { ok = false; logger.Append(string.Format("MaximumRetentionTime is invalid{0}", Environment.NewLine)); } if (recording.Configuration.Content != conf.Content) { ok = false; logger.Append(string.Format("Content is '{0}' but must be '{1}'{2}", recording.Configuration.Content, conf.Content, Environment.NewLine)); } if (recording.Configuration.Source != null) { if (recording.Configuration.Source.Address != conf.Source.Address) { ok = false; logger.Append(string.Format("Source Address is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Address, conf.Source.Address, Environment.NewLine)); } if (recording.Configuration.Source.Description != conf.Source.Description) { ok = false; logger.Append(string.Format("Source Description is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Description, conf.Source.Description, Environment.NewLine)); } if (recording.Configuration.Source.Location != conf.Source.Location) { ok = false; logger.Append(string.Format("Source Location is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Location, conf.Source.Location, Environment.NewLine)); } if (recording.Configuration.Source.Name != conf.Source.Name) { ok = false; logger.Append(string.Format("Source Name is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Name, conf.Source.Name, Environment.NewLine)); } if (recording.Configuration.Source.SourceId != conf.Source.SourceId) { ok = false; logger.Append(string.Format("Source SourceId is '{0}' but must be '{1}'{2}", recording.Configuration.Source.SourceId, conf.Source.SourceId, Environment.NewLine)); } } else { ok = false; logger.Append(string.Format("recording doesn't contain Source{0}", Environment.NewLine)); } if (recording.Tracks == null || recording.Tracks.Track == null) { ok = false; logger.Append(string.Format("Track list of recording '{0}' is empty", recording.RecordingToken)); } else { foreach (var type in Enum.GetValues(typeof(TrackType))) { if ((TrackType)type != TrackType.Extended) { if (recording.Tracks.Track.FirstOrDefault( t => t.Configuration.TrackType == (TrackType)type) == null) { ok = false; logger.Append(string.Format("Recording doesn't contain tracks with track type '{0}'{1}", (TrackType)type, Environment.NewLine)); } } } } Assert(ok, logger.ToStringTrimNewLine(), "Check that configuration parameters of new recording are valid"); }
public void RecordingJobConfigurationDiffPriorOnReceiverTest2() { RecordingConfiguration replacedConfiguration = null; string recordingToken = null; bool recordingCreated = false; string jobToken = null; string jobTokenSecond = null; bool isRecordingJobDeleted = false; bool isRecordingJobSecondDeleted = false; RunTest(() => { // Annex A.12 - Selection or Creation of Recording for recording job creation GetRecordingForJobCreation(out recordingToken, out recordingCreated, 1); // pass test if there is no recording token if (recordingToken == string.Empty) { return; } // Annex A.13 - Auto Creation of Receiver RecordingJobConfiguration jobConfiguration; AutoCreationReceiver(recordingToken, out jobToken, out jobConfiguration); SetRecordingJobMode(jobToken, ACTIVE); Sleep(_operationDelay); var info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, ACTIVE); var jobConfigurationSecond = (RecordingJobConfiguration)CopyObject(jobConfiguration); jobConfigurationSecond.Priority = 2; jobConfigurationSecond.Mode = ACTIVE; var confStand = (RecordingJobConfiguration)CopyObject(jobConfigurationSecond); jobTokenSecond = CreateRecordingJob(ref jobConfigurationSecond); Assert(!string.IsNullOrEmpty(jobTokenSecond), "Job token wasn't returned", "Check that job token was returned"); Sleep(_operationDelay); ValidateRecordingJobConfiguration(jobConfigurationSecond, confStand); info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, IDLE); info = GetRecordingJobState(jobTokenSecond); ValidateJobState(info, recordingToken, ACTIVE); DeleteRecordingJob(jobTokenSecond); isRecordingJobSecondDeleted = true; Sleep(_operationDelay); info = GetRecordingJobState(jobToken); ValidateJobState(info, recordingToken, ACTIVE); 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); } }); }
private string CreateRecording(out GetRecordingsResponseItem[] recordings, out GetRecordingsResponseItem[] recordingsRefreshed, out string recordingToken) { var capabilities = GetServiceCapabilities(); Assert(capabilities != null, "Capabilities hasn't been returned", "Check that capabilities has been returned"); Assert(capabilities.DynamicRecordings, "Recording creating operation is unavailable", "Check that recording can be created"); recordings = GetRecordings(); string token = string.Empty; if (recordings != null && recordings.Length == capabilities.MaxRecordings) { bool isDelete = false; foreach (var item in recordings) { token = item.RecordingToken; try { DeleteRecording(token); isDelete = true; break; } catch (FaultException exc) { if (exc.IsValidOnvifFault("Receiver/Action/CannotDelete")) { LogStepEvent(string.Format("Can't delete receiver (token = {0})", token)); StepPassed(); } else { throw exc; } } } Assert(isDelete, "No receivers delete", "Check that receiver was deleted"); recordings = GetRecordings(); } RecordingConfiguration conf = new RecordingConfiguration(); conf.Source = new RecordingSourceInformation(); conf.Source.Description = "SourceDescription"; conf.Source.SourceId = "http://localhost/sourceID"; conf.Source.Location = "LocationDescription"; conf.Source.Name = "CameraName"; conf.Source.Address = "http://localhost/address"; conf.MaximumRetentionTime = "PT0S"; conf.Content = "Recording from device"; var newToken = CreateRecording(conf); recordingToken = newToken; if (recordings != null) { Assert(recordings.FirstOrDefault(r => r.RecordingToken == newToken) == null, "Recording token is not unique", "Check that recording list doesn't contain recording token of recording created"); } recordingsRefreshed = GetRecordings(); Assert(recordingsRefreshed != null && recordingsRefreshed.Length > 0, "Recording list is empty", "Check that recording list is not empty"); var recording = recordingsRefreshed.FirstOrDefault(r => r.RecordingToken == newToken); Assert(recording != null, "Recording list doesn't contain new recording", "Check that recording list contains new recording after refresh"); CheckRecording(capabilities, recording, conf); return(newToken); }
public void Init() { instance = new RecordingConfiguration(); }
public OnvifCreateRecording(string uri, string userName, string password, RecordingConfiguration configuration) : base(uri, userName, password) { Configuration = configuration; }
protected void CheckRecording(RecordingServiceCapabilities capabilities, GetRecordingsResponseItem recording, RecordingConfiguration conf) { //var recording = recordings.Where(r => r.RecordingToken == recordingToken).FirstOrDefault(); //Assert(recording != null, // "recording list doesn't contain new recording", // "Check that recording list contains new recording after refresh"); bool ok = true; StringBuilder logger = new StringBuilder(); if (recording.Configuration.MaximumRetentionTime != conf.MaximumRetentionTime) { ok = false; logger.Append(string.Format("MaximumRetentionTime is invalid{0}", Environment.NewLine)); } if (recording.Configuration.Content != conf.Content) { ok = false; logger.Append(string.Format("Content is '{0}' but must be '{1}'{2}", recording.Configuration.Content, conf.Content, Environment.NewLine)); } if (recording.Configuration.Source != null) { if (recording.Configuration.Source.Address != conf.Source.Address) { ok = false; logger.Append(string.Format("Source Address is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Address, conf.Source.Address, Environment.NewLine)); } if (recording.Configuration.Source.Description != conf.Source.Description) { ok = false; logger.Append(string.Format("Source Description is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Description, conf.Source.Description, Environment.NewLine)); } if (recording.Configuration.Source.Location != conf.Source.Location) { ok = false; logger.Append(string.Format("Source Location is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Location, conf.Source.Location, Environment.NewLine)); } if (recording.Configuration.Source.Name != conf.Source.Name) { ok = false; logger.Append(string.Format("Source Name is '{0}' but must be '{1}'{2}", recording.Configuration.Source.Name, conf.Source.Name, Environment.NewLine)); } if (recording.Configuration.Source.SourceId != conf.Source.SourceId) { ok = false; logger.Append(string.Format("Source SourceId is '{0}' but must be '{1}'{2}", recording.Configuration.Source.SourceId, conf.Source.SourceId, Environment.NewLine)); } } else { ok = false; logger.Append(string.Format("recording doesn't contain Source{0}", Environment.NewLine)); } if (recording.Tracks == null || recording.Tracks.Track == null) { ok = false; logger.Append(string.Format("Track list of recording '{0}' is empty", recording.RecordingToken)); } else { foreach (TrackType type in Enum.GetValues(typeof(TrackType))) { if (type != TrackType.Extended) { //if (recording.Tracks.Track.FirstOrDefault(t => t.Configuration.TrackType == type) == null) //{ // ok = false; // logger.Append(string.Format("Recording doesn't contain tracks with track type '{0}'{1}", type, Environment.NewLine)); //} var actualTrackCount = recording.Tracks.Track.Count(t => t.Configuration.TrackType == type); if (TrackType.Audio == type) { var audioEncodingsCount = capabilities.Encoding.Count(e => { AudioEncoding v; return(AudioEncoding.TryParse(e, out v)); }); if (0 != audioEncodingsCount) { var flag = (1 <= actualTrackCount); if (!flag) { logger.AppendLine(string.Format("There are no tracks of type: '{0}'.", type)); } ok = ok && flag; } } if (TrackType.Video == type) { var videoEncodingsCount = capabilities.Encoding.Count(e => { VideoEncoding v; return(VideoEncoding.TryParse(e, out v)); }); if (0 != videoEncodingsCount) { var flag = (1 <= actualTrackCount); if (!flag) { logger.AppendLine(string.Format("There are no tracks of type: '{0}'.", type)); } ok = ok && flag; } } if (TrackType.Metadata == type && Features.ContainsFeature(Feature.MetadataRecording)) { var flag = (1 <= actualTrackCount); if (!flag) { logger.AppendLine(string.Format("There are no tracks of type: '{0}'.", type)); } ok = ok && flag; } } } } Assert(ok, logger.ToStringTrimNewLine(), "Check that configuration parameters of new recording are valid"); }
protected void SetRecordingConfiguration(string recordingToken, RecordingConfiguration recordingConfiguration, string stepName) { RunStep(() => { Client.SetRecordingConfiguration(recordingToken, recordingConfiguration); }, stepName); DoRequestDelay(); }
public OnvifSetRecordingConfiguration(string uri, string userName, string password, string recordingToken, RecordingConfiguration configuration) : base(uri, userName, password) { RecordingToken = recordingToken; Configuration = configuration; }