[MAGNOLIA-1452] testing: mock objects for content Created: 06/Apr/07 Updated: 23/Jan/13 Resolved: 05/Dec/07 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 3.1 M1 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Philipp Bärfuss | Assignee: | Philipp Bärfuss |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Sub-Tasks: |
|
||||||||||
| Template: |
|
||||||||||
| Acceptance criteria: |
Empty
|
||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||
| Date of First Response: |
| Description |
|
I started to write mock Content, NodeData objects. They can be used for writing tests. The goal is to write a util class transforming a properties file to a content structure. This facilitates writing test (mainly for configuration and similar) a lot |
| Comments |
| Comment by Philipp Bracher [ 13/Apr/07 ] |
|
I checked in first mock objects found in the package info.magnolia.test.mock
Use the MockUtil to build a mock hierarchy easily. MockUtil.initMockContext() The properties String or Stream you provide defines the node properties, types and uuids. Here follows an example: parent.type = mgnl:test parent.sub1.type = mgnl:sub parent.sub2.type = mgnl:sub hm.getContent("/parent/sub1").getNodeData("prop3").getBoolean() --> true |
| Comment by Magnolia International [ 13/Apr/07 ] |
|
I would say : check the testcases out for samples |
| Comment by Magnolia International [ 13/Apr/07 ] |
|
Added (very) basic MetaData support. |
| Comment by Philipp Bracher [ 26/Apr/07 ] |
|
You can set a workspace mock on the hierarchy manager. This is for example usefull where we use observation. |
| Comment by Philipp Bracher [ 05/Jun/07 ] |
|
Added two things:
|
| Comment by Philipp Bracher [ 13/Jun/07 ] |
|
Added support for binaries |
| Comment by Vivian Steller [ 05/Dec/07 ] |
|
the MockContent class does not support adding multiple nodes with same name, so behaves differently in tests than the actual JCR implementation. |
| Comment by Vivian Steller [ 05/Dec/07 ] |
|
from greg: put last comment into |