  @Test
  public void testUpdateConfigurationMetadata(){

    Metadata currentMetadata = new Metadata();
    String currentKey = "currentKey";
    currentMetadata.addMetadata(currentKey, "value1");
    cern.c2mon.shared.client.metadata.Metadata clientMetadata = new cern.c2mon.shared.client.metadata.Metadata();
    String newClientKey = "newClientKey";
    clientMetadata.addMetadata(newClientKey, "value2");
    clientMetadata.setUpdate(true);
    Properties properties = new Properties();
    properties.put("metadata",  cern.c2mon.shared.client.metadata.Metadata.toJSON(clientMetadata));

    Metadata result = MetadataUtils.parseMetadataConfiguration(properties, currentMetadata);

    assertEquals(2, result.getMetadata().size());
    assertTrue(result.getMetadata().containsKey(currentKey));
    assertEquals(currentMetadata.getMetadata().get(currentKey), result.getMetadata().get(currentKey));
    assertTrue(result.getMetadata().containsKey(newClientKey));
    assertEquals(clientMetadata.getMetadata().get(newClientKey), result.getMetadata().get(newClientKey));
  }