public void ParseLineTestCase()
        {
            //given
            SimpleCubeDescriptionFactory cf = new SimpleCubeDescriptionFactory();
            //when
            SimpleCubeDescription scd =
                cf
                .parseLine("Counter table name:  DMAGGR_SMACS")
                .parseLine("OLAP cube source: VI_DMAGGR_SMACS  ")
                .parseLine("OLAP cube Name:  \t SMACS")
                .parseLine("Measures COUNT")
                .parseLine("\tTOTAL_VOLUME")
                .parseLine("\tUPLINK")
                .parseLine("\tDOWNLINK")
                .parseLine("Dimensions	START_TIME")
                .parseLine("SUBSCRIBER_TYPE")
                .parseLine("	TRAFFIC_CATEGORY")
                .parseLine("	ROAMING OPERATOR")
                .parseLine("	ROAMING_ZONE")
                .parseLine("	NETWORK ELEMENT")
                .parseLine("Generate")
                .cubeDescriptionList[0];

            //then
            Assert.AreEqual("DMAGGR_SMACS", scd.counterTableName);
            Assert.AreEqual("SMACS", scd.olapCubeName);
            Assert.AreEqual("VI_DMAGGR_SMACS", scd.olapCubeSource);
            Assert.AreEqual(4, scd.measures.Length, string.Join(",", scd.measures));
            Assert.AreEqual(5, scd.dimensions.Length, string.Join(",", scd.dimensions));
            Assert.IsTrue(Array.Exists(scd.dimensions, delegate(string s){ return(s.Equals("NETWORK_ELEMENT")); }));
            //System.Console.WriteLine ();
        }
        public void CreationTestCase()
        {
            //given
            SimpleCubeDescriptionFactory cf = new SimpleCubeDescriptionFactory();
            //when
            SimpleCubeDescription scd =
                cf.setCounterTableName("COUNTER_TABLE_NAME")
                .setOlapCubeName("OLAP_CUBE_NAME")
                .setOlapCubeSource("OLAP_CUBE_SOURCE")
                .addDimension("DIM_1")
                .addDimension("DIM_2")
                .addOther("DIM_3")
                .addMeasure("MEASURE_1")
                .addMeasure("MEASURE_2")
                .addMeasure("MEASURE_3")
                .addOther("MEASURE_4")
                .create("")
                .cubeDescriptionList[0];

            //then
            Assert.AreEqual("COUNTER_TABLE_NAME", scd.counterTableName);
            Assert.AreEqual("OLAP_CUBE_NAME", scd.olapCubeName);
            Assert.AreEqual("OLAP_CUBE_SOURCE", scd.olapCubeSource);
            Assert.AreEqual(3, scd.dimensions.Length);
            Assert.AreEqual(4, scd.measures.Length);
        }
Exemplo n.º 3
0
 public void isNull()
 {
     if (cubeDescriptionPrototype == null)
     {
         cubeDescriptionPrototype = new SimpleCubeDescription();
     }
 }
Exemplo n.º 4
0
        public SimpleCubeDescriptionFactory()
        {
            measureList              = new List <String> ();
            dimensionList            = new List <String> ();
            cubeDescriptionList      = new List <SimpleCubeDescription>();
            cubeDescriptionPrototype = new SimpleCubeDescription();

            parseCommand = new Dictionary <Regex, ParserAction>()
            {
                { new Regex(@"Counter table name:\s+(?<word>\w+)\s?", RegexOptions.IgnoreCase), this.setCounterTableName },
                { new Regex(@"OLAP cube source:\s+(?<word>\w+)\s?", RegexOptions.IgnoreCase), this.setOlapCubeSource },
                { new Regex(@"OLAP cube Name:\s+(?<word>\w+)\s?", RegexOptions.IgnoreCase), this.setOlapCubeName },
                { new Regex(@"Measures\s+(?<word>[\w ]+)\s?", RegexOptions.IgnoreCase), this.addMeasure },
                { new Regex(@"Dimensions\s+(?<word>[\w ]+)\s?", RegexOptions.IgnoreCase), this.addDimension },
                { new Regex(@"Generate\s?", RegexOptions.IgnoreCase), this.create },
                { new Regex(@"\s+(?<word>[\w ]+)\s?", RegexOptions.IgnoreCase), this.addOther }
            };
            contextCommand = new Dictionary <State, ParserAction>()
            {
                { State.New, this.skip },
                { State.Property, this.skip },
                { State.Measure, this.addMeasure },
                { State.Dimension, this.addDimension }
            };
        }
Exemplo n.º 5
0
        public SimpleCubeDescriptionFactory create(String value)
        {
            isNull();
            cubeDescriptionPrototype.measures   = measureList.ToArray();
            cubeDescriptionPrototype.dimensions = dimensionList.ToArray();
            cubeDescriptionList.Add(cubeDescriptionPrototype);
            cubeDescriptionPrototype = new SimpleCubeDescription();
            measureList.Clear();
            dimensionList.Clear();

            OnChange("create", value);
            return(this);
        }
Exemplo n.º 6
0
 public void TestCase()
 {
     //given
     SimpleCubeDescription scd = new SimpleCubeDescription();
 }