Exemplo n.º 1
0
        static public TimelineIndex GetTimelineIndex(int userId)
        {
            Database      db = new Database();
            TimelineIndex ti = new TimelineIndex();

            ti.Timelines = db.Timelines.Where(x => x.UserID == userId).ToList();

            return(ti);
        }
Exemplo n.º 2
0
        // GET: Timeline
        public ActionResult Index()
        {
            TimelineIndex tli = DatabaseService.GetTimelineIndex(1);

            return(View("TimelineIndex", tli));
        }
Exemplo n.º 3
0
        private void MakeSureUncommittedChangesAreSortedCorrectly(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 300000, 100000, 500000, 900000, 800000);

            using (Transaction tx = _db.beginTx())
            {
                timestamps.addAll(CreateTimestamps(creator, timeline, 40000, 70000, 20000));
                assertEquals(SortedEntities(timestamps, false), asCollection(timeline.GetBetween(null, null).GetEnumerator()));
                tx.Success();
            }

            using (Transaction ignore = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, false), asCollection(timeline.GetBetween(null, null).GetEnumerator()));
            }
        }
Exemplo n.º 4
0
        private void MakeSureWeCanQueryLowerDefaultThan1970(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, -10000, 0, 10000);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, true), asCollection(timeline.GetBetween(null, 10000L, true).GetEnumerator()));
                tx.Success();
            }
        }
Exemplo n.º 5
0
        private void MakeSureRangesAreReturnedInCorrectReversedOrder(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 300000, 200000, 199999, 400000, 100000, 500000, 600000, 900000, 800000);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(SortedEntities(timestamps, true), asCollection(timeline.GetBetween(null, null, true).GetEnumerator()));
                tx.Success();
            }
        }
Exemplo n.º 6
0
        // ======== Tests, although private so that we can create two versions of each,
        // ======== one for nodes and one for relationships

        private void MakeSureFirstAndLastAreReturnedCorrectly(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline)
        {
            LinkedList <Pair <PropertyContainer, long> > timestamps = CreateTimestamps(creator, timeline, 223456, 12345, 432234);

            using (Transaction tx = _db.beginTx())
            {
                assertEquals(timestamps.get(1).first(), timeline.First);
                assertEquals(timestamps.Last.Value.first(), timeline.Last);
                tx.Success();
            }
        }
Exemplo n.º 7
0
        private Pair <PropertyContainer, long> CreateTimestampedEntity(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline, long timestamp)
        {
            PropertyContainer entity = creator.Create();

            timeline.Add(entity, timestamp);
            return(Pair.of(entity, timestamp));
        }
Exemplo n.º 8
0
 private LinkedList <Pair <PropertyContainer, long> > CreateTimestamps(EntityCreator <PropertyContainer> creator, TimelineIndex <PropertyContainer> timeline, params long[] timestamps)
 {
     using (Transaction tx = _db.beginTx())
     {
         LinkedList <Pair <PropertyContainer, long> > result = new LinkedList <Pair <PropertyContainer, long> >();
         foreach (long timestamp in timestamps)
         {
             result.AddLast(CreateTimestampedEntity(creator, timeline, timestamp));
         }
         tx.Success();
         return(result);
     }
 }