Exemplo n.º 1
0
        public void TestContentWithCount()
        {
            /*
             * Configuration : TABLE;GENERIC_GRAPH;COL1=METRICS,ROW1=SNAPSHOTS,METRICS=60014|60017|60013,SNAPSHOTS=CURRENT
             * @".\Data\TechSizeModTechnoCurrent.json" => http://localhost:7070/CAST-RESTAPI/rest/AED/applications/3/snapshots/4/results?sizing-measures=(10151,10152)&modules=($all)&technologies=($all)
             */

            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\TechSizeModTechnoCurrent.json", "AED/applications/3/snapshots/4", "Snap_v1.1.4", "v1.1.4",
                                                                null, null, null, null, null);

            reportData.CurrentSnapshot.Technologies = new[] { "JEE", "PL/SQL" };
            ReportingParameter repParam = new ReportingParameter {
                NbResultDefault = 5
            };

            reportData.Parameter = repParam;

            var component = new PieTechnoLoC();

            Dictionary <string, string> config = new Dictionary <string, string>
            {
                { "COUNT", "1" }
            };
            var table        = component.Content(reportData, config);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Name", "LoC"
            });
            expectedData.AddRange(new List <string> {
                "JEE", "89848"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 2);
        }
Exemplo n.º 2
0
    /// <summary>
    /// Creates a list of report reporting parameter that should dynamically be added to the
    /// Report Designer's report parameter list.
    /// </summary>
    public override IEnumerable <IReportingParameter> CreateParameters(object dataSource, IDataCollector dataCollector)
    {
        var list      = new List <IReportingParameter>();
        var dataTable = dataSource as DataTable;

        // Create the MissionName ReportingParameter
        var missionName          = dataTable.Rows.Count > 0 ?  dataTable.Rows[0]["Missions"] : "Unknown";
        var missionNameParameter = new  ReportingParameter(
            "MissionName",
            typeof(string),
            missionName);

        missionNameParameter.Visible = false;

        list.Add(missionNameParameter);

        // Create the Product / Function selection Reporting parameter
        list.Add(
            new ReportingParameter(
                "ProductFunction",
                typeof(string),
                "Product",
                "[ProductFunction] = ?" + ReportingParameter.NamePrefix + "ProductFunction")
            .AddLookupValue("Product", "Product")
            .AddLookupValue("Function", "Function")
            );

        // Create the Parameter selection ReportingParameter
        var parameterTypeSelection = new ReportingParameter(
            "ParameterName",
            typeof(string),
            "P_mean");

        // Add a LookupValue for every ParameterName found in Variables.ParameterOrder
        foreach (var keyValuePair in Variables.ParameterOrder)
        {
            parameterTypeSelection.AddLookupValue(keyValuePair.Key, keyValuePair.Key);
        }
        parameterTypeSelection.IsMultiValue = true;

        list.Add(parameterTypeSelection);


        var optionDependentDataCollector = dataCollector as IOptionDependentDataCollector;

        // Get the selected option.
        var optionName = optionDependentDataCollector.SelectedOption.Name;

        // Create a dynamic parameter for use in the report header
        var optionNameParameter = new ReportingParameter(
            "OptionName",
            typeof(string),
            optionName);

        optionNameParameter.Visible = false;
        list.Add(optionNameParameter);

        return(list);
    }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static List <FileInfo> GetTemplateFileListPortfolio()
 {
     using (ISettingRepository setttingRepository = new SettingsRepository())
     {
         ReportingParameter rp = new ReportingParameter();
         string             templateFilePath = setttingRepository.GetSeting().ReportingParameter.TemplatePath;
         return(setttingRepository.GetTemplateFileList(templateFilePath + rp.PortfolioFolderNamePath));
     }
 }
