/** * Tests if the merge method works successfully. * * @return void */ public function testMergeSuccessful() { // initialize the configuration $node = new SessionNode(); $node->initFromFile(__DIR__ . '/_files/dd-statefulsessionbean.xml'); // initialize the descriptor from the nodes data $this->descriptor->fromConfiguration($node); // initialize the descriptor to merge $descriptorToMerge = $this->getMockForAbstractClass('AppserverIo\\Description\\StatefulSessionBeanDescriptor'); // initialize the configuration of the descriptor to be merged $nodeToMerge = new SessionNode(); $nodeToMerge->initFromFile(__DIR__ . '/_files/dd-statefulsessionbean-to-merge.xml'); $descriptorToMerge->fromConfiguration($nodeToMerge); // merge the descriptors $this->descriptor->merge($descriptorToMerge); // check that the descriptor has been initialized $this->assertSame('UserProcessor', $this->descriptor->getName()); $this->assertSame('AppserverIo\\Apps\\Example\\Services\\UserProcessor', $this->descriptor->getClassName()); $this->assertSame('Stateful', $this->descriptor->getSessionType()); // check for initialized lifecycle callbacks $this->assertContains('newDetach', $this->descriptor->getPostDetachCallbacks()); $this->assertContains('newAttach', $this->descriptor->getPreAttachCallbacks()); $this->assertContains('newActivate', $this->descriptor->getPostActivateCallbacks()); $this->assertContains('newPassivate', $this->descriptor->getPrePassivateCallbacks()); $this->assertContains('logout', $this->descriptor->getRemoveMethods()); $this->assertCount(2, $this->descriptor->getPostDetachCallbacks()); $this->assertCount(2, $this->descriptor->getPreAttachCallbacks()); $this->assertCount(2, $this->descriptor->getPostActivateCallbacks()); $this->assertCount(2, $this->descriptor->getPrePassivateCallbacks()); }