Rename root properties in REST API to match dspace.cfg configuration names

This commit is contained in:
Tim Donohue
2020-06-02 17:01:48 -05:00
parent c6c490622c
commit bf790e072b
6 changed files with 23 additions and 23 deletions

View File

@@ -24,8 +24,8 @@ public class RootConverter {
public RootRest convert() { public RootRest convert() {
RootRest rootRest = new RootRest(); RootRest rootRest = new RootRest();
rootRest.setDspaceName(configurationService.getProperty("dspace.name")); rootRest.setDspaceName(configurationService.getProperty("dspace.name"));
rootRest.setDspaceURL(configurationService.getProperty("dspace.ui.url")); rootRest.setDspaceUI(configurationService.getProperty("dspace.ui.url"));
rootRest.setDspaceRest(configurationService.getProperty("dspace.server.url")); rootRest.setDspaceServer(configurationService.getProperty("dspace.server.url"));
return rootRest; return rootRest;
} }
} }

View File

@@ -30,7 +30,7 @@ public class RootHalLinkFactory extends HalLinkFactory<RootResource, RootRestRes
for (Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) { for (Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) {
list.add( list.add(
buildLink(endpointLink.getRel().value(), buildLink(endpointLink.getRel().value(),
halResource.getContent().getDspaceRest() + endpointLink.getHref())); halResource.getContent().getDspaceServer() + endpointLink.getHref()));
} }
} }

View File

@@ -28,9 +28,9 @@ public class ProcessResourceHalLinkFactory extends HalLinkFactory<ProcessResourc
private ConfigurationService configurationService; private ConfigurationService configurationService;
protected void addLinks(ProcessResource halResource, Pageable pageable, LinkedList<Link> list) throws Exception { protected void addLinks(ProcessResource halResource, Pageable pageable, LinkedList<Link> list) throws Exception {
String dspaceRestUrl = configurationService.getProperty("dspace.server.url"); String dspaceServerUrl = configurationService.getProperty("dspace.server.url");
list.add( list.add(
buildLink("script", dspaceRestUrl + "/api/system/scripts/" + halResource.getContent().getScriptName())); buildLink("script", dspaceServerUrl + "/api/system/scripts/" + halResource.getContent().getScriptName()));
} }

View File

@@ -17,9 +17,9 @@ import org.dspace.app.rest.RootRestResourceController;
public class RootRest extends RestAddressableModel { public class RootRest extends RestAddressableModel {
public static final String NAME = "root"; public static final String NAME = "root";
public static final String CATEGORY = RestModel.ROOT; public static final String CATEGORY = RestModel.ROOT;
private String dspaceURL; private String dspaceUI;
private String dspaceName; private String dspaceName;
private String dspaceRest; private String dspaceServer;
public String getCategory() { public String getCategory() {
return CATEGORY; return CATEGORY;
@@ -33,13 +33,13 @@ public class RootRest extends RestAddressableModel {
return RootRestResourceController.class; return RootRestResourceController.class;
} }
public String getDspaceURL() { public String getDspaceUI() {
return dspaceURL; return dspaceUI;
} }
public void setDspaceURL(String dspaceURL) { public void setDspaceUI(String dspaceUI) {
this.dspaceURL = dspaceURL; this.dspaceUI = dspaceUI;
} }
public String getDspaceName() { public String getDspaceName() {
@@ -50,12 +50,12 @@ public class RootRest extends RestAddressableModel {
this.dspaceName = dspaceName; this.dspaceName = dspaceName;
} }
public String getDspaceRest() { public String getDspaceServer() {
return dspaceRest; return dspaceServer;
} }
public void setDspaceRest(String dspaceRest) { public void setDspaceServer(String dspaceServerURL) {
this.dspaceRest = dspaceRest; this.dspaceServer = dspaceServerURL;
} }
@Override @Override
@@ -64,9 +64,9 @@ public class RootRest extends RestAddressableModel {
new EqualsBuilder().append(this.getCategory(), ((RootRest) object).getCategory()) new EqualsBuilder().append(this.getCategory(), ((RootRest) object).getCategory())
.append(this.getType(), ((RootRest) object).getType()) .append(this.getType(), ((RootRest) object).getType())
.append(this.getController(), ((RootRest) object).getController()) .append(this.getController(), ((RootRest) object).getController())
.append(this.getDspaceURL(), ((RootRest) object).getDspaceURL()) .append(this.getDspaceUI(), ((RootRest) object).getDspaceUI())
.append(this.getDspaceName(), ((RootRest) object).getDspaceName()) .append(this.getDspaceName(), ((RootRest) object).getDspaceName())
.append(this.getDspaceRest(), ((RootRest) object).getDspaceRest()) .append(this.getDspaceServer(), ((RootRest) object).getDspaceServer())
.isEquals()); .isEquals());
} }
@@ -77,8 +77,8 @@ public class RootRest extends RestAddressableModel {
.append(this.getType()) .append(this.getType())
.append(this.getController()) .append(this.getController())
.append(this.getDspaceName()) .append(this.getDspaceName())
.append(this.getDspaceURL()) .append(this.getDspaceUI())
.append(this.getDspaceRest()) .append(this.getDspaceServer())
.toHashCode(); .toHashCode();
} }
} }

View File

@@ -33,9 +33,9 @@ public class RootRestResourceControllerIT extends AbstractControllerIntegrationT
.andExpect(status().isOk()) .andExpect(status().isOk())
//We expect the content type to be "application/hal+json;charset=UTF-8" //We expect the content type to be "application/hal+json;charset=UTF-8"
.andExpect(content().contentType(contentType)) .andExpect(content().contentType(contentType))
.andExpect(jsonPath("$.dspaceURL", Matchers.is("http://localhost:4000"))) .andExpect(jsonPath("$.dspaceUI", Matchers.is("http://localhost:4000")))
.andExpect(jsonPath("$.dspaceName", Matchers.is("DSpace at My University"))) .andExpect(jsonPath("$.dspaceName", Matchers.is("DSpace at My University")))
.andExpect(jsonPath("$.dspaceRest", Matchers.is(BASE_REST_SERVER_URL))) .andExpect(jsonPath("$.dspaceServer", Matchers.is(BASE_REST_SERVER_URL)))
.andExpect(jsonPath("$.type", Matchers.is("root"))); .andExpect(jsonPath("$.type", Matchers.is("root")));
} }

View File

@@ -48,9 +48,9 @@ public class RootConverterTest {
public void testCorrectPropertiesSetFromConfigurationService() throws Exception { public void testCorrectPropertiesSetFromConfigurationService() throws Exception {
String restUrl = "rest"; String restUrl = "rest";
RootRest rootRest = rootConverter.convert(); RootRest rootRest = rootConverter.convert();
assertEquals("dspaceurl", rootRest.getDspaceURL()); assertEquals("dspaceurl", rootRest.getDspaceUI());
assertEquals("dspacename", rootRest.getDspaceName()); assertEquals("dspacename", rootRest.getDspaceName());
assertEquals(restUrl, rootRest.getDspaceRest()); assertEquals(restUrl, rootRest.getDspaceServer());
} }
@Test @Test