001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase;
019
020import java.util.ArrayList;
021import java.util.Arrays;
022import java.util.List;
023
024import org.apache.hadoop.hbase.io.hfile.HFile;
025import org.apache.hadoop.hbase.testclassification.IntegrationTests;
026import org.apache.hadoop.hbase.util.LoadTestDataGeneratorWithTags;
027import org.apache.hadoop.hbase.util.LoadTestTool;
028import org.junit.experimental.categories.Category;
029
030@Category(IntegrationTests.class)
031public class IntegrationTestIngestWithTags extends IntegrationTestIngest {
032
033  private static final char COLON = ':';
034
035  private int minTagsPerKey = 1, maxTagsPerKey = 10;
036  private int minTagLength = 16, maxTagLength = 512;
037
038  @Override
039  public void setUpCluster() throws Exception {
040    getTestingUtil(conf).getConfiguration().setInt(HFile.FORMAT_VERSION_KEY, 3);
041    super.setUpCluster();
042  }
043
044  @Override
045  protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey,
046      long numKeys) {
047    String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys);
048    List<String> tmp = new ArrayList<>(Arrays.asList(args));
049    // LoadTestDataGeneratorWithTags:minNumTags:maxNumTags:minTagLength:maxTagLength
050    tmp.add(HIPHEN + LoadTestTool.OPT_GENERATOR);
051    StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithTags.class.getName());
052    sb.append(COLON);
053    sb.append(minTagsPerKey);
054    sb.append(COLON);
055    sb.append(maxTagsPerKey);
056    sb.append(COLON);
057    sb.append(minTagLength);
058    sb.append(COLON);
059    sb.append(maxTagLength);
060    tmp.add(sb.toString());
061    return tmp.toArray(new String[tmp.size()]);
062  }
063}