47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
package org.gcube.tests;
|
|
|
|
import java.io.IOException;
|
|
import java.util.Collections;
|
|
|
|
import org.gcube.common.resources.gcore.GenericResource;
|
|
import org.gcube.common.resources.gcore.Resources;
|
|
import org.gcube.data.publishing.ckan2zenodo.Fixer;
|
|
import org.gcube.data.publishing.ckan2zenodo.Transformer;
|
|
import org.gcube.data.publishing.ckan2zenodo.commons.IS;
|
|
import org.gcube.data.publishing.ckan2zenodo.model.CkanItemDescriptor;
|
|
import org.gcube.data.publishing.ckan2zenodo.model.zenodo.ZenodoDeposition;
|
|
import org.junit.BeforeClass;
|
|
import org.junit.Test;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
public class TransformationTests {
|
|
|
|
static ObjectMapper mapper=null;
|
|
@BeforeClass
|
|
public static void init () {
|
|
mapper=TestCommons.getMapper();
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
public void transform() throws Exception {
|
|
Transformer basic=new Transformer(Collections.EMPTY_LIST);
|
|
TestCommons.readAndTransform("/simpleItem.json",basic);
|
|
TestCommons.readAndTransform("/FSKXModel.json",basic);
|
|
TestCommons.readAndTransform("/ResearchObject.json",basic);
|
|
|
|
}
|
|
|
|
|
|
@Test
|
|
public void transformWithMappings() throws Exception {
|
|
GenericResource res=Resources.unmarshal(GenericResource.class, TransformationTests.class.getResourceAsStream("/ResearchObject.xml"));
|
|
TestCommons.readAndTransform("/ResearchObject.json", new Transformer(IS.readMappings(res)));
|
|
|
|
}
|
|
|
|
|
|
}
|