"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "log4j-core/src/test/java/org/apache/logging/log4j/core/appender/db/jdbc/AbstractJdbcAppenderFactoryMethodTest.java" between
apache-log4j-2.11.1-src.tar.gz and apache-log4j-2.11.2-src.tar.gz

About: Apache Log4j 2 is a logging library for Java. Source distribution (Java).

AbstractJdbcAppenderFactoryMethodTest.java  (apache-log4j-2.11.1-src):AbstractJdbcAppenderFactoryMethodTest.java  (apache-log4j-2.11.2-src)
skipping to change at line 19 skipping to change at line 19
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the license for the specific language governing permissions and * See the license for the specific language governing permissions and
* limitations under the license. * limitations under the license.
*/ */
package org.apache.logging.log4j.core.appender.db.jdbc; package org.apache.logging.log4j.core.appender.db.jdbc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.ThreadContext;
import org.apache.logging.log4j.junit.JdbcRule; import org.apache.logging.log4j.junit.JdbcRule;
import org.apache.logging.log4j.junit.LoggerContextRule; import org.apache.logging.log4j.junit.LoggerContextRule;
import org.apache.logging.log4j.util.Strings; import org.apache.logging.log4j.util.Strings;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.RuleChain; import org.junit.rules.RuleChain;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/** /**
* Abstract unit test for JdbcAppender using a {@link FactoryMethodConnectionSou rce} configuration. * Abstract unit test for JdbcAppender using a {@link FactoryMethodConnectionSou rce} configuration.
*/ */
public abstract class AbstractJdbcAppenderFactoryMethodTest { public abstract class AbstractJdbcAppenderFactoryMethodTest {
@Rule @Rule
public final RuleChain rules; public final RuleChain rules;
private final JdbcRule jdbcRule; private final JdbcRule jdbcRule;
protected AbstractJdbcAppenderFactoryMethodTest(final JdbcRule jdbcRule, fin al String databaseType) { protected AbstractJdbcAppenderFactoryMethodTest(final JdbcRule jdbcRule, fin al String databaseType) {
skipping to change at line 113 skipping to change at line 114
assertEquals("The message column is not correct (2).", "Error fr om factory 02.", assertEquals("The message column is not correct (2).", "Error fr om factory 02.",
resultSet.getString("message")); resultSet.getString("message"));
assertEquals("The exception column is not correct (2).", stackTr ace, assertEquals("The exception column is not correct (2).", stackTr ace,
IOUtils.readStringAndClose(resultSet.getNClob("exception ").getCharacterStream(), -1)); IOUtils.readStringAndClose(resultSet.getNClob("exception ").getCharacterStream(), -1));
assertFalse("There should not be three rows.", resultSet.next()) ; assertFalse("There should not be three rows.", resultSet.next()) ;
} }
} }
} }
@Test
public void testTruncate() {
final Logger logger = LogManager.getLogger(this.getClass().getName() + "
.testFactoryMethodConfig");
// Some drivers and database will not allow more data than the column de
fines.
// We really need a MySQL databases with a default configuration to test
this.
logger.debug(StringUtils.repeat('A', 1000));
}
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)