Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void indexUpgraderInvokesLuceneMigrator() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndexUpgraderInvokesLuceneMigrator()
        {
            IndexUpgraderWrapper upgrader = GetIndexUpgrader(CreateJarLoader());

            UpgraderStub.ResetInvocationMark();
            upgrader.UpgradeIndex(Paths.get("some"));
            assertTrue(UpgraderStub.InvocationMark);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void indexUpgraderReleaseResourcesOnClose() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndexUpgraderReleaseResourcesOnClose()
        {
            EmbeddedJarLoader    jarLoader = CreateJarLoader();
            IndexUpgraderWrapper upgrader  = GetIndexUpgrader(jarLoader);

            upgrader.UpgradeIndex(Paths.get("some"));
            upgrader.Close();

            verify(jarLoader).close();
        }
Пример #3
0
        /// <summary>
        /// Perform index migrations </summary>
        /// <exception cref="ExplicitIndexMigrationException"> in case of exception during index migration </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void upgradeIndexes() throws ExplicitIndexMigrationException
        public virtual void UpgradeIndexes()
        {
            try
            {
                if (!Files.exists(_indexRootPath))
                {
                    return;
                }
                _monitor.starting(( int )Files.walk(_indexRootPath).count());
                using (Stream <Path> pathStream = Files.walk(_indexRootPath), IndexUpgraderWrapper lucene4Upgrader = CreateIndexUpgrader(Lucene4JarPaths), IndexUpgraderWrapper lucene5Upgrader = CreateIndexUpgrader(Lucene5JarPaths))
                {
                    IList <Path> indexPaths = pathStream.filter(IndexPathFilter).collect(Collectors.toList());
                    foreach (Path indexPath in indexPaths)
                    {
                        try
                        {
                            lucene4Upgrader.UpgradeIndex(indexPath);
                            lucene5Upgrader.UpgradeIndex(indexPath);
                            _monitor.migrated(indexPath.toFile().Name);
                        }
                        catch (Exception e)
                        {
                            throw new ExplicitIndexMigrationException(indexPath.FileName.ToString(), "Migration of explicit index at path:" + indexPath + " failed.", e);
                        }
                    }
                }
            }
            catch (ExplicitIndexMigrationException ime)
            {
                throw ime;
            }
            catch (Exception e)
            {
                throw new Exception("Lucene explicit indexes migration failed.", e);
            }
        }