public function testNonEmpty() { return; $workingdir = getcwd(); $configFile = Xinc_Config_File::load($workingdir . '/test/resources/testNonEmptySystem.xml'); $parser = new Xinc_Config_Parser($configFile); $plugins = $parser->getPlugins(); $this->assertTrue($plugins->count() == 1, 'One plugin should be detected'); $pluginParser = new Xinc_Plugin_Parser(); $pluginParser->parse($plugins); $repository = Xinc_Plugin_Repository::getInstance(); $plugins = $repository->getPlugins(); $this->assertTrue($plugins->count() == 1, 'Should have one plugin'); }
public function testBuildProperties() { Xinc_Plugin_Repository::tearDown(); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Property()); $workingdir = getcwd(); $engine = new Xinc_Engine_Sunrise(); $config = new Xinc_Project_Config($workingdir . '/test/resources/testProjectsPlugProperty.xml'); $buildIterator = $engine->parseProjects($config->getProjects()); $this->assertTrue($buildIterator instanceof Xinc_Build_Iterator, 'Should be of type Xinc_Build_Iterator'); $build = $buildIterator->next(); $engine->build($build); $original = $build->getProperties()->get('original'); $compare = $build->getProperties()->get('compare'); $this->assertEquals($original, $compare, 'Value should have been substituted and should be equal now: ' . $original . '!=' . $compare); }
public function testExampleInvalid() { $workingdir = getcwd(); Xinc_Plugin_Repository::tearDown(); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Builder()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet_BuildAlways()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Phing()); $configFileName = $workingdir . '/test/resources/testSunriseExampleInvalidProject.xml'; $config = new Xinc_Project_Config($configFileName); $projects = $config->getProjects(); $engineParser = new Xinc_Engine_Sunrise_Parser(new Xinc_Engine_Sunrise()); $result = $engineParser->parseProjects($projects); $this->assertTrue(count($result) == 1, 'Should have one item in the array'); $build1 = $result[0]; $projectStatus = $build1->getProject()->getStatus(); $this->assertEquals(Xinc_Project_Status::MISCONFIGURED, $projectStatus, 'Project status should be MISCONFIGURED but is: ' . $projectStatus); }
/** * Enter description here... * * @param SimpleXMLElement $pluginXml * * @throws Xinc_Plugin_Exception_FileNotFound * @throws Xinc_Plugin_Exception_ClassNotFound * @throws Xinc_Plugin_Exception_Invalid * @throws Xinc_Plugin_Task_Exception */ private static function loadPlugin(SimpleXMLElement $pluginXml) { $plugins = array(); $attributes = $pluginXml->attributes(); Xinc_Logger::getInstance()->info('Registering plugin: ' . $attributes->classname . ' from file ' . $attributes->filename); $res = (include_once (string) $attributes->filename); if (!$res && !class_exists((string) $attributes->classname)) { throw new Xinc_Plugin_Exception_FileNotFound((string) $attributes->classname, (string) $attributes->filename); } if (!class_exists((string) $attributes->classname)) { throw new Xinc_Plugin_Exception_ClassNotFound((string) $attributes->classname, (string) $attributes->filename); } $classname = (string) $attributes->classname; $plugin = new $classname(); if (!$plugin instanceof Xinc_Plugin_Interface) { throw new Xinc_Plugin_Exception_Invalid((string) $attributes->classname); } Xinc_Plugin_Repository::getInstance()->registerPlugin($plugin); }
public function testExample() { Xinc_Plugin_Repository::tearDown(); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Builder()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_ModificationSet_BuildAlways()); Xinc_Plugin_Repository::getInstance()->registerPlugin(new Xinc_Plugin_Repos_Phing()); $workingdir = getcwd(); $engine = new Xinc_Engine_Sunrise(); $config = new Xinc_Project_Config($workingdir . '/test/resources/testSunriseExampleProject.xml'); $buildIterator = $engine->parseProjects($config->getProjects()); $this->assertTrue($buildIterator instanceof Xinc_Build_Iterator, 'Should be of type Xinc_Build_Iterator'); $build = $buildIterator->next(); try { $build->build(); } catch (Exception $e) { var_dump($e); } $this->assertTrue($build->getLastBuild()->getStatus() == Xinc_Build_Interface::PASSED, 'Build should pass'); }
public function updateTasks() { $this->setters = Xinc_Plugin_Repository::getInstance()->getTasksForSlot(Xinc_Plugin_Slot::PROJECT_SET_VALUES); $this->setProperty('project.name', $this->getProject()->getName()); $this->setProperty('build.number', $this->getNumber()); $this->setProperty('build.label', $this->getLabel()); $builtinProps = Xinc::getInstance()->getBuiltinProperties(); foreach ($builtinProps as $prop => $value) { $this->setProperty($prop, $value); } $tasks = $this->getTaskRegistry()->getTasks(); while ($tasks->hasNext()) { $task = $tasks->next(); $this->_updateTask($task); } }