Пример #1
0
        public void GetStatusForAllCores()
        {
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(SolrUrl), GetHeaderParser(), GetStatusResponseParser());

            var results = solrCoreAdmin.Status();

            Assert.IsNotEmpty(results);
        }
Пример #2
0
        public void GetStatusForNamedCore()
        {
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(SolrUrl), GetHeaderParser(), GetStatusResponseParser());

            var result = solrCoreAdmin.Status(CoreNew);

            Assert.IsNotEmpty(result.Name);
            Assert.AreEqual(CoreNew, result.Name);
        }
Пример #3
0
        public void GetStatusForNamedCore()
        {
            var coreName      = "core-new";
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(solrUrl), GetHeaderParser(), GetStatusResponseParser());

            var result = solrCoreAdmin.Status(coreName);

            Assert.NotEmpty(result.Name);
            Assert.Equal(coreName, result.Name);
        }
Пример #4
0
        public void CreateSwapCore()
        {
            var coreName      = "core-swap";
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(solrUrl), GetHeaderParser(), GetStatusResponseParser());

            var createResponseHeader = solrCoreAdmin.Create(coreName, instanceDir);

            Assert.AreEqual(createResponseHeader.Status, 0);
            var result = solrCoreAdmin.Status(coreName);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Name);
            Assert.AreEqual(coreName, result.Name);
        }
Пример #5
0
        public void CreateSwapCore()
        {
            var istanceDir = DirectoryUtility.GetCoreIstanceDirectory(CoreSwap);

            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(SolrUrl), GetHeaderParser(), GetStatusResponseParser());

            var createResponseHeader = solrCoreAdmin.Create(CoreSwap, istanceDir);

            Assert.AreEqual(createResponseHeader.Status, 0);
            var result = solrCoreAdmin.Status(CoreSwap);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Name);
            Assert.AreEqual(CoreSwap, result.Name);
        }
Пример #6
0
        public void Create()
        {
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(SolrUrl), GetHeaderParser(), GetStatusResponseParser());
            var status        = solrCoreAdmin.Status(CoreNew);

            if (!string.IsNullOrEmpty(status.Name))
            {
                solrCoreAdmin.Unload(CoreNew);
            }
            try {
                var createResponseHeader = solrCoreAdmin.Create(CoreNew, null, null, null, null);
            } catch (ArgumentException) {
                // Should get an Exception here because instance directory was not specified.
                var istanceDir           = DirectoryUtility.GetCoreIstanceDirectory(CoreNew);
                var createResponseHeader = solrCoreAdmin.Create(CoreNew, istanceDir);
                Assert.AreEqual(createResponseHeader.Status, 0);
            }

            var result = solrCoreAdmin.Status(CoreNew);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Name);
            Assert.AreEqual(CoreNew, result.Name);
        }
Пример #7
0
        public void Alias()
        {
            var istanceDir    = DirectoryUtility.GetCoreIstanceDirectory(CoreNew);
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(SolrUrl), GetHeaderParser(), GetStatusResponseParser());
            var status        = solrCoreAdmin.Status(CoreNew);

            if (string.IsNullOrEmpty(status.Name))
            {
                solrCoreAdmin.Create(CoreNew, istanceDir);
            }


            var aliasResponseHeader = solrCoreAdmin.Alias(CoreNew, "corefoo");

            Assert.AreEqual(aliasResponseHeader.Status, 0);
        }
Пример #8
0
        public void Create()
        {
            var coreName      = "core-new";
            var solrCoreAdmin = new SolrCoreAdmin(new SolrConnection(solrUrl), GetHeaderParser(), GetStatusResponseParser());

            try {
                var createResponseHeader = solrCoreAdmin.Create(coreName, null, null, null, null);
            } catch (ArgumentException) {
                // Should get an Exception here because instance directory was not specified.
                var createResponseHeader = solrCoreAdmin.Create(coreName, instanceDir);
                Assert.AreEqual(createResponseHeader.Status, 0);
            }

            var result = solrCoreAdmin.Status(coreName);

            Assert.IsNotNull(result);
            Assert.IsNotEmpty(result.Name);
            Assert.AreEqual(coreName, result.Name);
        }