Inheritance: INotifyPropertyChanging, INotifyPropertyChanged
Ejemplo n.º 1
0
 public static void UpdateActivity(IndexingActivity activity)
 {
     using (var context = new IndexingDataContext())
     {
         context.CommandTimeout = RepositoryConfiguration.SqlCommandTimeout;
         context.IndexingActivities.Attach(activity, true);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 2
0
 public static void RegisterActivity(IndexingActivity activity)
 {
     using (var context = new IndexingDataContext())
     {
         context.CommandTimeout = RepositoryConfiguration.SqlCommandTimeout;
         context.IndexingActivities.InsertOnSubmit(activity);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 3
0
 public static void RegisterActivity(IndexingActivity activity)
 {
     using (var context = new IndexingDataContext())
     {
         context.CommandTimeout = RepositoryConfiguration.SqlCommandTimeout;
         context.IndexingActivities.InsertOnSubmit(activity);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
 public static void UpdateActivity(IndexingActivity activity)
 {
     using (var context = new IndexingDataContext())
     {
         context.CommandTimeout = RepositoryConfiguration.SqlCommandTimeout;
         context.IndexingActivities.Attach(activity, true);
         context.SubmitChanges();
     }
 }
Ejemplo n.º 5
0
        public static void RegisterActivity(IndexingActivity activity)
        {
            var transaction = DataProvider.GetCurrentTransaction();

            using (var context = transaction == null ? new IndexingDataContext() : new IndexingDataContext(transaction))
            {
                context.CommandTimeout = RepositoryConfiguration.SqlCommandTimeout;
                context.IndexingActivities.InsertOnSubmit(activity);
                context.SubmitChanges();
            }
        }
Ejemplo n.º 6
0
        public static void ExecuteActivity(IndexingActivity activity, bool waitForComplete, bool distribute)
        {
            var lucAct = activity.CreateLuceneActivity();

            if (distribute)
            {
                lucAct.Distribute();
            }
            lucAct.InternalExecute();
            if (waitForComplete)
            {
                lucAct.WaitForComplete();
            }
        }
Ejemplo n.º 7
0
 internal static  LuceneIndexingActivity CreateLucActivity(IndexingActivity activity)
 {
     switch (activity.ActivityType)
     {
         case IndexingActivityType.AddDocument:
             return LuceneIndexingActivity.CreateFromIndexingActivity<AddDocumentActivity>(activity);
         case IndexingActivityType.AddTree:
             return LuceneIndexingActivity.CreateFromIndexingActivity<AddTreeActivity>(activity);
         case IndexingActivityType.UpdateDocument:
             return LuceneIndexingActivity.CreateFromIndexingActivity<UpdateDocumentActivity>(activity);
         case  IndexingActivityType.RemoveTree:
             return LuceneIndexingActivity.CreateFromIndexingActivity<RemoveTreeActivity>(activity);
         case IndexingActivityType.RemoveDocument:
             return LuceneIndexingActivity.CreateFromIndexingActivity<RemoveDocumentActivity>(activity);
     }
     throw new ArgumentException("Invalid ActivityType value", activity.ActivityType.ToString());
 }
Ejemplo n.º 8
0
        internal static LuceneIndexingActivity CreateLucActivity(IndexingActivity activity)
        {
            switch (activity.ActivityType)
            {
            case IndexingActivityType.AddDocument:
                return(LuceneIndexingActivity.CreateFromIndexingActivity <AddDocumentActivity>(activity));

            case IndexingActivityType.AddTree:
                return(LuceneIndexingActivity.CreateFromIndexingActivity <AddTreeActivity>(activity));

            case IndexingActivityType.UpdateDocument:
                return(LuceneIndexingActivity.CreateFromIndexingActivity <UpdateDocumentActivity>(activity));

            case  IndexingActivityType.RemoveTree:
                return(LuceneIndexingActivity.CreateFromIndexingActivity <RemoveTreeActivity>(activity));

            case IndexingActivityType.RemoveDocument:
                return(LuceneIndexingActivity.CreateFromIndexingActivity <RemoveDocumentActivity>(activity));
            }
            throw new ArgumentException("Invalid ActivityType value", activity.ActivityType.ToString());
        }
Ejemplo n.º 9
0
 partial void InsertIndexingActivity(IndexingActivity instance);
Ejemplo n.º 10
0
        public void Indexing_ExecuteLostIndexingActivities()
        {
            lock (LuceneManager._executingUnprocessedIndexingActivitiesLock)    // make sure indexhealthmonitor will not overlap
            {
                var initInfo = InitCarsForUnprocessedTests();
                var carlist = initInfo.Item1;
                var lastActivityId = initInfo.Item2;
                var expectedLastActivityId = initInfo.Item3;

                // generate a gap and delete corresponding documents from index
                var activities = GetCarActivities(lastActivityId);
                var activitiesToDelete = new IndexingActivity[] { activities[0], activities[2], activities[5], activities[7], activities[8] };

                MissingActivityHandler.SetGap(activitiesToDelete.Select(a => a.IndexingActivityId).ToList());   // 0,2,5,7,8 will be missing

                // commit gap and maxactivityid to the index
                EnsureWriterHasChanges();
                LuceneManager.Commit(true);

                foreach (var activity in activitiesToDelete)
                {
                    DeleteVersionFromIndex(activity.VersionId);
                    DeleteVersionIdFromIndexingHistory(activity.VersionId);
                }


                // check: cars deleted can NOT be found in the index
                for (var i = 0; i < carlist.Count; i++)
                {
                    var id = carlist[i].Id;
                    if (activitiesToDelete.Select(a => a.NodeId).Contains(id))
                        Assert.IsFalse(CheckCarInIndex(id), "Deleted car can still be found in the index.");    // deleted car should not be in index
                    else
                        Assert.IsTrue(CheckCarInIndex(id), "Untouched car can not be found in the index.");     // untouched car should still be in index
                }


                // make sure to move current gap to oldest gap, since always the oldest gap will get processed
                for (var i = 0; i < MissingActivityHandler.GapSegments - 1; i++)
                    MissingActivityHandler.GetOldestGapAndMoveToNext();

                // execute unprocessed indexing tasks
                LuceneManager.ExecuteLostIndexingActivities();


                // check: all cars can be found in the index again
                for (var i = 0; i < carlist.Count; i++)
                {
                    Assert.IsTrue(CheckCarInIndex(carlist[i].Id), "ExecuteLostIndexingActivities did not repair lost document.");
                }

                Assert.AreEqual(expectedLastActivityId, MissingActivityHandler.MaxActivityId, "Maxtaskid is not what is expected.");
                Assert.AreEqual(0, MissingActivityHandler.GetGap().Count, "Gap size is not 0.");
            }
        }
Ejemplo n.º 11
0
        public static void ExecuteActivityDirect(IndexingActivity activity)
        {
            var lucAct = activity.CreateLuceneActivity();

            lucAct.Execute();
        }
Ejemplo n.º 12
0
 partial void UpdateIndexingActivity(IndexingActivity instance);
Ejemplo n.º 13
0
 partial void InsertIndexingActivity(IndexingActivity instance);
Ejemplo n.º 14
0
 partial void DeleteIndexingActivity(IndexingActivity instance);
Ejemplo n.º 15
0
 public static void ExecuteActivity(IndexingActivity activity, bool waitForComplete, bool distribute)
 {
     var lucAct = activity.CreateLuceneActivity();
     //TODO: we need to call waitmultiple here
     if (distribute)
         lucAct.Distribute();
     lucAct.InternalExecute();
     if (waitForComplete)
         lucAct.WaitForComplete();
 }
Ejemplo n.º 16
0
 partial void UpdateIndexingActivity(IndexingActivity instance);
Ejemplo n.º 17
0
 public static void ExecuteActivityDirect(IndexingActivity activity)
 {
     var lucAct = activity.CreateLuceneActivity();
     lucAct.Execute();
 }
Ejemplo n.º 18
0
 private static void ExecuteActivity(IndexingActivity activity)
 {
     IndexingActivityManager.RegisterActivity(activity);
     IndexingActivityManager.ExecuteActivity(activity, true, true);
 }
Ejemplo n.º 19
0
 partial void DeleteIndexingActivity(IndexingActivity instance);
Ejemplo n.º 20
0
        [Description("An activity execution with update activity after delete activity not throws any exception.")] // ??
        public void Indexing_ActivitesWithMissingVersion()
        {
            var content = Content.CreateNew("Car", TestRoot, "Car_Indexing_ActivitesWithMissingVersion");
            var handler = (GenericContent)content.ContentHandler;
            //handler.VersioningMode = VersioningType.None;
            content.Save();
            var id = content.Id;

            LuceneManager.ApplyChanges();
            IndexingActivity[] act = new IndexingActivity[3];
            act[0] = new IndexingActivity
            {
                ActivityType = IndexingActivityType.RemoveDocument,
                NodeId = _fakeId,
                VersionId = _fakeId
            };
            act[1] = new IndexingActivity
            {
                ActivityType = IndexingActivityType.UpdateDocument,
                NodeId = _fakeId,
                VersionId = _fakeId
            };
            act[2] = new IndexingActivity
            {
                ActivityType = IndexingActivityType.AddDocument,
                NodeId = _fakeId,
                VersionId = _fakeId
            };

            try
            {
                using (var context = new IndexingDataContext())
                {
                    foreach (var a in act)
                    {
                        context.IndexingActivities.InsertOnSubmit(a);
                        context.SubmitChanges();
                    }
                }

                var max = 0;
                var activities = IndexingActivityManager.GetUnprocessedActivities(act[2].IndexingActivityId - 1, out max);
                foreach (var a in activities)
                    IndexingActivityManager.ExecuteActivityDirect(a);
            }
            finally
            {
                RemoveFakeTestActivity();
            }

        }
Ejemplo n.º 21
0
 private static void ExecuteActivity(IndexingActivity activity)
 {
     IndexingActivityManager.RegisterActivity(activity);
     IndexingActivityManager.ExecuteActivity(activity, true, true);
 }