@@ -0,0 +1,2916 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache license, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License. You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the license for the specific language governing permissions and%0A * limitations under the license.%0A */%0Apackage org.apache.logging.log4j.mongodb;%0A%0Aimport org.apache.logging.log4j.LogManager;%0Aimport org.apache.logging.log4j.Logger;%0Aimport org.apache.logging.log4j.categories.Appenders;%0Aimport org.apache.logging.log4j.junit.LoggerContextRule;%0Aimport org.apache.logging.log4j.test.AvailablePortSystemPropertyTestRule;%0Aimport org.apache.logging.log4j.test.RuleChainFactory;%0Aimport org.bson.Document;%0Aimport org.junit.Assert;%0Aimport org.junit.ClassRule;%0Aimport org.junit.Test;%0Aimport org.junit.experimental.categories.Category;%0Aimport org.junit.rules.RuleChain;%0A%0Aimport com.mongodb.MongoClient;%0Aimport com.mongodb.client.MongoCollection;%0Aimport com.mongodb.client.MongoDatabase;%0A%0A/**%0A * This class name does NOT end in %22Test%22 in order to only be picked up by %7B@link Java8Test%7D.%0A * %0A * TODO set up the log4j user in MongoDB.%0A */%0A@Category(Appenders.MongoDb.class)%0Apublic class MongoDbAuthTestJava8 %7B%0A%0A    private static LoggerContextRule loggerContextTestRule = new LoggerContextRule(%22log4j2-mongodb-auth.xml%22);%0A%0A    private static final AvailablePortSystemPropertyTestRule mongoDbPortTestRule = AvailablePortSystemPropertyTestRule%0A            .create(TestConstants.SYS_PROP_NAME_PORT);%0A%0A    private static final MongoDbTestRule mongoDbTestRule = new MongoDbTestRule(mongoDbPortTestRule.getName());%0A%0A    @ClassRule%0A    public static RuleChain ruleChain = RuleChainFactory.create(mongoDbPortTestRule, mongoDbTestRule,%0A            loggerContextTestRule);%0A%0A    @Test%0A    public void test() %7B%0A        final Logger logger = LogManager.getLogger();%0A        logger.info(%22Hello log%22);%0A        try (final MongoClient mongoClient = mongoDbTestRule.getMongoClient()) %7B%0A            final MongoDatabase database = mongoClient.getDatabase(%22test%22);%0A            Assert.assertNotNull(database);%0A            final MongoCollection%3CDocument%3E collection = database.getCollection(%22applog%22);%0A            Assert.assertNotNull(collection);%0A            Document first = collection.find().first();%0A//            Assert.assertNotNull(first);%0A//            Assert.assertEquals(first.toJson(), %22Hello log%22, first.getString(%22message%22));%0A        %7D%0A    %7D%0A%7D%0A

Add TODO.