VIVO-774 fix a unit test that was broken by faux property refactoring.
This commit is contained in:
parent
875ba66a46
commit
ec36574041
2 changed files with 73 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
|
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
|
||||||
|
|
||||||
|
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.PolicyOption.POLICY_NEUTRAL;
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.ReasoningOption.ASSERTIONS_AND_INFERENCES;
|
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.ReasoningOption.ASSERTIONS_AND_INFERENCES;
|
||||||
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.FULL_UNION;
|
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.FULL_UNION;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -27,6 +28,7 @@ import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
||||||
|
import stubs.edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDaoStub;
|
||||||
import stubs.edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDaoStub;
|
import stubs.edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDaoStub;
|
||||||
import stubs.edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryStub;
|
import stubs.edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryStub;
|
||||||
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccessFactoryStub;
|
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccessFactoryStub;
|
||||||
|
@ -60,6 +62,7 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
|
||||||
|
|
||||||
private WebappDaoFactoryStub wadf;
|
private WebappDaoFactoryStub wadf;
|
||||||
private ObjectPropertyDaoStub opDao;
|
private ObjectPropertyDaoStub opDao;
|
||||||
|
private FauxPropertyDaoStub fpDao;
|
||||||
|
|
||||||
private ServletContextStub ctx;
|
private ServletContextStub ctx;
|
||||||
private HttpSessionStub session;
|
private HttpSessionStub session;
|
||||||
|
@ -117,8 +120,10 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
|
||||||
logMessages = new StringWriter();
|
logMessages = new StringWriter();
|
||||||
|
|
||||||
opDao = new ObjectPropertyDaoStub();
|
opDao = new ObjectPropertyDaoStub();
|
||||||
|
fpDao = new FauxPropertyDaoStub();
|
||||||
wadf = new WebappDaoFactoryStub();
|
wadf = new WebappDaoFactoryStub();
|
||||||
wadf.setObjectPropertyDao(opDao);
|
wadf.setObjectPropertyDao(opDao);
|
||||||
|
wadf.setFauxPropertyDao(fpDao);
|
||||||
|
|
||||||
ctx = new ServletContextStub();
|
ctx = new ServletContextStub();
|
||||||
// create paths for all of the files in the temporary config directory.
|
// create paths for all of the files in the temporary config directory.
|
||||||
|
@ -136,6 +141,7 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
|
||||||
|
|
||||||
mafs = new ModelAccessFactoryStub();
|
mafs = new ModelAccessFactoryStub();
|
||||||
mafs.get(vreq).setWebappDaoFactory(wadf, ASSERTIONS_AND_INFERENCES);
|
mafs.get(vreq).setWebappDaoFactory(wadf, ASSERTIONS_AND_INFERENCES);
|
||||||
|
mafs.get(vreq).setWebappDaoFactory(wadf, POLICY_NEUTRAL);
|
||||||
|
|
||||||
subject = new IndividualImpl();
|
subject = new IndividualImpl();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package stubs.edu.cornell.mannlib.vitro.webapp.dao;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.beans.FauxProperty;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.PropertyDao.FullPropertyKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
public class FauxPropertyDaoStub implements FauxPropertyDao {
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Stub infrastructure
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
private final Map<FullPropertyKey, FauxProperty> props = new HashMap<>();
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Stub methods
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FauxProperty getFauxPropertyByUris(String domainUri, String baseUri,
|
||||||
|
String rangeUri) {
|
||||||
|
return props.get(new FullPropertyKey(domainUri, baseUri, rangeUri));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Un-implemented methods
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FauxProperty> getFauxPropertiesForBaseUri(String uri) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"FauxPropertyDaoStub.getFauxPropertiesForBaseUri() not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FauxProperty getFauxPropertyFromContextUri(String contextUri) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"FauxPropertyDaoStub.getFauxPropertyFromContextUri() not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertFauxProperty(FauxProperty fp) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"FauxPropertyDaoStub.insertFauxProperty() not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateFauxProperty(FauxProperty fp) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"FauxPropertyDaoStub.updateFauxProperty() not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteFauxProperty(FauxProperty fp) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new RuntimeException(
|
||||||
|
"FauxPropertyDaoStub.deleteFauxProperty() not implemented.");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue