uds5501 commented on code in PR #18341: URL: https://github.com/apache/druid/pull/18341#discussion_r2263217139
########## indexing-service/src/test/java/org/apache/druid/guice/IndexingServiceTaskLogsModuleTest.java: ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.guice; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.Key; +import com.google.inject.Scopes; +import com.google.inject.name.Names; +import org.apache.druid.indexing.common.tasklogs.FileTaskLogs; +import org.apache.druid.indexing.common.tasklogs.SwitchingTaskLogs; +import org.apache.druid.jackson.JacksonModule; +import org.apache.druid.tasklogs.NoopTaskLogs; +import org.apache.druid.tasklogs.TaskLogs; +import org.junit.Assert; +import org.junit.Test; + +import javax.validation.ConstraintViolation; +import javax.validation.Validator; +import javax.validation.executable.ExecutableValidator; +import javax.validation.metadata.BeanDescriptor; +import java.util.Collections; +import java.util.Properties; +import java.util.Set; + +public class IndexingServiceTaskLogsModuleTest +{ + + @Test + public void test_switchingTaskLogs_shouldUseDefaultWhenNoPusherConfigured() + { + Properties props = new Properties(); + props.setProperty("druid.indexer.logs.type", "switching"); + props.setProperty("druid.indexer.logs.switching.defaultType", "file"); + + Injector injector = Guice.createInjector( + binder -> { + binder.bindScope(LazySingleton.class, Scopes.SINGLETON); + binder.bind(Properties.class).toInstance(props); + binder.bind(Validator.class).toInstance(new MockValidator()); Review Comment: Not including these makes the test fail with ``` 1) [Guice/MissingImplementation]: No implementation for Validator was bound. Requested by: 1 : JsonConfigurator.<init>(JsonConfigurator.java:84) \_ for 2nd parameter at JsonConfigProvider.inject(JsonConfigProvider.java:233) \_ for 2nd parameter at JsonConfigProvider.inject(JsonConfigProvider.java:233) at JsonConfigProvider.bind(JsonConfigProvider.java:151) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
