ru.yandex.qatools.allure.plugins.DefaultAttachmentsIndex.groovy Maven / Gradle / Ivy
package ru.yandex.qatools.allure.plugins
import groovy.transform.CompileStatic
import ru.yandex.qatools.allure.AttachmentInfo
import static java.util.Collections.unmodifiableList
/**
* The default implementation of {@link AttachmentsIndex}.
* There is two different indexes: by id and by source.
*
* @author Dmitry Baev [email protected]
* Date: 10.07.15
*/
@CompileStatic
class DefaultAttachmentsIndex implements AttachmentsIndex {
private final Map byUid = [:]
private final Map bySource = [:]
/**
* Creates an instance of index.
*/
public DefaultAttachmentsIndex(List infoList) {
for (def info : infoList) {
byUid[info.uid] = info
bySource[info.source] = info
}
}
/**
* @inheritDoc
*/
@Override
AttachmentInfo find(String uid) {
byUid[uid]
}
/**
* @inheritDoc
*/
@Override
AttachmentInfo findBySource(String source) {
bySource[source]
}
/**
* @inheritDoc
*/
@Override
List findAll() {
unmodifiableList(byUid.values() as List)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy