blob: 4da137fc0152a52940a0c352150b6eeb5f839359 [file] [log] [blame]
/*
* 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.qpid.server.logging.logback.jdbc;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import ch.qos.logback.classic.db.names.ColumnName;
import ch.qos.logback.classic.db.names.TableName;
import org.junit.Before;
import org.junit.Test;
import org.apache.qpid.server.store.jdbc.JDBCSettings;
import org.apache.qpid.test.utils.UnitTestBase;
public class JDBCSettingsDBNameResolverTest extends UnitTestBase
{
private static final String TABLE_PREFIX = "test_";
private JDBCSettingsDBNameResolver _dbNameResolver;
@Before
public void setUp()
{
final JDBCSettings jdbcSettings = mock(JDBCSettings.class);
when(jdbcSettings.getTableNamePrefix()).thenReturn(TABLE_PREFIX);
_dbNameResolver = new JDBCSettingsDBNameResolver(jdbcSettings);
}
@Test
public void getTableName()
{
assertEquals((TABLE_PREFIX + TableName.LOGGING_EVENT.name()).toLowerCase(),
_dbNameResolver.getTableName(TableName.LOGGING_EVENT));
}
@Test
public void getColumnName()
{
assertEquals(ColumnName.LOGGER_NAME.name().toLowerCase(),
_dbNameResolver.getColumnName(ColumnName.LOGGER_NAME));
}
}