Example #1
0
 public static string Serialize(BISpecification obj)
 {
     using (MemoryStream stream = new MemoryStream())
     {
         DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(BISpecification));
         json.WriteObject(stream, obj);
         return(Encoding.UTF8.GetString(stream.ToArray()));
     }
 }
Example #2
0
        public static List <BISpecification> TransformFromApp(List <Specification> specs)
        {
            List <BISpecification> biSpecs = new List <BISpecification>();

            foreach (var spec in specs)
            {
                BISpecification biSpec = TransformFromApp(spec);
                biSpecs.Add(biSpec);
            }

            return(biSpecs);
        }
Example #3
0
        static void test_transformSpec()
        {
            TbiesIntf intf = new TbiesIntf("192.168.56.2");

            List <Specification>   specs   = intf.getSpecsBrief();
            List <BISpecification> biSpecs = BISpecification.transformFromApp(specs);

            Debug.Assert(biSpecs.Count > 0);

            foreach (var spec in specs)
            {
                Specification   wholeSpec = intf.getSpec(spec.name);
                BISpecification biSpec    = BISpecification.transformFromApp(wholeSpec);
                Debug.Assert(biSpec.Specification != null);
                Debug.Assert(biSpec.Configuration != null);
            }
        }
Example #4
0
        public static BISpecification TransformFromApp(Specification spec)
        {
            BISpecification biSpec = new BISpecification();

            biSpec.Plan    = spec.name;
            biSpec.Version = spec.version;
            biSpec.Driver  = spec.product;

            if (spec.content != null)
            {
                string span      = "";
                string interval  = "";
                var    biConfigs = ExtractSpanInterval(spec.content.Configuration, out span, out interval);

                biSpec.Span     = span;
                biSpec.Interval = interval;

                biSpec.Configuration = biConfigs as List <ConditionItem>;
                biSpec.Specification = spec.content.Specification as List <SpecItem>;
            }

            return(biSpec);
        }
Example #5
0
        public string GetDriverType(string plan)
        {
            BISpecification spec = FetchSpecificationSet(plan);

            return(spec.Driver);
        }