@Test
  public void testRemovePeerTableCFs() throws Exception {
    // Add a valid peer
    admin.addPeer(ID_ONE, KEY_ONE);
    try {
      admin.removePeerTableCFs(ID_ONE, "t3");
      assertTrue(false);
    } catch (ReplicationException e) {
    }
    assertEquals("", admin.getPeerTableCFs(ID_ONE));

    admin.setPeerTableCFs(ID_ONE, "t1;t2:cf1");
    try {
      admin.removePeerTableCFs(ID_ONE, "t3");
      assertTrue(false);
    } catch (ReplicationException e) {
    }
    assertEquals("t1;t2:cf1", admin.getPeerTableCFs(ID_ONE));

    try {
      admin.removePeerTableCFs(ID_ONE, "t1:f1");
      assertTrue(false);
    } catch (ReplicationException e) {
    }
    admin.removePeerTableCFs(ID_ONE, "t1");
    assertEquals("t2:cf1", admin.getPeerTableCFs(ID_ONE));

    try {
      admin.removePeerTableCFs(ID_ONE, "t2");
      assertTrue(false);
    } catch (ReplicationException e) {
    }
    admin.removePeerTableCFs(ID_ONE, "t2:cf1");
    assertEquals("", admin.getPeerTableCFs(ID_ONE));
    admin.removePeer(ID_ONE);
  }
Exemple #2
0
 /**
  * Remove some table-cfs from table-cfs config of the specified peer
  *
  * @param id a short name that identifies the cluster
  * @param tableCf table-cfs config str
  * @throws ReplicationException
  */
 public void removePeerTableCFs(String id, String tableCf) throws ReplicationException {
   removePeerTableCFs(id, parseTableCFsFromConfig(tableCf));
 }