Skip to content

Commit

Permalink
Refactor Installation class by removing unused isGdccMember method; u…
Browse files Browse the repository at this point in the history
…pdate RestHelperServiceTests to correct URL; add unit tests for InstallationDao and VersionInfoDao.
  • Loading branch information
jp-tosca committed Nov 7, 2024
1 parent 8069162 commit ab80221
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,6 @@ public void setLaunchYear(Integer launchYear) {
this.launchYear = launchYear;
}

public Boolean isGdccMember() {
return this.gdccMember;
}

public Boolean getGdccMember() {
return this.gdccMember;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class RestHelperServiceTests {

@Test
public void testRetrieveRestAPIObject() {
//String url = "http://localhost:8080/api/installation";

String url = "https://raw.githubusercontent.com/IQSS/dataverse-installations/refs/heads/main/data/data.json";
assertDoesNotThrow(() -> {
InstallationGitImporter.InstallationWrapper installationList
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package edu.harvard.iq.dataverse_hub.dao;

import edu.harvard.iq.dataverse_hub.model.Installation;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

public class InstallationDaoTests {

@Test
public void testInstallationDao() {
Installation installation = new Installation();
installation.setHostname("localhost");
installation.setName("installation test");
installation.setLatitude(1.0);
installation.setLongitude(1.0);
installation.setContactEmail("email");
installation.setContinent("continent");
installation.setCountry("country");
installation.setDescription("description");
installation.setLaunchYear(2024);
installation.setGdccMember(true);
installation.setDoiAuthority("doi");

assertEquals(installation, installation);

Installation installation2 = new Installation();
installation2.setHostname("localhost");
installation2.setName("installation test");
installation2.setLatitude(1.0);
installation2.setLongitude(1.0);
installation2.setContactEmail("email");
installation2.setContinent("continent");
installation2.setCountry("country");
installation2.setDescription("description");
installation2.setLaunchYear(2024);
installation2.setGdccMember(true);
installation2.setDoiAuthority("doi");
assertEquals(installation, installation2);

installation2.updateWith(installation);

assertDoesNotThrow(() -> {
installation2.toString();
});

assertNull(installation2.getDvHubId());

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package edu.harvard.iq.dataverse_hub.dao;

import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;

import edu.harvard.iq.dataverse_hub.model.InstallationVersionInfo;

public class VersionInfoDaoTests {

@Test
public void testInfoDaoTest() {

InstallationVersionInfo versionInfo = new InstallationVersionInfo();

assertDoesNotThrow(()->{
versionInfo.toString();
});
}

}

0 comments on commit ab80221

Please sign in to comment.