Beispiel #1
0
        private static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                if (args[0].Trim().Equals("dump",StringComparison.CurrentCultureIgnoreCase))
                {
                    if (args.Length == 2)
                    {
                        string url = args[1];

                        DoDumpConfig(url);
                    }

                    return;
                }
                if (args[0].Trim().Equals("fieldDump", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (args.Length == 3)
                    {
                        int workItemID = int.Parse(args[1]);
                        string url = args[2];

                        DoDumpFields(workItemID, url);
                    }

                    return;
                }
            }

            //load config
            var config = ConfigurationSettings.Load();

            //get solr
            Startup.Init<RequirementsDocument>(config.SolrUrl);
            var solr = ServiceLocator.Current.GetInstance<ISolrOperations<RequirementsDocument>>();
            solr.Commit();

            //get correct mapper for each project
            var mapperFactory = new MapperFactory();

            //foreach project
            foreach (var proj in config.Projects)
            {
                //get the workitems for that project
                var mapper = mapperFactory.GetMapperForProject(proj);
                RequirementsDocument[] docs = mapper.FindAllWorkItemsForProject();

                //submit them to solr
                solr.AddRange(docs, new AddParameters { CommitWithin = 10000 });
            }

            //commit and optimize
            solr.Commit();
            solr.Optimize();
        }
Beispiel #2
0
        private static void PopulatePivotalProject(MapperFactory mapperFactory, ISolrOperations<RequirementsDocument> solr)
        {
            Configuration.Project pivotproject = new Configuration.Project() { ProjectName = "Program Mgmt", SystemType = SystemType.Pivotal,Url = @"https://www.pivotaltracker.com/services/v3/" };

            var mapper = mapperFactory.GetMapperForProject(pivotproject);

            RequirementsDocument[] docs = mapper.FindAllWorkItemsForProject();

            //submit them to solr
            solr.AddRange(docs, new AddParameters { CommitWithin = 10000 });
        }