private Pipeline ConvertToWrapper(string json) { CoreModel.Pipeline internalPipeline = Core.DataFactoryManagementClient.DeserializeInternalPipelineJson(json); return(this.Operations.Converter.ToWrapperType(internalPipeline)); }
private void TestPipelineJson(JsonSampleInfo sampleInfo) { string json = sampleInfo.Json; Pipeline pipeline = this.ConvertToWrapper(json); CoreModel.Pipeline actual = this.Operations.Converter.ToCoreType(pipeline); string actualJson = Core.DataFactoryManagementClient.SerializeInternalPipelineToJson(actual); JsonComparer.ValidateAreSame(json, actualJson, ignoreDefaultValues: true); Assert.DoesNotContain("ServiceExtraProperties", actualJson); if (sampleInfo.Version == null || !sampleInfo.Version.Equals(JsonSampleType.Unregistered, StringComparison.OrdinalIgnoreCase)) { foreach (Activity activity in pipeline.Properties.Activities) { Assert.IsNotType <GenericActivity>(activity.TypeProperties); } } JObject actualJObject = JObject.Parse(actualJson); JsonComparer.ValidatePropertyNameCasing(actualJObject, true, string.Empty, sampleInfo.PropertyBagKeys); }
private Core.Models.PipelineCreateOrUpdateParameters ValidateAndConvert(PipelineCreateOrUpdateParameters parameters) { // Validate Ensure.IsNotNull(parameters, "parameters"); Ensure.IsNotNull(parameters.Pipeline, "parameters.Pipeline"); this.ValidateObject(parameters.Pipeline); // Convert Core.Models.Pipeline internalPipeline = this.Converter.ToCoreType(parameters.Pipeline); return(new Core.Models.PipelineCreateOrUpdateParameters() { Pipeline = internalPipeline }); }
/// <summary> /// Serializes the given Pipeline into JSON, by mocking a create request to /// exercise the client's serialization logic. /// </summary> /// <param name="item">The object to serialize.</param> /// <returns></returns> internal static string SerializeInternalPipelineToJson(Models.Pipeline item) { var createParams = new Models.PipelineCreateOrUpdateParameters() { Pipeline = item }; var handler = new MockResourceProviderDelegatingHandler(); var client = GetFakeClient(handler); string resourceGroupName = Guid.NewGuid().ToString("D"); string dataFactoryName = Guid.NewGuid().ToString("D"); client.Pipelines.BeginCreateOrUpdate(resourceGroupName, dataFactoryName, createParams); return(handler.Json); }
public Pipeline ADFPipelineFromJson(JObject jsonObject) { Type dynClass; MethodInfo dynMethod; string objectType = "Pipeline"; MapConfigElements(ref jsonObject); MapSlices(ref jsonObject); dynClass = new Core.DataFactoryManagementClient().GetType(); dynMethod = dynClass.GetMethod("DeserializeInternal" + objectType + "Json", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); CoreModels.Pipeline internalObject = (CoreModels.Pipeline)dynMethod.Invoke(this, new object[] { jsonObject.ToString() }); dynClass = Type.GetType(dynClass.AssemblyQualifiedName.Replace("Core.DataFactoryManagementClient", "Conversion." + objectType + "Converter")); ConstructorInfo constructor = dynClass.GetConstructor(Type.EmptyTypes); object classObject = constructor.Invoke(new object[] { }); dynMethod = dynClass.GetMethod("ToWrapperType", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); Pipeline ret = (Pipeline)dynMethod.Invoke(classObject, new object[] { internalObject }); return(ret); }