Create factory to retrieve an instance of the "configurationService" object

This commit is contained in:
KevinVdV
2015-12-14 13:07:08 +01:00
committed by Tim Donohue
parent 85e27d5309
commit 0d79a7109a
125 changed files with 425 additions and 394 deletions

View File

@@ -27,7 +27,6 @@ import org.dspace.core.Context;
import org.dspace.identifier.ezid.DateToYear;
import org.dspace.identifier.ezid.Transform;
import org.dspace.services.ConfigurationService;
import org.dspace.utils.DSpace;
import org.dspace.workflow.WorkflowException;
import org.dspace.workflow.WorkflowItem;
import org.dspace.workflow.factory.WorkflowServiceFactory;
@@ -127,7 +126,7 @@ public class EZIDIdentifierProviderTest
throws Exception
{
// Find the configuration service
config = new DSpace().getConfigurationService();
config = DSpaceServicesFactory.getInstance().getConfigurationService();
// Configure the service under test.
config.setProperty(EZIDIdentifierProvider.CFG_SHOULDER, TEST_SHOULDER);
@@ -141,15 +140,15 @@ public class EZIDIdentifierProviderTest
instance.setCrosswalk(aCrosswalk);
instance.setCrosswalkTransform(crosswalkTransforms);
instance.setItemService(ContentServiceFactory.getInstance().getItemService());
new DSpace().getServiceManager().registerServiceNoAutowire(EZIDIdentifierProvider.class.getName(), instance);
assertNotNull(new DSpace().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class));
DSpaceServicesFactory.getInstance().getServiceManager().registerServiceNoAutowire(EZIDIdentifierProvider.class.getName(), instance);
assertNotNull(DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class));
}
@AfterClass
public static void tearDownClass()
throws Exception
{
new DSpace().getServiceManager().unregisterService(EZIDIdentifierProvider.class.getName());
DSpaceServicesFactory.getInstance().getServiceManager().unregisterService(EZIDIdentifierProvider.class.getName());
System.out.print("Tearing down\n\n");
}
@@ -186,7 +185,7 @@ public class EZIDIdentifierProviderTest
{
System.out.println("supports Class");
EZIDIdentifierProvider instance = new DSpace().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
EZIDIdentifierProvider instance = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
Class<? extends Identifier> identifier = DOI.class;
boolean result = instance.supports(identifier);
@@ -201,7 +200,7 @@ public class EZIDIdentifierProviderTest
{
System.out.println("supports String");
EZIDIdentifierProvider instance = new DSpace().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
EZIDIdentifierProvider instance = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
String identifier = "doi:" + TEST_SHOULDER;
boolean result = instance.supports(identifier);
@@ -412,7 +411,7 @@ public class EZIDIdentifierProviderTest
System.out.println("crosswalkMetadata");
// Set up the instance to be tested
EZIDIdentifierProvider instance = new DSpace().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
EZIDIdentifierProvider instance = DSpaceServicesFactory.getInstance().getServiceManager().getServiceByName(EZIDIdentifierProvider.class.getName(), EZIDIdentifierProvider.class);
// instance.setConfigurationService(config);
// instance.setCrosswalk(aCrosswalk);
// instance.setCrosswalkTransform(crosswalkTransforms);