remkop commented on code in PR #824:
URL: https://github.com/apache/logging-log4j2/pull/824#discussion_r853506746


##########
log4j-core/src/test/java/org/apache/logging/log4j/core/async/AsyncWaitStrategyFactoryConfigTest.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.logging.log4j.core.async;
+
+import com.lmax.disruptor.TimeoutBlockingWaitStrategy;
+import com.lmax.disruptor.WaitStrategy;
+import com.lmax.disruptor.YieldingWaitStrategy;
+import org.apache.logging.log4j.categories.AsyncLoggers;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.junit.LoggerContextSource;
+import org.apache.logging.log4j.junit.Named;
+import org.apache.logging.log4j.test.appender.ListAppender;
+import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+@Category(AsyncLoggers.class)
+public class AsyncWaitStrategyFactoryConfigTest {
+
+    @Test
+    @LoggerContextSource("AsyncWaitStrategyFactoryConfigTest.xml")
+    public void testConfigWaitStrategyFactory(final LoggerContext context) 
throws Exception {
+        AsyncWaitStrategyFactory asyncWaitStrategyFactory = 
context.getConfiguration().getAsyncWaitStrategyFactory();
+        assertEquals(YieldingWaitStrategyFactory.class, 
asyncWaitStrategyFactory.getClass());
+        assertThat("factory is YieldingWaitStrategyFactory", 
asyncWaitStrategyFactory instanceof YieldingWaitStrategyFactory);
+    }
+
+    @Test
+    @LoggerContextSource("AsyncWaitStrategyFactoryConfigTest.xml")
+    public void testWaitStrategy(final LoggerContext context) throws Exception 
{
+
+        org.apache.logging.log4j.Logger logger = context.getRootLogger();
+
+        AsyncLoggerConfig loggerConfig = (AsyncLoggerConfig) 
((org.apache.logging.log4j.core.Logger) logger).get();
+        AsyncLoggerConfigDisruptor delegate = (AsyncLoggerConfigDisruptor) 
loggerConfig.getAsyncLoggerConfigDelegate();
+        assertEquals(YieldingWaitStrategy.class, 
delegate.waitStrategy.getClass());
+        assertThat("waitstrategy is YieldingWaitStrategy", 
delegate.waitStrategy instanceof com.lmax.disruptor.YieldingWaitStrategy);

Review Comment:
   Oops yes I missed that. Fixed now. Thank you!



-- 
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]

Reply via email to