private void ValidateActivityWindowsParameters(string jsonActual) { ActivityWindowsByDataFactoryListParameters actual = JsonConvert.DeserializeObject <ActivityWindowsByDataFactoryListParameters>(jsonActual); ActivityWindowsByDataFactoryListParameters expected = JsonConvert.DeserializeObject <ActivityWindowsByDataFactoryListParameters>(this.JsonRequest); if (actual != null && expected != null) { Type type = typeof(ActivityWindowsByDataFactoryListParameters); string[] notSerializedProperties = new[] { "ResourceGroupName", "DataFactoryName" }; foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { object actualValue = type.GetProperty(pi.Name).GetValue(actual, null); object expectedValue = type.GetProperty(pi.Name).GetValue(expected, null); if (notSerializedProperties.Contains(pi.Name)) { if (actualValue != null || expectedValue == null) { throw new JsonSerializationException(string.Format(CultureInfo.InvariantCulture, "Validation of ListActivityWindows failed for property {0} because unallowed properties are serialized. actualValue={1}, expectedValue={2}. actualJson={3}, expectedJson={4}", pi.Name, actualValue, expectedValue, jsonActual, this.JsonRequest)); } continue; } if (actualValue != expectedValue && (actualValue == null || !actualValue.Equals(expectedValue))) { throw new Exception(string.Format(CultureInfo.InvariantCulture, "Validation of ListActivityWindows failed because the actual parameter serialized does not match the expected for property {0}. actualValue={1}, expectedValue={2}. actualJson={3}, expectedJson={4}", pi.Name, actualValue, expectedValue, jsonActual, this.JsonRequest)); } } } }
public virtual ActivityWindowListResponse ListByDataFactoryActivityWindows( string nextLink, ActivityWindowsByDataFactoryListParameters listParameters) { return(nextLink.IsNextPageLink() ? DataPipelineManagementClient.ActivityWindows.ListNext(nextLink, listParameters) : DataPipelineManagementClient.ActivityWindows.List(listParameters)); }
public List <PSActivityWindow> ProcessListFilterActivityWindows(ActivityWindowFilterOptions filterOptions) { List <PSActivityWindow> runs = new List <PSActivityWindow>(); ActivityWindowListResponse response; if (string.IsNullOrWhiteSpace(filterOptions.PipelineName) && !string.IsNullOrWhiteSpace(filterOptions.DatasetName) && string.IsNullOrWhiteSpace(filterOptions.ActivityName)) { ActivityWindowsByDatasetListParameters byDatasetListParameters = this.GenerateListParameters <ActivityWindowsByDatasetListParameters>(filterOptions); response = this.ListByDatasetActivityWindows(filterOptions.NextLink, byDatasetListParameters); } else if (string.IsNullOrWhiteSpace(filterOptions.DatasetName) && !string.IsNullOrWhiteSpace(filterOptions.PipelineName) && string.IsNullOrWhiteSpace(filterOptions.ActivityName)) { ActivityWindowsByPipelineListParameters byPipelineListParameters = this.GenerateListParameters <ActivityWindowsByPipelineListParameters>(filterOptions); response = this.ListByPipelineActivityWindows(filterOptions.NextLink, byPipelineListParameters); } else if (string.IsNullOrWhiteSpace(filterOptions.DatasetName) && !string.IsNullOrWhiteSpace(filterOptions.PipelineName) && !string.IsNullOrWhiteSpace(filterOptions.ActivityName)) { ActivityWindowsByActivityListParameters byActivityListParameters = this.GenerateListParameters <ActivityWindowsByActivityListParameters>(filterOptions); response = this.ListByActivityActivityWindows(filterOptions.NextLink, byActivityListParameters); } else if (string.IsNullOrWhiteSpace(filterOptions.DatasetName) && string.IsNullOrWhiteSpace(filterOptions.PipelineName) && string.IsNullOrWhiteSpace(filterOptions.ActivityName)) { ActivityWindowsByDataFactoryListParameters byDataFactoryListParameters = this.GenerateListParameters <ActivityWindowsByDataFactoryListParameters>(filterOptions); response = this.ListByDataFactoryActivityWindows(filterOptions.NextLink, byDataFactoryListParameters); } else { throw new PSArgumentException( "An incorrect combination of arguments was passed. One of the following combinations of arguments must be provided:\n" + "1) List activity windows by data factory: '-ResourceGroupName' and '-DataFactoryName'.\n" + "2) List activity windows by pipeline: '-ResourceGroupName' and '-DataFactoryName' and '-PipelineName'.\n" + "3) List activity windows by pipeline activity: '-ResourceGroupName' and '-DataFactoryName' and '-PipelineName' and '-ActivityName'.\n" + "4) List activity windows by dataset: '-ResourceGroupName' and '-DataFactoryName' and '-DatasetName'.\n"); } filterOptions.NextLink = response != null ? response.NextLink : null; if (response != null && response.ActivityWindowListResponseValue.ActivityWindows != null) { runs.AddRange(response.ActivityWindowListResponseValue.ActivityWindows.Select(activityWindow => new PSActivityWindow(activityWindow))); } return(runs); }
/// <summary> /// Deserializes the given json into an Hydra OM ActivityWindow instance, by mocking a get request to /// exercise the client's deserialization logic. /// </summary> /// <param name="jsonResponse">The JSON response string to deserialize.</param> /// <param name="jsonRequest">The JSON request string to deserialize.</param> /// <returns></returns> internal static ActivityWindowListResponse DeserializeActivityWindow(string jsonRequest, string jsonResponse) { var handler = new MockHttpPostListWindowsDelegatingHandler() { JsonRequest = jsonRequest, JsonResponse = jsonResponse }; var client = GetFakeClient(handler); ActivityWindowsByDataFactoryListParameters request = JsonConvert.DeserializeObject <ActivityWindowsByDataFactoryListParameters>(jsonRequest); ActivityWindowListResponse listResponse = client.ActivityWindows.ListByDataFactory(request); return(listResponse); }
/// <summary> /// Deserializes the given json into an Hydra OM ActivityWindow instance, by mocking a get request to /// exercise the client's deserialization logic. /// </summary> /// <param name="json">The JSON string to deserialize.</param> /// <returns></returns> internal static ActivityWindowListResponse DeserializeActivityWindow(string json) { var handler = new MockResourceProviderDelegatingHandler() { Json = json }; var client = GetFakeClient(handler); string resourceGroupName = Guid.NewGuid().ToString("D"); string dataFactoryName = Guid.NewGuid().ToString("D"); ActivityWindowsByDataFactoryListParameters listParameters = new ActivityWindowsByDataFactoryListParameters( resourceGroupName, dataFactoryName); ActivityWindowListResponse listResponse = client.ActivityWindows.ListByDataFactory(listParameters); return(listResponse); }
private void ValidateActivityWindowsParameters(string jsonActual) { ActivityWindowsByDataFactoryListParameters actual = JsonConvert.DeserializeObject <ActivityWindowsByDataFactoryListParameters>(jsonActual); ActivityWindowsByDataFactoryListParameters expected = JsonConvert.DeserializeObject <ActivityWindowsByDataFactoryListParameters>(this.JsonRequest); if (actual != null && expected != null) { Type type = typeof(ActivityWindowsByDataFactoryListParameters); foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) { object actualValue = type.GetProperty(pi.Name).GetValue(actual, null); object expectedValue = type.GetProperty(pi.Name).GetValue(expected, null); if (actualValue != expectedValue && (actualValue == null || !actualValue.Equals(expectedValue))) { throw new Exception(string.Format(CultureInfo.InvariantCulture, "Validation of ListActivityWindows failed because the actual parameter serialized does not match the expected. actual={0}, expected={1}.", jsonActual, this.JsonRequest)); } } } }
/// <summary> /// Gets the first page of activity window instances for a data factory /// with the link to the next page. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.Core.IActivityWindowOperations. /// </param> /// <param name='parameters'> /// Required. Activity windows list optional filter parameters. /// </param> /// <returns> /// The List activity windows operation response. /// </returns> public static Task <ActivityWindowListResponse> ListAsync(this IActivityWindowOperations operations, ActivityWindowsByDataFactoryListParameters parameters) { return(operations.ListAsync(parameters, CancellationToken.None)); }
/// <summary> /// Gets the first page of activity window instances for a data factory /// with the link to the next page. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.DataFactories.Core.IActivityWindowOperations. /// </param> /// <param name='parameters'> /// Required. Activity windows list optional filter parameters. /// </param> /// <returns> /// The List activity windows operation response. /// </returns> public static ActivityWindowListResponse List(this IActivityWindowOperations operations, ActivityWindowsByDataFactoryListParameters parameters) { return(Task.Factory.StartNew((object s) => { return ((IActivityWindowOperations)s).ListAsync(parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
public async Task <ActivityWindowListResponse> ListNextAsync(string nextLink, ActivityWindowsByDataFactoryListParameters parameters, CancellationToken cancellationToken) { return(await this.Client.InternalClient.ActivityWindows.ListNextByDataFactoryAsync(nextLink, parameters, cancellationToken)); }