co.cask.tephra.hbase.AbstractTransactionVisibilityFilterTest.java Source code

Java tutorial

Introduction

Here is the source code for co.cask.tephra.hbase.AbstractTransactionVisibilityFilterTest.java

Source

/*
 * Copyright  2014 Cask Data, Inc.
 *
 * Licensed 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 co.cask.tephra.hbase;

import co.cask.tephra.TransactionManager;
import co.cask.tephra.TxConstants;
import co.cask.tephra.util.ConfigurationFactory;
import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
import org.junit.After;
import org.junit.Before;

import java.util.List;

/**
 * Common test class for TransactionVisibilityFilter implementations.
 */
public abstract class AbstractTransactionVisibilityFilterTest {

    protected static final byte[] FAM = new byte[] { 'f' };
    protected static final byte[] FAM2 = new byte[] { 'f', '2' };
    protected static final byte[] FAM3 = new byte[] { 'f', '3' };
    protected static final byte[] COL = new byte[] { 'c' };
    protected static final List<byte[]> EMPTY_CHANGESET = Lists.newArrayListWithCapacity(0);

    protected TransactionManager txManager;

    @Before
    public void setup() throws Exception {
        Configuration conf = new ConfigurationFactory().get();
        conf.unset(TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES);
        txManager = new TransactionManager(conf);
        txManager.startAndWait();
    }

    @After
    public void tearDown() throws Exception {
        txManager.stopAndWait();
    }
}