Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logConstraintJobProgress() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LogConstraintJobProgress()
        {
            // Given
            CreateNode(map(_name, "irrelephant"), _first);
            AssertableLogProvider logProvider = new AssertableLogProvider();
            FlippableIndexProxy   index       = mock(typeof(FlippableIndexProxy));

            when(index.State).thenReturn(InternalIndexState.POPULATING);
            IndexPopulator populator = spy(IndexPopulator(false));

            try
            {
                IndexPopulationJob job = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, true));

                // When
                job.Run();

                // Then
                AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
                logProvider.AssertExactly(match.info("Index population started: [%s]", ":FIRST(name)"), match.info("Index created. Starting data checks. Index [%s] is %s.", ":FIRST(name)", "POPULATING"), match.info(containsString("TIME/PHASE Final: SCAN[")));
            }
            finally
            {
                populator.Close(true);
            }
        }
Ejemplo n.º 2
0
        private AssertableLogProvider.LogMatcher CurrentLog(AssertableLogProvider.LogMatcherBuilder logMatcherBuilder, Matcher <string> stringMatcher)
        {
            switch (_logName)
            {
            case "debug":
                return(logMatcherBuilder.Debug(stringMatcher));

            case "info":
                return(logMatcherBuilder.Info(stringMatcher));

            case "warn":
                return(logMatcherBuilder.Warn(stringMatcher));

            case "error":
                return(logMatcherBuilder.Error(stringMatcher));

            default:
                throw new Exception("Unknown log name");
            }
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogJobFailure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogJobFailure()
        {
            // Given
            CreateNode(map(_name, "irrelephant"), _first);
            AssertableLogProvider logProvider = new AssertableLogProvider();
            FlippableIndexProxy   index       = mock(typeof(FlippableIndexProxy));
            IndexPopulator        populator   = spy(IndexPopulator(false));
            IndexPopulationJob    job         = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, false));

            Exception failure = new System.InvalidOperationException("not successful");

            doThrow(failure).when(populator).create();

            // When
            job.Run();

            // Then
            AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
            logProvider.AssertAtLeastOnce(match.error(@is("Failed to populate index: [:FIRST(name)]"), sameInstance(failure)));
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogUserReadableLabelAndPropertyNames() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogUserReadableLabelAndPropertyNames()
        {
            //noinspection deprecation
            GraphDatabaseAPI db = DbRule.GraphDatabaseAPI;

            string labelName = "User";
            string property  = "name";

            // when
            CreateIndex(db, labelName, property);

            // then
            AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
            IndexProviderMap        indexProviderMap      = Db.DependencyResolver.resolveDependency(typeof(IndexProviderMap));
            IndexProvider           defaultProvider       = indexProviderMap.DefaultProvider;
            IndexProviderDescriptor providerDescriptor    = defaultProvider.ProviderDescriptor;

            _logProvider.assertAtLeastOnce(match.info("Index population started: [%s]", ":User(name) [provider: {key=" + providerDescriptor.Key + ", version=" + providerDescriptor.Version + "}]"));

            assertEventually((ThrowingSupplier <object, Exception>)() => null, new LogMessageMatcher(this, match, providerDescriptor), 1, TimeUnit.MINUTES);
        }
Ejemplo n.º 5
0
 internal MatcherBuilder(AssertableLogProvider.LogMatcherBuilder builder)
 {
     this.Builder = builder;
 }
Ejemplo n.º 6
0
 internal LogMessageMatcher(SchemaLoggingIT outerInstance, AssertableLogProvider.LogMatcherBuilder match, IndexProviderDescriptor descriptor)
 {
     this._outerInstance = outerInstance;
     this.Match          = match;
     this.Descriptor     = descriptor;
 }