Skip to content
Snippets Groups Projects
Commit 0d3d593a authored by juanf's avatar juanf
Browse files

SSDM-13207 : Fixing tests

parent 5a994237
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package ch.systemsx.cisd.openbis.generic.server; package ch.systemsx.cisd.openbis.generic.server;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.DAOFactory;
import ch.systemsx.cisd.openbis.generic.shared.ISessionWorkspaceProvider; import ch.systemsx.cisd.openbis.generic.shared.ISessionWorkspaceProvider;
import ch.systemsx.cisd.openbis.generic.shared.SessionWorkspaceProvider; import ch.systemsx.cisd.openbis.generic.shared.SessionWorkspaceProvider;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -41,6 +42,8 @@ public class CommonServiceProvider ...@@ -41,6 +42,8 @@ public class CommonServiceProvider
{ {
private static ApplicationContext applicationContext; private static ApplicationContext applicationContext;
private static IDAOFactory daoFactory;
public static void setApplicationContext(ApplicationContext context) public static void setApplicationContext(ApplicationContext context)
{ {
applicationContext = context; applicationContext = context;
...@@ -63,7 +66,15 @@ public class CommonServiceProvider ...@@ -63,7 +66,15 @@ public class CommonServiceProvider
public static IDAOFactory getDAOFactory() public static IDAOFactory getDAOFactory()
{ {
return (IDAOFactory) applicationContext.getBean("dao-factory"); if (daoFactory == null) {
daoFactory = (IDAOFactory) applicationContext.getBean("dao-factory");
}
return daoFactory;
}
public static void setDAOFactory(IDAOFactory daoFactory)
{
CommonServiceProvider.daoFactory = daoFactory;
} }
public static ICommonBusinessObjectFactory getBusinessObjectFactory() public static ICommonBusinessObjectFactory getBusinessObjectFactory()
......
...@@ -19,6 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared; ...@@ -19,6 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import ch.systemsx.cisd.openbis.generic.server.CommonServiceProvider;
import ch.systemsx.cisd.openbis.generic.shared.dto.*;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.jmock.Expectations; import org.jmock.Expectations;
import org.jmock.Mockery; import org.jmock.Mockery;
...@@ -84,15 +86,6 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources; ...@@ -84,15 +86,6 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.PersistencyResources;
import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.IPermIdDAO; import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.IPermIdDAO;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DisplaySettings; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DisplaySettings;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment;
import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePE;
import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE;
import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePE;
import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE;
import ch.systemsx.cisd.openbis.generic.shared.dto.Session;
import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE;
import ch.systemsx.cisd.openbis.generic.shared.util.MaterialConfigurationProvider; import ch.systemsx.cisd.openbis.generic.shared.util.MaterialConfigurationProvider;
import ch.systemsx.cisd.openbis.util.LogRecordingUtils; import ch.systemsx.cisd.openbis.util.LogRecordingUtils;
...@@ -134,6 +127,8 @@ public abstract class AbstractServerTestCase extends AssertJUnit ...@@ -134,6 +127,8 @@ public abstract class AbstractServerTestCase extends AssertJUnit
protected ISampleDAO sampleDAO; protected ISampleDAO sampleDAO;
protected ISampleRelationshipDAO sampleRelationshipDAO;
protected ISpaceBO spaceBO; protected ISpaceBO spaceBO;
protected ISampleBO sampleBO; protected ISampleBO sampleBO;
...@@ -236,10 +231,12 @@ public abstract class AbstractServerTestCase extends AssertJUnit ...@@ -236,10 +231,12 @@ public abstract class AbstractServerTestCase extends AssertJUnit
propertiesBatchManager = context.mock(IPropertiesBatchManager.class); propertiesBatchManager = context.mock(IPropertiesBatchManager.class);
// DAO // DAO
daoFactory = context.mock(IDAOFactory.class); daoFactory = context.mock(IDAOFactory.class);
CommonServiceProvider.setDAOFactory(daoFactory);
personDAO = context.mock(IPersonDAO.class); personDAO = context.mock(IPersonDAO.class);
groupDAO = context.mock(ISpaceDAO.class); groupDAO = context.mock(ISpaceDAO.class);
spaceDAO = groupDAO; spaceDAO = groupDAO;
sampleDAO = context.mock(ISampleDAO.class); sampleDAO = context.mock(ISampleDAO.class);
sampleRelationshipDAO = context.mock(ISampleRelationshipDAO.class);
roleAssignmentDAO = context.mock(IRoleAssignmentDAO.class); roleAssignmentDAO = context.mock(IRoleAssignmentDAO.class);
dataSetDAO = context.mock(IDataDAO.class); dataSetDAO = context.mock(IDataDAO.class);
permIdDAO = context.mock(IPermIdDAO.class); permIdDAO = context.mock(IPermIdDAO.class);
...@@ -298,6 +295,8 @@ public abstract class AbstractServerTestCase extends AssertJUnit ...@@ -298,6 +295,8 @@ public abstract class AbstractServerTestCase extends AssertJUnit
will(returnValue(groupDAO)); will(returnValue(groupDAO));
allowing(daoFactory).getSampleDAO(); allowing(daoFactory).getSampleDAO();
will(returnValue(sampleDAO)); will(returnValue(sampleDAO));
allowing(daoFactory).getSampleRelationshipDAO();
will(returnValue(sampleRelationshipDAO));
allowing(daoFactory).getExperimentDAO(); allowing(daoFactory).getExperimentDAO();
will(returnValue(experimentDAO)); will(returnValue(experimentDAO));
allowing(daoFactory).getRoleAssignmentDAO(); allowing(daoFactory).getRoleAssignmentDAO();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment