http://code.google.com/p/emt/source/detail?r=230
Added:
/trunk/test/plugins
/trunk/test/plugins/commands
/trunk/test/plugins/commands/test.php
/trunk/test/plugins/fields
/trunk/test/plugins/fields/test.php
Deleted:
/trunk/plugins/commands/test.php
/trunk/plugins/fields/test.php
Modified:
/trunk/base/field.php
/trunk/test/etc/emt.cnf
/trunk/test/etc/emt_sqlite_input.cnf
=======================================
--- /dev/null
+++ /trunk/test/plugins/commands/test.php Mon Feb 6 14:53:35 2012
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************************
+ * Copyright (C) 2007 by Eric Bergen *
+ * er...@provenscaling.com *
+ *
*
+ * This program is free software; you can redistribute it and/or modify
*
+ * it under the terms of the GNU Lesser General Public License as
published by *
+ * the Free Software Foundation; either version 2 of the License, or
*
+ * (at your option) any later version.
*
+ *
*
+ * This program is distributed in the hope that it will be useful,
*
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
*
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
+ * GNU Lesser General Public License for more
details. *
+ *
*
+ * You should have received a copy of the GNU Lesser General Public
License *
+ * along with this program; if not, write to the
*
+ * Free Software Foundation, Inc.,
*
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+
***************************************************************************/
+
+class test_command extends gather_general
+{
+ function command()
+ {
+ /**
+ * Make sure the two instances
+ * get different values to test with
+ */
+ if ($this->instance_name == "inst_two")
+ $var = 10;
+ else
+ $var = 0;
+
+ $this->cmd = "echo " .
+ "test_single=" . (1 + $var + .01) .
+ ",test_multiple.foo=" . (2 + $var + .2) .
+ ",test_multiple.dm-1=" . (3 + $var + .3) .
+ ",test_multiple.bar=" . (4 + $var);
+ }
+}
+
+class time_me_out extends gather_general
+{
+ function command()
+ {
+ $this->cmd = "sleep " . ($this->gather_time + 10);
+ }
+}
=======================================
--- /dev/null
+++ /trunk/test/plugins/fields/test.php Mon Feb 6 14:53:35 2012
@@ -0,0 +1,58 @@
+<?php
+/***************************************************************************
+ * Copyright (C) 2007 by Eric Bergen *
+ * er...@provenscaling.com *
+ *
*
+ * This program is free software; you can redistribute it and/or modify
*
+ * it under the terms of the GNU Lesser General Public License as
published by *
+ * the Free Software Foundation; either version 2 of the License, or
*
+ * (at your option) any later version.
*
+ *
*
+ * This program is distributed in the hope that it will be useful,
*
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
*
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
+ * GNU Lesser General Public License for more
details. *
+ *
*
+ * You should have received a copy of the GNU Lesser General Public
License *
+ * along with this program; if not, write to the
*
+ * Free Software Foundation, Inc.,
*
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
+
***************************************************************************/
+
+register_field('test_single');
+class test_single_field extends csv_field
+{
+ var $namespace = 'test';
+ var $name = 'test_single';
+ var $fname = 'Test Single';
+ var $description = 'This is a single field';
+ var $type = 'incr';
+ var $precision = 1;
+ var $command = 'test_command';
+}
+
+register_field('test_multiple');
+class test_multiple_field extends csv_field
+{
+ var $namespace = 'test';
+ var $name = 'test_multiple';
+ var $fname = 'Test Multiple';
+ var $description = 'This is a multi value field';
+ var $type = 'incr';
+ var $precision = 1;
+ var $command = 'test_command';
+ var $multi_value = TRUE;
+}
+
+register_field('time_me_out');
+class time_me_out_field extends csv_field
+{
+ var $namespace = 'test';
+ var $name = 'time_me_out';
+ var $fname = 'Time Me Out';
+ var $description = 'This field will take 10 seconds longer than
gather_time to complete';
+ var $type = 'avg';
+ var $precision = 0;
+ var $command = 'time_me_out';
+}
+
=======================================
--- /trunk/plugins/commands/test.php Fri Feb 11 09:39:21 2011
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/***************************************************************************
- * Copyright (C) 2007 by Eric Bergen *
- * er...@provenscaling.com *
- *
*
- * This program is free software; you can redistribute it and/or modify
*
- * it under the terms of the GNU Lesser General Public License as
published by *
- * the Free Software Foundation; either version 2 of the License, or
*
- * (at your option) any later version.
*
- *
*
- * This program is distributed in the hope that it will be useful,
*
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
*
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
- * GNU Lesser General Public License for more
details. *
- *
*
- * You should have received a copy of the GNU Lesser General Public
License *
- * along with this program; if not, write to the
*
- * Free Software Foundation, Inc.,
*
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
-
***************************************************************************/
-
-class test_command extends gather_general
-{
- function command()
- {
- /**
- * Make sure the two instances
- * get different values to test with
- */
- if ($this->instance_name == "inst_two")
- $var = 10;
- else
- $var = 0;
-
- $this->cmd = "echo " .
- "test_single=" . (1 + $var + .01) .
- ",test_multiple.foo=" . (2 + $var + .2) .
- ",test_multiple.dm-1=" . (3 + $var + .3) .
- ",test_multiple.bar=" . (4 + $var);
- }
-}
-
-class time_me_out extends gather_general
-{
- function command()
- {
- $this->cmd = "sleep " . ($this->gather_time + 10);
- }
-}
=======================================
--- /trunk/plugins/fields/test.php Mon Jan 9 20:49:04 2012
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/***************************************************************************
- * Copyright (C) 2007 by Eric Bergen *
- * er...@provenscaling.com *
- *
*
- * This program is free software; you can redistribute it and/or modify
*
- * it under the terms of the GNU Lesser General Public License as
published by *
- * the Free Software Foundation; either version 2 of the License, or
*
- * (at your option) any later version.
*
- *
*
- * This program is distributed in the hope that it will be useful,
*
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
*
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*
- * GNU Lesser General Public License for more
details. *
- *
*
- * You should have received a copy of the GNU Lesser General Public
License *
- * along with this program; if not, write to the
*
- * Free Software Foundation, Inc.,
*
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
-
***************************************************************************/
-
-register_field('test_single');
-class test_single_field extends csv_field
-{
- var $namespace = 'test';
- var $name = 'test_single';
- var $fname = 'Test Single';
- var $description = 'This is a single field';
- var $type = 'incr';
- var $precision = 1;
- var $command = 'test_command';
-}
-
-register_field('test_multiple');
-class test_multiple_field extends csv_field
-{
- var $namespace = 'test';
- var $name = 'test_multiple';
- var $fname = 'Test Multiple';
- var $description = 'This is a multi value field';
- var $type = 'incr';
- var $precision = 1;
- var $command = 'test_command';
- var $multi_value = TRUE;
-}
-
-register_field('time_me_out');
-class time_me_out_field extends csv_field
-{
- var $namespace = 'test';
- var $name = 'time_me_out';
- var $fname = 'Time Me Out';
- var $description = 'This field will take 10 seconds longer than
gather_time to complete';
- var $type = 'avg';
- var $precision = 0;
- var $command = 'time_me_out';
-}
-
=======================================
--- /trunk/base/field.php Mon Jan 16 10:59:53 2012
+++ /trunk/base/field.php Mon Feb 6 14:53:35 2012
@@ -204,10 +204,8 @@
{}
}
-function load_dir($src_dir)
-{
- $src_dir = INSTALL_PATH . $src_dir;
-
+function load_one_dir($src_dir)
+{
if (is_dir($src_dir))
{
if ($dir = opendir($src_dir))
@@ -222,6 +220,19 @@
}
}
}
+
+function load_dir($src_dir)
+{
+ global $config;
+ $ret = load_one_dir(INSTALL_PATH . $src_dir);
+
+ if (isset($config['global']['extra_plugin_path']))
+ {
+ $ret =
load_one_dir($config['global']['extra_plugin_path'] . "/" . $src_dir);
+ }
+
+ return $ret;
+}
function load_fields($fields_dir = 'plugins/fields/')
{
=======================================
--- /trunk/test/etc/emt.cnf Mon Feb 6 13:38:39 2012
+++ /trunk/test/etc/emt.cnf Mon Feb 6 14:53:35 2012
@@ -1,6 +1,7 @@
[global]
gather_time = 5
logger = text
+extra_plugin_path=./
[logger_text]
file = ./tmp/log.txt
=======================================
--- /trunk/test/etc/emt_sqlite_input.cnf Thu Jan 12 15:31:08 2012
+++ /trunk/test/etc/emt_sqlite_input.cnf Mon Feb 6 14:53:35 2012
@@ -1,3 +1,6 @@
+[global]
+extra_plugin_path=./
+
[emt_view]
default_view = default
output_records = 100