示例#1
0
 public function testDeleteNodeDeletesNodeProperties()
 {
     $pipe = new ymcPipe();
     $node = new ymcPipeBasicNodeMock($pipe);
     $pipe->deleteNode($node);
     $this->assertFalse(isset($node->config));
     $this->assertFalse(isset($node->inNodes));
     $this->assertFalse(isset($node->outNodes));
     $this->assertFalse(isset($node->id));
 }
 public function testVisitOneNodeAndGetConfig()
 {
     $pipe = new ymcPipe();
     $node = $pipe->createNode('ymcPipeNodeForConfigTest');
     $node->_initConfiguration(array('item' => array('type' => ymcPipeNodeConfiguration::TYPE_STRING)));
     $visitor = new ymcPipeConfigurationEditorVisitor();
     $pipe->accept($visitor);
     // nodes do not have id's yet! This could fail sometime
     $this->assertEquals(array(array('item' => array('type' => ymcPipeNodeConfiguration::TYPE_STRING, 'value' => ''))), $visitor->getConfigurations());
 }
 public function testExecute()
 {
     $pipe = new ymcPipe();
     $node = $pipe->createNode('ymcPipeGetExecutionVariableNode');
     $node->config->variable = 'test';
     $execution = new ymcPipeExecutionNonSuspendable();
     $execution->pipe = $pipe;
     $execution->variables['test'] = 'vvv';
     $pipe->accept(new ymcPipeSetIdVisitor());
     $execution->start();
     $this->assertEquals('vvv', $node->getOutput());
 }
示例#4
0
 /**
  * Activates all nodes which do not have start nodes and are therefor startNodes.
  * 
  * @access protected
  */
 protected function activateStartNodes()
 {
     foreach ($this->pipe->getStartNodes() as $node) {
         $node->activate($this);
     }
 }
示例#5
0
 public function testUpdateExecution()
 {
     $db = $this->getEmptyDb();
     $execution = new ymcPipeExecutionDatabase($db);
     $execution->setPipe('testPipe', 11);
     $defStorage = new ymcPipeDefinitionStorageMock();
     $pipe = new ymcPipe();
     $defStorage->pipe = $pipe;
     $node = $pipe->createNode('ymcPipeNodeForExecutionMock');
     $execution->definitionStorage = $defStorage;
     $node->todo = false;
     $node->id = 1;
     $execution->start();
     $execution->store();
     $newExecution = new ymcPipeExecutionDatabase($db, $execution->id);
     $newExecution->definitionStorage = $defStorage;
     $newExecution->pipe;
     $node->todo = true;
     $node->variables['test'] = 'value';
     $newExecution->store();
     $newnewExecution = new ymcPipeExecutionDatabase($db, $execution->id);
     $pipe = new ymcPipe();
     $defStorage->pipe = $pipe;
     $node = $pipe->createNode('ymcPipeNodeForExecutionMock');
     $node->id = 1;
     $newnewExecution->definitionStorage = $defStorage;
     $newnewExecution->pipe;
     $newnewExecution->store();
     $this->assertEquals('value', $node->variables['test']);
 }
示例#6
0
 public function testUnfinishedExecutionSetsStateToSuspended()
 {
     $pipe = new ymcPipe();
     $node = $pipe->createNode('ymcPipeNodeForExecutionMock');
     $node->todo = false;
     $execution = new ymcPipeExecutionActivationMock();
     $execution->setPipe($pipe);
     $pipe->accept(new ymcPipeSetIdVisitor());
     $execution->start();
     $this->assertEquals(ymcPipeExecution::SUSPENDED, $execution->executionState);
 }
示例#7
0
 public function __construct(ymcPipe $pipe, $name = '', ymcPipeNodeConfiguration $config = null)
 {
     $this->pipe = $pipe;
     $this->name = $name;
     $configurationClass = $this->getConfigurationClass();
     $pipe->addNode($this);
     if (NULL !== $configurationClass) {
         if (NULL !== $config) {
             $this->config = $config;
             if (!$this->config instanceof $configurationClass) {
                 throw new ymcPipeNodeException(sprintf('Configuration Object given to constructor of %s must be an instance of %s. Given Class is %s.', get_class($this), $configurationClass, get_class($config)));
             }
         } else {
             $this->config = new $configurationClass();
             if (!$this->config instanceof ymcPipeNodeConfiguration) {
                 throw new ymcPipeNodeException('Return Value of ' . get_class($this) . '->getConfigurationObject() is not an instanceof ymcPipeNodeConfiguration');
             }
         }
     }
     $this->inNodes = new ymcPipeNodeList();
     $this->outNodes = new ymcPipeNodeList();
 }