示例#1
0
        public void CommitWithOptions2_WaitFlush()
        {
            var mocks         = new MockRepository();
            var connection    = mocks.StrictMock <ISolrConnection>();
            var headerParser  = mocks.StrictMock <ISolrHeaderResponseParser>();
            var executer      = mocks.StrictMock <ISolrQueryExecuter <TestDocumentWithoutUniqueKey> >();
            var docSerializer = mocks.StrictMock <ISolrDocumentSerializer <TestDocumentWithoutUniqueKey> >();

            With.Mocks(mocks)
            .Expecting(() => {
                Expect.On(connection)
                .Call(connection.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" />"))
                .Repeat.Once()
                .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
                Expect.On(headerParser)
                .Call(headerParser.Parse(null))
                .IgnoreArguments()
                .Return(new ResponseHeader());
            })
            .Verify(() => {
                var ops = new SolrBasicServer <TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
                ops.Commit(new CommitOptions {
                    WaitFlush = true
                });
            });
        }
示例#2
0
        public void Commit()
        {
            var connection = new MSolrConnection();

            connection.post &= x => x.Args("/update", "<commit />")
                               .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"))
                               .Expect(1);

            var headerParser = new MSolrHeaderResponseParser();

            headerParser.parse = headerParser.parse.Return(null);

            var ops = new SolrBasicServer <TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);

            ops.Commit(null);
            connection.post.Verify();
        }
示例#3
0
        public void CommitWithOptions2_WaitSearcher_WaitFlush()
        {
            var connection = new MSolrConnection();

            connection.post += (url, content) => {
                Assert.AreEqual("/update", url);
                Assert.AreEqual("<commit waitSearcher=\"true\" waitFlush=\"true\" />", content);
                return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
            };
            var headerParser = new MSolrHeaderResponseParser();

            headerParser.parse &= x => x.Stub();
            var ops = new SolrBasicServer <TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);

            ops.Commit(new CommitOptions {
                WaitSearcher = true, WaitFlush = true
            });
            Assert.AreEqual(1, connection.post.Calls);
        }
示例#4
0
        public void CommitWithOptions()
        {
            var connection = new MSolrConnection();

            connection.post += (url, content) => {
                Assert.AreEqual("/update", url);
                Assert.AreEqual("<commit />", content);
                return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
            };
            connection.post &= x => x.Expect(1);

            var headerParser = new MSolrHeaderResponseParser();

            headerParser.parse += _ => null;

            var ops = new SolrBasicServer <TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);

            ops.Commit(new CommitOptions());
            connection.post.Verify();
        }
示例#5
0
 public void CommitWithOptions2_WaitSearcher_WaitFlush()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithoutUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(connection)
                 .Call(connection.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" />"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer, null, headerParser, null, null, null);
             ops.Commit(new CommitOptions { WaitSearcher = true, WaitFlush = true });
         });
 }
示例#6
0
 public void CommitWithOptions()
 {
     var mocks = new MockRepository();
     var connection = mocks.CreateMock<ISolrConnection>();
     var executer = mocks.CreateMock<ISolrQueryExecuter<TestDocumentWithoutUniqueKey>>();
     var docSerializer = mocks.CreateMock<ISolrDocumentSerializer<TestDocumentWithoutUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(connection.Post("/update", "<commit waitSearcher=\"true\" waitFlush=\"true\" />"))
                              .Repeat.Once()
                              .Return(null))
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, executer, docSerializer);
             ops.Commit(new WaitOptions());
         });
 }
示例#7
0
 public void CommitWithOptions2_WaitSearcher_WaitFlush()
 {
     var connection = new MSolrConnection();
     connection.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<commit waitSearcher=\"true\" waitFlush=\"true\" />", content);
         return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
     };
     var headerParser = new MSolrHeaderResponseParser();
     headerParser.parse &= x => x.Stub();
     var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);
     ops.Commit(new CommitOptions { WaitSearcher = true, WaitFlush = true });
     Assert.AreEqual(1, connection.post.Calls);
 }
示例#8
0
        public void CommitWithOptions()
        {
            var connection = new MSolrConnection();
            connection.post += (url, content) => {
                Assert.AreEqual("/update", url);
                Assert.AreEqual("<commit />", content);
                return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
            };
            connection.post &= x => x.Expect(1);

            var headerParser = new MSolrHeaderResponseParser();
            headerParser.parse += _ => null;

            var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);
            ops.Commit(new CommitOptions());
            connection.post.Verify();
        }
示例#9
0
        public void Commit()
        {
            var connection = new MSolrConnection();
            connection.post &= x => x.Args("/update", "<commit />")
                                     .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"))
                                     .Expect(1);

            var headerParser = new MSolrHeaderResponseParser();
            headerParser.parse = headerParser.parse.Return(null);

            var ops = new SolrBasicServer<TestDocumentWithoutUniqueKey>(connection, null, null, null, headerParser, null, null, null);
            ops.Commit(null);
            connection.post.Verify();
        }