Exemple #1
0
echo "<br/>";
echo "The alias map line [" . $testMapLine . "]<br/>";
echo "<br/>";
echo "* Test Alias Map<br/>";
try {
    $anAliasMap = new AliasMapElement($testMapLine);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of alias Map toString [" . $anAliasMap . "]<br/>";
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "* Test Alias Map with no args <br/>";
try {
    $anAliasMap = new AliasMapElement();
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of alias map toString [" . $anAliasMap . "]<br/>";
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "<br/>";
echo "The alias map file [aliasmap]<br/>";
echo "<br/>";
echo "* Test Alias Map file<br/>";
try {
    $anAliasMap = new AliasMap(DB_FILE_LOCATION . "aliasmap");
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of alias Map get element objects<br/>";
    pr($anAliasMap->getElementObjects("ALL_OBJECTS"));
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of alias Map file<br/>";
    pr($anAliasMap);
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "-------------------- End Test bed for Alias classes --------------------<br/>";
require_once FUNC_FILE_LOCATION . "debug.func.php";
require_once CLASS_FILE_LOCATION . "heyuconf.class.php";
require_once "./heyuconfold.class.php";
require_once "./converttoaliasmap.func.php";
//$testLine = "section timers";
echo "-------------------- Test bed for heyu conf conversion --------------------<br/>";
echo "<br/>";
echo "The heyu conf file [x10.conf]<br/>";
echo "<br/>";
echo "* Test Heyu Conf file<br/>";
try {
    $aHeyuConf = new heyuConfOld("/etc/heyu/x10.conf");
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu conf old get derived alias map<br/>";
    $newAliasLines = $aHeyuConf->getAliasesWithLocationAndType();
    pr($newAliasLines);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of heyu conf new alias map<br/>";
    $newAliasMap = new AliasMap();
    foreach ($newAliasLines as $aliasLine) {
        $newAliasMap->addElement(new AliasMapElement($aliasLine));
    }
    pr($newAliasMap);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of new Format heyu conf file<br/>";
    $newHeyuConf = new heyuConf("../doc/x10.conf");
    pr($newHeyuConf);
    echo "&nbsp;&nbsp;&nbsp;&nbsp;The return of Converted heyu conf file<br/>";
    convert_to_alias_map($aHeyuConf, $newHeyuConf);
    pr($newHeyuConf);
} catch (Exception $e) {
    echo "&nbsp;&nbsp;&nbsp;&nbsp;E!: " . $e->getMessage() . "<br/>";
}
echo "-------------------- End Test bed for heyu conf conversion --------------------<br/>";