[master] update reference to ZenodoAPI

This commit is contained in:
Miriam Baglioni 2023-07-07 18:12:17 +02:00
parent b26fb92838
commit ab791fe424
1 changed files with 26 additions and 5 deletions

View File

@ -7,6 +7,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import eu.dnetlib.dhp.oa.zenodoapi.ZenodoAPIClient;
import eu.dnetlib.dhp.oa.zenodoapi.MissingConceptDoiException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.junit.jupiter.api.Assertions;
@ -16,9 +18,8 @@ import org.junit.jupiter.api.Test;
import com.google.gson.Gson;
import eu.dnetlib.dhp.common.api.MissingConceptDoiException;
import eu.dnetlib.dhp.oa.graph.dump.community.CommunityMap;
import eu.dnetlib.dhp.oa.zenodoapi.ZenodoAPIClient;
@Disabled
public class ZenodoUploadTest {
@ -55,7 +56,7 @@ public class ZenodoUploadTest {
.getPath()),
new Path(workingDir + "/zenodo/dh-ch/dh-ch"));
eu.dnetlib.dhp.common.api.ZenodoAPIClient client = new eu.dnetlib.dhp.common.api.ZenodoAPIClient(URL_STRING,
ZenodoAPIClient client = new ZenodoAPIClient(URL_STRING,
ACCESS_TOKEN);
client.newDeposition();
@ -90,9 +91,9 @@ public class ZenodoUploadTest {
}
@Test
void testNewVersion() throws IOException, MissingConceptDoiException {
void testNewVersion() throws Exception, MissingConceptDoiException {
eu.dnetlib.dhp.common.api.ZenodoAPIClient client = new eu.dnetlib.dhp.common.api.ZenodoAPIClient(URL_STRING,
ZenodoAPIClient client = new ZenodoAPIClient(URL_STRING,
ACCESS_TOKEN);
client.newVersion("656628");
@ -140,6 +141,26 @@ public class ZenodoUploadTest {
}
@Test
void testNewVersion2() throws Exception, MissingConceptDoiException {
ZenodoAPIClient client = new ZenodoAPIClient(URL_STRING,
ACCESS_TOKEN);
client.newVersion("1210237");
File file = new File("/Users/miriam.baglioni/Desktop/EOSC_DUMP/publication.tar");
// File file = new File(getClass()
// .getResource("/eu/dnetlib/dhp/common/api/newVersion2")
// .getPath());
InputStream is = new FileInputStream(file);
Assertions.assertEquals(200, client.uploadIS3(is, "newVersion_deposition", file.length()));
// Assertions.assertEquals(202, client.publish());
}
@Test
void readCommunityMap() throws IOException {
LocalFileSystem fs = FileSystem.getLocal(new Configuration());