Search in sources :

Example 96 with VisibleForTesting

use of com.google.common.annotations.VisibleForTesting in project hbase by apache.

the class FSTableDescriptors method updateTableDescriptor.

/**
   * Update table descriptor on the file system
   * @throws IOException Thrown if failed update.
   * @throws NotImplementedException if in read only mode
   */
@VisibleForTesting
Path updateTableDescriptor(HTableDescriptor td) throws IOException {
    if (fsreadonly) {
        throw new NotImplementedException("Cannot update a table descriptor - in read only mode");
    }
    TableName tableName = td.getTableName();
    Path tableDir = getTableDir(tableName);
    Path p = writeTableDescriptor(fs, td, tableDir, getTableInfoPath(tableDir));
    if (p == null)
        throw new IOException("Failed update");
    LOG.info("Updated tableinfo=" + p);
    if (usecache) {
        this.cache.put(td.getTableName(), td);
    }
    return p;
}
Also used : Path(org.apache.hadoop.fs.Path) TableName(org.apache.hadoop.hbase.TableName) NotImplementedException(org.apache.commons.lang.NotImplementedException) IOException(java.io.IOException) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 97 with VisibleForTesting

use of com.google.common.annotations.VisibleForTesting in project hbase by apache.

the class FSTableDescriptors method getTableInfoSequenceId.

/**
   * @param p Path to a <code>.tableinfo</code> file.
   * @return The current editid or 0 if none found.
   */
@VisibleForTesting
static int getTableInfoSequenceId(final Path p) {
    if (p == null)
        return 0;
    Matcher m = TABLEINFO_FILE_REGEX.matcher(p.getName());
    if (!m.matches())
        throw new IllegalArgumentException(p.toString());
    String suffix = m.group(2);
    if (suffix == null || suffix.length() <= 0)
        return 0;
    return Integer.parseInt(m.group(2));
}
Also used : Matcher(java.util.regex.Matcher) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 98 with VisibleForTesting

use of com.google.common.annotations.VisibleForTesting in project hbase by apache.

the class IdReadWriteLock method waitForWaiters.

@VisibleForTesting
public void waitForWaiters(long id, int numWaiters) throws InterruptedException {
    for (ReentrantReadWriteLock readWriteLock; ; ) {
        readWriteLock = lockPool.get(id);
        if (readWriteLock != null) {
            synchronized (readWriteLock) {
                if (readWriteLock.getQueueLength() >= numWaiters) {
                    return;
                }
            }
        }
        Thread.sleep(50);
    }
}
Also used : ReentrantReadWriteLock(java.util.concurrent.locks.ReentrantReadWriteLock) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 99 with VisibleForTesting

use of com.google.common.annotations.VisibleForTesting in project hive by apache.

the class StringAppender method addToLogger.

@VisibleForTesting
public void addToLogger(String loggerName, Level level) {
    LoggerConfig loggerConfig = configuration.getLoggerConfig(loggerName);
    loggerConfig.addAppender(this, level, null);
    context.updateLoggers();
}
Also used : LoggerConfig(org.apache.logging.log4j.core.config.LoggerConfig) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 100 with VisibleForTesting

use of com.google.common.annotations.VisibleForTesting in project hive by apache.

the class Rpc method createEmbedded.

@VisibleForTesting
static Rpc createEmbedded(RpcDispatcher dispatcher) {
    EmbeddedChannel c = new EmbeddedChannel(new LoggingHandler(Rpc.class), new KryoMessageCodec(0, MessageHeader.class, NullMessage.class), dispatcher);
    Rpc rpc = new Rpc(new RpcConfiguration(Collections.<String, String>emptyMap()), c, ImmediateEventExecutor.INSTANCE);
    rpc.dispatcher = dispatcher;
    return rpc;
}
Also used : LoggingHandler(io.netty.handler.logging.LoggingHandler) EmbeddedChannel(io.netty.channel.embedded.EmbeddedChannel) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)760 IOException (java.io.IOException)128 ArrayList (java.util.ArrayList)52 Path (java.nio.file.Path)46 Map (java.util.Map)46 File (java.io.File)40 HashMap (java.util.HashMap)34 Path (org.apache.hadoop.fs.Path)30 ImmutableList (com.google.common.collect.ImmutableList)28 Matcher (java.util.regex.Matcher)26 List (java.util.List)24 SourcePath (com.facebook.buck.rules.SourcePath)20 ImmutableMap (com.google.common.collect.ImmutableMap)20 HashSet (java.util.HashSet)19 FileStatus (org.apache.hadoop.fs.FileStatus)19 FileHandle (org.apache.hadoop.nfs.nfs3.FileHandle)19 DFSClient (org.apache.hadoop.hdfs.DFSClient)18 Nfs3FileAttributes (org.apache.hadoop.nfs.nfs3.Nfs3FileAttributes)18 ImmutableSet (com.google.common.collect.ImmutableSet)16 CigarElement (htsjdk.samtools.CigarElement)13