public function setUp()
{
$this->factory = new Factory();
$this->transport = $this->getMockBuilder('\\Jackalope\\Transport\\Jackrabbit\\Client')->disableOriginalConstructor()->getMock('fetchEventData');
$this->session = $this->getSessionMock(array('getNode', 'getNodesByIdentifier'));
$this->session->expects($this->any())->method('getNode')->will($this->returnValue(null));
$this->session->expects($this->any())->method('getNodesByIdentifier')->will($this->returnValue(array()));
$this->filter = new EventFilter($this->factory, $this->session);
$this->nodeTypeManager = $this->getMockBuilder('Jackalope\\NodeType\\NodeTypeManager')->disableOriginalConstructor()->getMock();
$this->buffer = new TestBuffer($this->factory, $this->filter, $this->transport, $this->nodeTypeManager, 'http://localhost:8080/server/tests/jcr%3aroot');
// XML for a single event
$this->eventXml = <<<EOF
<event xmlns="http://www.day.com/jcr/webdav/1.0">
<href xmlns="DAV:">http://localhost:8080/server/tests/jcr%3aroot/my_node%5b4%5d/jcr%3aprimaryType</href>
<eventtype>
<propertyadded/>
</eventtype>
<eventdate>1331652655099</eventdate>
<eventuserdata>somedifferentdata</eventuserdata>
<eventprimarynodetype>{http://www.jcp.org/jcr/nt/1.0}unstructured</eventprimarynodetype>
<eventidentifier>8fe5b853-a657-4ee3-b626-ec3b5407dc13</eventidentifier>
</event>
EOF;
// XML for event with eventinfo
$this->eventWithInfoXml = <<<EOX
<event xmlns="http://www.day.com/jcr/webdav/1.0">
<href
xmlns="DAV:">http://localhost:8080/server/tests/jcr%3aroot/my_other</href>
<eventtype>
<nodemoved/>
</eventtype>
<eventdate>1332163767892</eventdate>
<eventuserdata>somedifferentdata</eventuserdata>
<eventprimarynodetype>{internal}root</eventprimarynodetype>
<eventmixinnodetype>{internal}AccessControllable</eventmixinnodetype>
<eventidentifier>1e80ac75-eff4-4350-bae6-7fae2a84e6f3</eventidentifier>
<eventinfo>
<destAbsPath>/my_other</destAbsPath>
<srcAbsPath>/my_node</srcAbsPath>
</eventinfo>
</event>
EOX;
// XML for several events entries
$this->entryXml = <<<EOF
<entry>
<title>operations: /my_node[4]</title>
<id>http://localhost/server/tests?type=journal?type=journal&ts=1360caef7fb-0</id>
<author>
<name>system</name>
</author>
<updated>2012-03-13T16:30:55.099+01:00</updated>
<content type="application/vnd.apache.jackrabbit.event+xml">
EOF;
$this->entryXml .= $this->eventXml . "\n";
$this->entryXml .= $this->eventXml . "\n";
// The same event appears twice in this entry
$this->entryXml .= $this->eventWithInfoXml . "\n";
$this->entryXml .= '</content></entry>';
// The object representation of the event defined above
$this->expectedEvent = new Event($this->factory, $this->nodeTypeManager);
$this->expectedEvent->setDate('1331652655');
$this->expectedEvent->setIdentifier('8fe5b853-a657-4ee3-b626-ec3b5407dc13');
$this->expectedEvent->setPrimaryNodeTypeName('{http://www.jcp.org/jcr/nt/1.0}unstructured');
$this->expectedEvent->setPath('/my_node%5b4%5d/jcr%3aprimaryType');
$this->expectedEvent->setType(EventInterface::PROPERTY_ADDED);
$this->expectedEvent->setUserData('somedifferentdata');
$this->expectedEvent->setUserId('system');
$this->expectedEventWithInfo = new Event($this->factory, $this->nodeTypeManager);
$this->expectedEventWithInfo->setDate('1332163767');
$this->expectedEventWithInfo->setIdentifier('1e80ac75-eff4-4350-bae6-7fae2a84e6f3');
$this->expectedEventWithInfo->setPrimaryNodeTypeName('{internal}root');
$this->expectedEventWithInfo->setMixinNodeTypeNames(array('{internal}AccessControllable'));
$this->expectedEventWithInfo->setPath('/my_other');
$this->expectedEventWithInfo->setType(EventInterface::NODE_MOVED);
$this->expectedEventWithInfo->setUserData('somedifferentdata');
$this->expectedEventWithInfo->setUserId('system');
$this->expectedEventWithInfo->addInfo('destAbsPath', '/my_other');
$this->expectedEventWithInfo->addInfo('srcAbsPath', '/my_node');
}