Exemplo n.º 1
0
        ///**
        // * Constructor for ShardedQueryImpl
        // *
        // * @param queryId the id of the query
        // * @param shards list of shards on which this query will be executed
        // * @param queryFactory factory that knows how to create the actual query we'll execute
        // * @param shardAccessStrategy the shard strategy for this query
        // */
        public ShardedQueryImpl(QueryId queryId,
                                List <IShard> shards,
                                IQueryFactory queryFactory,
                                IShardAccessStrategy shardAccessStrategy)
        {
            this.queryId             = queryId;
            this.shards              = shards;
            this.queryFactory        = queryFactory;
            this.shardAccessStrategy = shardAccessStrategy;
            this.queryCollector      = new ExitOperationsQueryCollector();

            Preconditions.CheckState(!(shards.Count == 0));
            foreach (IShard shard in shards)
            {
                Preconditions.CheckNotNull(shard);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Return a <see cref="IQuery"/> by a <see cref="QueryId"/>
 /// </summary>
 /// <param name="queryId">id of the Query</param>
 /// <returns>the Query uniquely identified by the given id (unique to the Shard)</returns>
 public IQuery GetQueryById(QueryId queryId)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 3
0
 /// <summary>
 /// TODO: Documentation
 /// </summary>
 /// <param name="id">the id of the Query with which the event should be associated</param>
 /// <param name="event">the event to add</param>
 public void AddQueryEvent(QueryId id, IQueryEvent @event)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 4
0
 /// <summary>
 /// TODO: documentation
 /// IQuery#UniqueResult()
 /// </summary>
 /// <param name="queryId"></param>
 /// <returns></returns>
 public object UniqueResult(QueryId queryId)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 5
0
 /// <summary>
 /// TODO: documentation
 /// IQuery#List()
 /// </summary>
 /// <param name="queryId"></param>
 /// <returns></returns>
 public IList<object> List(QueryId queryId)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 6
0
        public void TestAddQueryEvent()
        {
            ShardImpl shard = new ShardImpl(new ShardId(1), Stub<ISessionFactoryImplementor>());
            try {
              shard.AddQueryEvent(null, null);
              Assert.Fail("expected npe");
            } catch (NullReferenceException npe) {
              // good
            }

            QueryId queryId = new QueryId(1);
            try {
              shard.AddQueryEvent(queryId, null);
              Assert.Fail("expected npe");
            } catch (NullReferenceException npe) {
              // good
            }

            IQueryEvent qe = Stub<IQueryEvent>();
            try {
              shard.AddQueryEvent(null, qe);
              Assert.Fail("expected npe");
            } catch (NullReferenceException npe) {
              // good
            }

            shard.AddQueryEvent(queryId, qe);
            //assertNotNull(shard.getQueryEventMap());
            //assertEquals(1, shard.getQueryEventMap().size());
            //assertEquals(1, shard.getQueryEventMap().get(queryId).size());
            //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0));

            // now add another event to the same query
            IQueryEvent anotherQe = Stub<IQueryEvent>();
            shard.AddQueryEvent(queryId, anotherQe);
            //assertNotNull(shard.getQueryEventMap());
            //assertEquals(1, shard.getQueryEventMap().size());
            //assertEquals(2, shard.getQueryEventMap().get(queryId).size());
            //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0));
            //assertSame(anotherQe, shard.getQueryEventMap().get(queryId).get(1));

            // now add an event to a different query
            QueryId anotherQueryId = new QueryId(3);
            IQueryEvent yetAnotherQe = Stub<IQueryEvent>();
            shard.AddQueryEvent(anotherQueryId, yetAnotherQe);
            //assertNotNull(shard.getQueryEventMap());
            //assertEquals(2, shard.getQueryEventMap().size());
            //assertEquals(2, shard.getQueryEventMap().get(queryId).size());
            //assertSame(qe, shard.getQueryEventMap().get(queryId).get(0));
            //assertSame(anotherQe, shard.getQueryEventMap().get(queryId).get(1));
            //assertEquals(1, shard.getQueryEventMap().get(anotherQueryId).size());
            //assertSame(yetAnotherQe, shard.getQueryEventMap().get(anotherQueryId).get(0));
        }
Exemplo n.º 7
0
 public ListShardOperation(QueryId queryId, IShardedQuery shardedQuery)
 {
     this.queryId      = queryId;
     this.shardedQuery = shardedQuery;
 }
Exemplo n.º 8
0
 public UniqueResultShardOperation(QueryId queryId, IShardedQuery shardedQuery)
 {
     this.queryId      = queryId;
     this.shardedQuery = shardedQuery;
 }