@Test(expected=NoSuchUniqueName.class) public void getIdForNonexistentName() { uid = new UniqueId(client, table, kind, 3); when(client.get(anyGet())) .thenReturn(Deferred.<ArrayList<KeyValue>>fromResult(null)); uid.getId("foo"); }
public byte[] getId(final String name) throws NoSuchUniqueName, HBaseException { byte[] id = getIdFromCache(name); if (id != null) { cacheHits++; } else { cacheMisses++; id = getIdFromHBase(name); if (id == null) { throw new NoSuchUniqueName(kind(), name); } if (id.length != idWidth) { throw new IllegalStateException("Found id.length = " + id.length + " which is != " + idWidth + " required for '" + kind() + '\''); } addIdToCache(name, id); addNameToCache(id, name); } return id; }
UniqueId implements UniqueIdInterface { public byte[] getId(final String name) throws NoSuchUniqueName, HBaseException { byte[] id = getIdFromCache(name); if (id != null) { cacheHits++; } else { cacheMisses++; id = getIdFromHBase(name); if (id == null) { throw new NoSuchUniqueName(kind(), name); } if (id.length != idWidth) { throw new IllegalStateException("Found id.length = " + id.length + " which is != " + idWidth + " required for '" + kind() + '\''); } addIdToCache(name, id); addNameToCache(id, name); } return id; } }
UniqueId implements UniqueIdInterface { public byte[] getId(final String name) throws NoSuchUniqueName, HBaseException { byte[] id = getIdFromCache(name); if (id != null) { cacheHits++; } else { cacheMisses++; id = getIdFromHBase(name); if (id == null) { throw new NoSuchUniqueName(kind(), name); } if (id.length != idWidth) { throw new IllegalStateException("Found id.length = " + id.length + " which is != " + idWidth + " required for '" + kind() + '\''); } addIdToCache(name, id); addNameToCache(id, name); } return id; } UniqueId(final HBaseClient client, final byte[] table, final String kind,
                    final int width); }
UniqueId implements UniqueIdInterface { public byte[] getId(final String name) throws NoSuchUniqueName, HBaseException { byte[] id = getIdFromCache(name); if (id != null) { cacheHits++; } else { cacheMisses++; id = getIdFromHBase(name); if (id == null) { throw new NoSuchUniqueName(kind(), name); } if (id.length != idWidth) { throw new IllegalStateException("Found id.length = " + id.length + " which is != " + idWidth + " required for '" + kind() + '\''); } addIdToCache(name, id); addNameToCache(id, name); } return id; } UniqueId(final HBaseClient client, final byte[] table, final String kind,
                    final int width); int cacheHits(); int cacheMisses(); int cacheSize(); String kind(); short width(); void dropCaches(); String getName(final byte[] id); byte[] getId(final String name); byte[] getOrCreateId(String name); List<String> suggest(final String search); void rename(final String oldname, final String newname); String toString(); }
UniqueId implements UniqueIdInterface { public byte[] getId(final String name) throws NoSuchUniqueName, HBaseException { byte[] id = getIdFromCache(name); if (id != null) { cacheHits++; } else { cacheMisses++; id = getIdFromHBase(name); if (id == null) { throw new NoSuchUniqueName(kind(), name); } if (id.length != idWidth) { throw new IllegalStateException("Found id.length = " + id.length + " which is != " + idWidth + " required for '" + kind() + '\''); } addIdToCache(name, id); addNameToCache(id, name); } return id; } UniqueId(final HBaseClient client, final byte[] table, final String kind,
                    final int width); int cacheHits(); int cacheMisses(); int cacheSize(); String kind(); short width(); void dropCaches(); String getName(final byte[] id); byte[] getId(final String name); byte[] getOrCreateId(String name); List<String> suggest(final String search); void rename(final String oldname, final String newname); String toString();  }