fixed a bug with _convert
This commit is contained in:
parent
b748d847bb
commit
c948ed63f3
|
@ -76,7 +76,17 @@ public class DsmMappingUtils {
|
|||
}
|
||||
|
||||
public static ApiDbEntry asDbEntry(final ApiDetails d) {
|
||||
final ApiDbEntry apiDbEntry = _convert(d, ApiDbEntry.class);
|
||||
final ApiDbEntry apiDbEntry = new ApiDbEntry();
|
||||
|
||||
apiDbEntry.setId(d.getId());
|
||||
apiDbEntry.setBaseurl(d.getBaseurl());
|
||||
apiDbEntry.setProtocol(d.getProtocol());
|
||||
apiDbEntry.setDatasource(d.getDatasource());
|
||||
apiDbEntry.setContentdescription(d.getContentdescription());
|
||||
apiDbEntry.setCompatibility(d.getCompatibility());
|
||||
apiDbEntry.setCompatibilityOverride(d.getCompatibilityOverride());
|
||||
apiDbEntry.setRemovable(d.getRemovable());
|
||||
apiDbEntry.setMetadataIdentifierPath(d.getMetadataIdentifierPath());
|
||||
|
||||
// Need to complete the references among objects, because you know, referential integrity ...
|
||||
apiDbEntry.getApiParams().forEach(ap -> ap.getId().setApi(apiDbEntry));
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package eu.dnetlib.openaire.dsm.dao.utils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import eu.dnetlib.openaire.dsm.domain.ApiDetails;
|
||||
import eu.dnetlib.openaire.dsm.domain.db.ApiDbEntry;
|
||||
|
||||
class DsmMappingUtilsTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() throws Exception {}
|
||||
|
||||
@Test
|
||||
void testAsDetailsApiDbEntry() {
|
||||
final ApiDetails api = new ApiDetails();
|
||||
api.setId("id:123");
|
||||
final ApiDbEntry dbEntry = DsmMappingUtils.asDbEntry(api);
|
||||
assertEquals(api.getId(), dbEntry.getId());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue