コード例 #1
0
  public static void test19() {
    int max = 100;
    String[] keys = new String[max];
    for (int i = 0; i < max; i++) {
      keys[i] = Integer.toString(i);
      mc.set(keys[i], "value" + i);
    }

    Map<String, Object> results = mc.getMulti(keys);
    for (int i = 0; i < max; i++) {
      assert results.get(keys[i]).equals("value" + i);
    }
  }
コード例 #2
0
  public static void test24() {

    String[] allKeys = {"key1", "key2", "key3", "key4", "key5", "key6", "key7"};
    String[] setKeys = {"key1", "key3", "key5", "key7"};

    for (String key : setKeys) {
      mc.set(key, key);
    }

    Map<String, Object> results = mc.getMulti(allKeys);

    assert allKeys.length == results.size();
    for (String key : setKeys) {
      String val = (String) results.get(key);
      assert key.equals(val);
    }
  }
コード例 #3
0
  public static void test20(int max, int skip, int start) {
    int numEntries = max / skip + 1;
    String[] keys = new String[numEntries];
    byte[][] vals = new byte[numEntries][];

    int size = start;
    for (int i = 0; i < numEntries; i++) {
      keys[i] = Integer.toString(size);
      vals[i] = new byte[size + 1];
      for (int j = 0; j < size + 1; j++) vals[i][j] = (byte) j;

      mc.set(keys[i], vals[i]);
      size += skip;
    }

    Map<String, Object> results = mc.getMulti(keys);
    for (int i = 0; i < numEntries; i++)
      assert Arrays.equals((byte[]) results.get(keys[i]), vals[i]);
  }