package eu.dnetlib.ariadneplus.workflows.nodes;

import java.util.List;
import java.util.concurrent.TimeUnit;

import com.google.common.collect.Lists;

/**
 * Created by Alessia Bardi on 12/02/2018.
 *
 * @author Alessia Bardi
 */
public class VirtuosoAriadnePlusMockIterator extends VirtuosoAriadnePlusIterator {

	List<String> elements = Lists.newArrayList("rdf1", "rdf2", "rdf3", "rdf4", "rdf5", "rdf6");

	@Override
	protected void fillQueue() {
		new Thread(() -> {
			try {
				for (String e : elements) {

					getElements().offer(e, QUEUE_TIMEOUT_SECONDS, TimeUnit.SECONDS);
				}
			} catch (InterruptedException ee) {
				ee.printStackTrace();
			} finally {
				try {
					getElements().offer(TERMINATOR, QUEUE_TIMEOUT_SECONDS, TimeUnit.SECONDS);
				} catch (InterruptedException ee) {
					System.out.println(ee);
				}
			}
		}).start();
	}
}