Exemplo n.º 4
0
	/// <summary>
	/// Creates a list of report reporting parameter that should dynamically be added to the
	/// Report Designer's report parameter list.
	/// </summary>
	public override IEnumerable<IReportingParameter> CreateParameters(object dataSource, IDataCollector dataCollector) {
	    var list = new List<IReportingParameter>();
	    var optionDependentDataCollector = dataCollector as IOptionDependentDataCollector;

		// Get the selected option.
		var optionName = optionDependentDataCollector.SelectedOption.Name;

		// Create a dynamic parameter for use in the report header
		var optionNameParameter = new ReportingParameter(
					"OptionName",
					typeof(string),
					optionName);
		optionNameParameter.Visible = false;
		list.Add(optionNameParameter);

		return list;
	}
        public void TestContent()
        {
            /*
             * Configuration : TABLE;GENERIC_GRAPH;COL1=METRICS,ROW1=SNAPSHOTS,METRICS=60014|60017|60013,SNAPSHOTS=CURRENT
             * @".\Data\TechSizeModTechnoCurrent.json" => http://localhost:7070/CAST-RESTAPI/rest/AED/applications/3/snapshots/4/results?sizing-measures=(10151,10152)&modules=($all)&technologies=($all)
             */

            ReportData reportData = TestUtility.PrepaReportData("ReportGenerator",
                                                                null, @".\Data\TechSizeModTechnoCurrent.json", "AED/applications/3/snapshots/4", "Snap_v1.1.4", "v1.1.4",
                                                                null, null, null, null, null);

            ReportingParameter repParam = new ReportingParameter {
                NbResultDefault = 5
            };

            reportData.Parameter = repParam;

            var component = new PieModuleArtifact();

            var table        = component.Content(reportData, null);
            var expectedData = new List <string>();

            expectedData.AddRange(new List <string> {
                "Name", "Artifacts"
            });
            expectedData.AddRange(new List <string> {
                "sm-core/AppliAEPtran/Shopizer_src content", "5131"
            });
            expectedData.AddRange(new List <string> {
                "sm-central/AppliAEPtran/Shopizer_src content", "4344"
            });
            expectedData.AddRange(new List <string> {
                "sm-shop/AppliAEPtran/Shopizer_src content", "801"
            });
            expectedData.AddRange(new List <string> {
                "SHOPIZER/AppliAEPtran/Shopizer_sql content", "15"
            });
            TestUtility.AssertTableContent(table, expectedData, 2, 5);
        }
Exemplo n.º 6
0
    /// <summary>
    /// Creates a list of report reporting parameter that should dynamically be added to the
    /// Report Designer's report parameter list.
    /// </summary>
    public override IEnumerable <IReportingParameter> CreateParameters(object dataSource, IDataCollector dataCollector)
    {
        var list = new List <IReportingParameter>();

        var optionDependentDataCollector = dataCollector as IOptionDependentDataCollector;

        // Get the selected option.
        var option = optionDependentDataCollector.SelectedOption;

        // Get the selected options name.
        var optionName = option.Name;

        // Create a dynamic parameter for use in the report header
        var optionNameParameter = new ReportingParameter(
            "OptionName",
            typeof(string),
            optionName);

        optionNameParameter.Visible = false;
        list.Add(optionNameParameter);

        // Get the launcher mass using its Path property from the ProductTree.
        var launcherAdapterMass = string.IsNullOrWhiteSpace(Variables.LauncherAdapterPath) ? 0D : option.GetNestedParameterValuesByPath <double>(
            Variables.LauncherAdapterPath,
            Variables.NestedParameters)
                                  .FirstOrDefault();

        list.Add(new ReportingParameter(
                     "Launcher Adapter Mass",
                     typeof(double),
                     launcherAdapterMass
                     ));

        // Get the fuel mass using its Path property from the ProductTree.
        var fuelMass = string.IsNullOrWhiteSpace(Variables.FuelMassPath) ? 0D : option.GetNestedParameterValuesByPath <double>(
            Variables.FuelMassPath,
            Variables.NestedParameters)
                       .FirstOrDefault();

        list.Add(new ReportingParameter(
                     "CPROP Fuel Mass",
                     typeof(double),
                     fuelMass
                     ));

        // Get the oxidizer mass using its Path property from the ProductTree.
        var oxidizerMass = string.IsNullOrWhiteSpace(Variables.OxidizerMassPath) ? 0D : option.GetNestedParameterValuesByPath <double>(
            Variables.OxidizerMassPath,
            Variables.NestedParameters)
                           .FirstOrDefault();

        list.Add(new ReportingParameter(
                     "CPROP Oxidizer Mass",
                     typeof(double),
                     oxidizerMass
                     ));

        // Get the pressurant mass using its Path property from the ProductTree.
        var pressurantMass = string.IsNullOrWhiteSpace(Variables.PressurantMassPath) ? 0D : option.GetNestedParameterValuesByPath <double>(
            Variables.PressurantMassPath,
            Variables.NestedParameters)
                             .First();

        list.Add(new ReportingParameter(
                     "CPROP Pressurant Mass",
                     typeof(double),
                     pressurantMass
                     ));

        // Get the propellant mass using its Path property from the ProductTree.
        var propellantMass = string.IsNullOrWhiteSpace(Variables.PropellantMassPath) ? 0D : option.GetNestedParameterValuesByPath <double>(
            Variables.PropellantMassPath,
            Variables.NestedParameters)
                             .FirstOrDefault();

        list.Add(new ReportingParameter(
                     "EPROP Propellant Mass",
                     typeof(double),
                     propellantMass
                     ));


        var dataSet        = dataSource as DataSet;
        var dataTable      = dataSet.Tables["MainData"];
        var subsystemNames = new List <string>(Variables.SubsystemNames);

        // Create a table of distinct owners that are currently available in the "calculated"
        // datasource and merge that with the list of default SubSystems / Owners
        foreach (DataRow row in new DataView(dataTable).ToTable(true, "OwnerShortName").Rows)
        {
            var ownerShortName = row["OwnerShortName"].ToString();
            if (!subsystemNames.Contains(ownerShortName))
            {
                subsystemNames.Add(ownerShortName);
            }
        }

        // The report filter string to be set on the last added reporting filter
        var reportFilterString = string.Empty;

        // Create Product / Function parameters for every Owner
        foreach (var subSystem in subsystemNames.OrderBy(x => x))
        {
            var prodfuncParameter = new ReportingParameter(
                subSystem,
                typeof(string),
                "Product")
                                    .AddLookupValue("Product", "Product")
                                    .AddLookupValue("Function", "Function")
                                    .AddLookupValue("Not used", "Not used");

            prodfuncParameter.ForceDefaultValue = false;

            if (reportFilterString != string.Empty)
            {
                reportFilterString += " OR ";
            }
            reportFilterString += "[ProductFunction] = ?" + ReportingParameter.NamePrefix + subSystem + " And [OwnerShortName] == '" + subSystem + "'";

            list.Add(prodfuncParameter);
        }

        // Create a DataView that contains all Distinct values in the resultDataSource's SystemName_1 column,
        var systemsTable = new DataView(dataTable).ToTable(true, "SystemName_1");
        ReportingParameter systemParameter = null;

        reportFilterString = "(" + reportFilterString + ") AND [SystemName_1] = ?dyn_System_Name";

        // Add a parameter with a lookup value for every "root" System found in the data.
        foreach (DataRow row in systemsTable.Rows)
        {
            var systemName = row["SystemName_1"].ToString();
            if (systemParameter == null)
            {
                systemParameter = new ReportingParameter(
                    "System Name",
                    typeof(string),
                    systemName,
                    reportFilterString
                    );
                list.Insert(0, systemParameter);
            }
            systemParameter.AddLookupValue(systemName, systemName);
        }

        return(list);
    }