VIVO-774 fix a unit test that was broken by faux property refactoring.

This commit is contained in:
Jim Blake 2014-12-09 11:41:26 -05:00
parent 875ba66a46
commit ec36574041
2 changed files with 73 additions and 0 deletions

View file

@ -2,6 +2,7 @@
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.ModelNames.FULL_UNION;
import static org.junit.Assert.assertEquals;
@ -27,6 +28,7 @@ import org.junit.Rule;
import org.junit.Test;
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.WebappDaoFactoryStub;
import stubs.edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccessFactoryStub;
@ -60,6 +62,7 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
private WebappDaoFactoryStub wadf;
private ObjectPropertyDaoStub opDao;
private FauxPropertyDaoStub fpDao;
private ServletContextStub ctx;
private HttpSessionStub session;
@ -117,8 +120,10 @@ public class ObjectPropertyTemplateModel_PropertyListConfigTest extends
logMessages = new StringWriter();
opDao = new ObjectPropertyDaoStub();
fpDao = new FauxPropertyDaoStub();
wadf = new WebappDaoFactoryStub();
wadf.setObjectPropertyDao(opDao);
wadf.setFauxPropertyDao(fpDao);
ctx = new ServletContextStub();
// 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.get(vreq).setWebappDaoFactory(wadf, ASSERTIONS_AND_INFERENCES);
mafs.get(vreq).setWebappDaoFactory(wadf, POLICY_NEUTRAL);
subject = new IndividualImpl();

View file

@ -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.");
}
}