diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java index 7e608b44e..882d6297c 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/ObjectPropertyTemplateModel_PropertyListConfigTest.java @@ -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(); diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDaoStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDaoStub.java new file mode 100644 index 000000000..4c0321b0b --- /dev/null +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDaoStub.java @@ -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 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 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."); + } +}