Demo Project
Introduction
You can build and test the demo project included in the CRISP project itself. Clone the project and run the demo from a specific released tag like the following example.
$ git clone --branch hippo-addon-crisp-2.0.5 https://code.onehippo.org/cms-community/hippo-addon-crisp.git $ cd hippo-addon-crisp $ cd demo $ mvn clean verify $ mvn -P cargo.run
Find the latest tags from here:
Build and Run Demo Project as a Contributor
If you want to test it locally and contribute somethings to the project, you might want to pull the master branch and fork it in a local feature branch. In that case, you need to build and install the module project itself before building and running the demo project. See the following example (assuming that you want to constribute for a ticket of CRISP JIRA project, CRISP-000, just as an example):
$ git clone https://code.onehippo.org/cms-community/hippo-addon-crisp.git $ cd hippo-addon-crisp $ git checkout master -b feature/CRISP-000 $ mvn clean install $ cd demo $ mvn clean verify $ mvn -P cargo.run
Testing in Content Delivery tier Application
- Visit http://localhost:8080/site/news/.
- Click on any news article.
- You will see all the product list with custom-generated URI links at the bottom of the page.
- The external product data was retrieved through ResourceServiceBroker. See site/src/main/java/org/onehippo/cms7/crisp/demo/components/NewsContentComponent.java and bootstrap/webfiles/src/main/resources/site/freemarker/hstdefault/newspage-main.ftl for detail.
Testing in Content Authoring tier Application
- Visit http://localhost:8080/cms/.
- Select and edit an news document.
- Select 'Related Products' field and try to add some products through the pop up dialog (which is part of External Document Picker plugin).
- The external product data was retrieved through ResourceServiceBroker. See cms/src/main/java/org/onehippo/cms7/crisp/demo/cms/plugin/CommerceProductDataServiceFacade.java for detail.
Testing an Example Web-Hook Invalidating Resource Data Cache
By default, the ResourceResolver component for demo product catalogs data in the demo project caches result data based on resource space name, operation name, relative resource path, path variables, etc. for 1 minutes ("time-to-live"). So, for the same requests, it will return the cached data without having to invoke the backend REST service again as long the the cached data was not expired in 1 minutes ("time-to-live").
You can clear all the cached data by invoking a "Web-Hook" URL like the following manually.
$ curl http://localhost:8080/site/examples/invalidate-cache.jsp \ -d "resource_space=demoProductCatalogs&secret=some_secret"
If you invoke the "Web-Hook" page manually, then the specific resource data cache will be cleared right away in this example.