Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }