Project

General

Profile

1 42256 claudio.at
package eu.dnetlib.msro.workflows.dedup;
2
3
import java.io.IOException;
4
5
import com.google.common.collect.Iterables;
6
import com.googlecode.protobuf.format.JsonFormat;
7
import eu.dnetlib.data.proto.OafProtos.Oaf;
8
import org.apache.commons.codec.binary.Base64;
9
import org.apache.commons.io.IOUtils;
10
import org.apache.commons.logging.Log;
11
import org.apache.commons.logging.LogFactory;
12
import org.junit.Test;
13
14
/**
15
 * Created by claudio on 05/04/16.
16
 */
17
public class SerializationTest {
18
19
	private static final Log log = LogFactory.getLog(SerializationTest.class);
20
21
	@Test
22
	public void test() throws IOException {
23
24
		final String data = Iterables.getFirst(IOUtils.readLines(getClass().getResourceAsStream("oaf_data.base64")), "");
25
26
		final byte[] oafBytes = Base64.decodeBase64(data);
27
28
		Oaf oaf = Oaf.parseFrom(oafBytes);
29
30
		JsonFormat jsonFormat = new JsonFormat();
31
		String asJson = jsonFormat.printToString(oaf);
32
33
		log.info(asJson);
34
35
	}
36
37
}