test
This commit is contained in:
parent
348aa41058
commit
9b286697c2
|
@ -14,20 +14,21 @@
|
|||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-20">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
|
|
|
@ -119,4 +119,12 @@ public class DatasourceManagerClient implements HasCache {
|
|||
}
|
||||
}
|
||||
|
||||
public String getDsmApiUrl() {
|
||||
return dsmApiUrl;
|
||||
}
|
||||
|
||||
public void setDsmApiUrl(final String dsmApiUrl) {
|
||||
this.dsmApiUrl = dsmApiUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package eu.dnetlib.app.directindex.clients;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import eu.dnetlib.app.directindex.errors.DirectIndexApiException;
|
||||
import eu.dnetlib.app.directindex.input.DatasourceEntry;
|
||||
|
||||
@Disabled
|
||||
class DatasourceManagerClientTest {
|
||||
|
||||
// Class Under test
|
||||
private DatasourceManagerClient dsmClient;
|
||||
|
||||
private static final String DSM_URL = "https://services.openaire.eu/openaire/ds";
|
||||
|
||||
@BeforeEach
|
||||
public void initEach() {
|
||||
dsmClient = new DatasourceManagerClient();
|
||||
dsmClient.setDsmApiUrl(DSM_URL);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindDatasource() throws DirectIndexApiException {
|
||||
final DatasourceEntry ds = dsmClient.findDatasource("openaire____::re3data");
|
||||
assertNotNull(ds);
|
||||
assertEquals("openaire____::re3data", ds.getId());
|
||||
assertEquals("Registry of Research Data Repository", ds.getName());
|
||||
assertEquals("re3data_____", ds.getPrefix());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindDatasourceUnknown() throws DirectIndexApiException {
|
||||
final DatasourceEntry ds = dsmClient.findDatasource("unknown_____::12345");
|
||||
assertNotNull(ds);
|
||||
assertEquals(DatasourceEntry.UNKNOWN_DATASOURCE.getId(), ds.getId());
|
||||
assertEquals(DatasourceEntry.UNKNOWN_DATASOURCE.getName(), ds.getName());
|
||||
assertEquals(DatasourceEntry.UNKNOWN_DATASOURCE.getPrefix(), ds.getPrefix());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFindDatasourceInvalid() throws DirectIndexApiException {
|
||||
dsmClient.setDsmApiUrl("http://invalid/url");
|
||||
assertThrows(DirectIndexApiException.class, () -> dsmClient.findDatasource("invalid_____::12345"));
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ class VocabularyClientTest {
|
|||
private static final String VOCABULARY_URL = "https://services.openaire.eu/provision/mvc/vocabularies";
|
||||
|
||||
@BeforeEach
|
||||
public void initEach() throws DirectIndexApiException {
|
||||
public void initEach() {
|
||||
vocabularyClient = new VocabularyClient();
|
||||
vocabularyClient.setVocApiUrl(VOCABULARY_URL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue