/**
 *
 */
package eu.dnetlib.oai.mongo;

import java.io.IOException;

import org.bson.types.Binary;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author sandro
 *
 */
public class MongoPublisherStoreTest {

	/**
	 * Test method for {@link eu.dnetlib.oai.mongo.MongoPublisherStore#createCompressRecord(java.lang.String)}.
	 * 
	 * @throws IOException
	 */
	@Test
	public void testCreateCompressRecord() throws IOException {

		final MongoPublisherStore store = new MongoPublisherStore();
		final RecordInfoGenerator gen = new RecordInfoGenerator();
		final StringBuffer buffer = new StringBuffer();
		final String input = " CIAO MONDO DA SANDRO!";

		for (int i = 0; i < 10000; i++) {
			buffer.append(input);
		}
		final Binary data = store.createCompressRecord(buffer.toString());
		Assert.assertEquals(buffer.toString(), gen.decompressRecord(data.getData()));

	}

}
