Example usage for java.util.concurrent ConcurrentHashMap replace

List of usage examples for java.util.concurrent ConcurrentHashMap replace

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentHashMap replace.

Prototype

public V replace(K key, V value) 

Source Link

Usage

From source file:org.apache.vxquery.indexing.MetaFileUtilTest.java

/**
 * Test the update metadata file process.
 *//*ww w .j a  va 2  s .c om*/
@Test
public void step5_testUpdateMetadata()
        throws IOException, ClassNotFoundException, NoSuchAlgorithmException, JAXBException {
    ConcurrentHashMap<String, XmlMetadata> fromFileMap = metaFileUtil.getMetadata();
    XmlMetadata modified = fromFileMap.get(TestConstants.XML_FILE);

    File xml = new File(TestConstants.XML_FILE);
    modified.setMd5(metaFileUtil.generateMD5(xml));

    fromFileMap.replace(TestConstants.XML_FILE, modified);

    metaFileUtil.updateMetadataMap(fromFileMap, TestConstants.INDEX_DIR);

    Assert.assertNotNull(metaFileUtil.getMetadata());

}