|
|
@@ -14,7 +14,6 @@
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
# See the License for the specific language governing permissions and
|
|
|
# limitations under the License.
|
|
|
-from liboozie.oozie_api_test import OozieServerProvider
|
|
|
|
|
|
try:
|
|
|
import json
|
|
|
@@ -29,9 +28,12 @@ from nose.tools import assert_true, assert_equal
|
|
|
|
|
|
from desktop.lib.django_test_util import make_logged_in_client
|
|
|
from desktop.lib.test_utils import grant_access
|
|
|
-from pig.models import create_or_update_script, PigScript
|
|
|
+from liboozie.oozie_api_test import OozieServerProvider
|
|
|
from oozie.tests import OozieBase
|
|
|
|
|
|
+from pig.models import create_or_update_script, PigScript
|
|
|
+from pig.api import OozieApi
|
|
|
+
|
|
|
|
|
|
class TestPigBase(object):
|
|
|
SCRIPT_ATTRS = {
|
|
|
@@ -52,6 +54,51 @@ class TestPigBase(object):
|
|
|
attrs.update(TestPigBase.SCRIPT_ATTRS)
|
|
|
return create_or_update_script(**attrs)
|
|
|
|
|
|
+ def make_log_links(self):
|
|
|
+ # FileBrowser
|
|
|
+ assert_equal(
|
|
|
+ """<a href="/filebrowser/view/user/romain/tmp" target="_blank">hdfs://localhost:8020/user/romain/tmp</a> <dir>""",
|
|
|
+ OozieApi._make_links('hdfs://localhost:8020/user/romain/tmp <dir>')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ """<a href="/filebrowser/view/user/romain/tmp" target="_blank">hdfs://localhost:8020/user/romain/tmp</a><dir>""",
|
|
|
+ OozieApi._make_links('hdfs://localhost:8020/user/romain/tmp<dir>')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ """output: <a href="/filebrowser/view/user/romain/tmp" target="_blank">/user/romain/tmp</a> <dir>""",
|
|
|
+ OozieApi._make_links('output: /user/romain/tmp <dir>')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ 'Successfully read 3760 records (112648 bytes) from: "<a href="/filebrowser/view/user/hue/pig/examples/data/midsummer.txt" target="_blank">/user/hue/pig/examples/data/midsummer.txt</a>"',
|
|
|
+ OozieApi._make_links('Successfully read 3760 records (112648 bytes) from: "/user/hue/pig/examples/data/midsummer.txt"')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ 'data,upper_case MAP_ONLY <a href="/filebrowser/view/user/romain/out/fffff" target="_blank">hdfs://localhost:8020/user/romain/out/fffff</a>,',
|
|
|
+ OozieApi._make_links('data,upper_case MAP_ONLY hdfs://localhost:8020/user/romain/out/fffff,')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ 'MAP_ONLY <a href="/filebrowser/view/user/romain/out/fffff" target="_blank">hdfs://localhost:8020/user/romain/out/fffff</a>\n2013',
|
|
|
+ OozieApi._make_links('MAP_ONLY hdfs://localhost:8020/user/romain/out/fffff\n2013')
|
|
|
+ )
|
|
|
+
|
|
|
+ # JobBrowser
|
|
|
+ assert_equal(
|
|
|
+ """<a href="/jobbrowser/jobs/job_201306261521_0058" target="_blank">job_201306261521_0058</a>""",
|
|
|
+ OozieApi._make_links('job_201306261521_0058')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ """Hadoop Job IDs executed by Pig: <a href="/jobbrowser/jobs/job_201306261521_0058" target="_blank">job_201306261521_0058</a>""",
|
|
|
+ OozieApi._make_links('Hadoop Job IDs executed by Pig: job_201306261521_0058')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ """MapReduceLauncher - HadoopJobId: <a href="/jobbrowser/jobs/job_201306261521_0058" target="_blank">job_201306261521_0058</a>""",
|
|
|
+ OozieApi._make_links('MapReduceLauncher - HadoopJobId: job_201306261521_0058')
|
|
|
+ )
|
|
|
+ assert_equal(
|
|
|
+ """- More information at: http://localhost:50030/jobdetails.jsp?jobid=<a href="/jobbrowser/jobs/job_201306261521_0058" target="_blank">job_201306261521_0058</a>""",
|
|
|
+ OozieApi._make_links('- More information at: http://localhost:50030/jobdetails.jsp?jobid=job_201306261521_0058')
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
class TestMock(TestPigBase):
|
|
|
|