Package org.apache.pig.builtin

Examples of org.apache.pig.builtin.InvokeForString.exec()


    @Test
    public void testStringInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {

        // Test non-static method
        InvokeForString is = new InvokeForString("java.lang.String.toUpperCase", "String", "false");
        assertEquals("FOO", is.exec(tf_.newTuple("foo")));

        // both "static" and "true" should work
        // Test static method
        is = new InvokeForString("java.lang.String.valueOf", "int", "true");
        Tuple t = tf_.newTuple(1);
View Full Code Here


        // both "static" and "true" should work
        // Test static method
        is = new InvokeForString("java.lang.String.valueOf", "int", "true");
        Tuple t = tf_.newTuple(1);
        t.set(0,231);
        assertEquals("231", is.exec(t));

        // test default (should be static)
        is = new InvokeForString("java.lang.String.valueOf", "int");
        assertEquals("231", is.exec(t));
View Full Code Here

        t.set(0,231);
        assertEquals("231", is.exec(t));

        // test default (should be static)
        is = new InvokeForString("java.lang.String.valueOf", "int");
        assertEquals("231", is.exec(t));

        // Test method with multiple args
        is = new InvokeForString(TestInvoker.class.getName()+".concatStrings", "String String");
        t = tf_.newTuple(2);
        t.set(0, "foo");
View Full Code Here

        // Test method with multiple args
        is = new InvokeForString(TestInvoker.class.getName()+".concatStrings", "String String");
        t = tf_.newTuple(2);
        t.set(0, "foo");
        t.set(1, "bar");
        assertEquals("foobar", is.exec(t));
    }

    @Test
    public void testNoArgInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt id = new InvokeForInt(TestInvoker.class.getName() + ".simpleStaticFunction");
View Full Code Here

      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));

      InvokeForString is = new InvokeForString(TestInvoker.class.getName() + ".concatStringArray", "string[]");
      DataBag strings = newSimpleBag("foo", "bar", "baz");
      assertEquals("foobarbaz", is.exec(tf_.newTuple(strings)));
    }

    @Test
    public void testDoubleInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForDouble il = new InvokeForDouble("java.lang.Double.valueOf", "String");
View Full Code Here

    @Test
    public void testStringInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {

        // Test non-static method
        InvokeForString is = new InvokeForString("java.lang.String.toUpperCase", "String", "false");
        assertEquals("FOO", is.exec(tf_.newTuple("foo")));

        // both "static" and "true" should work
        // Test static method
        is = new InvokeForString("java.lang.String.valueOf", "int", "true");
        Tuple t = tf_.newTuple(1);
View Full Code Here

        // both "static" and "true" should work
        // Test static method
        is = new InvokeForString("java.lang.String.valueOf", "int", "true");
        Tuple t = tf_.newTuple(1);
        t.set(0,231);
        assertEquals("231", is.exec(t));

        // test default (should be static)
        is = new InvokeForString("java.lang.String.valueOf", "int");
        assertEquals("231", is.exec(t));
View Full Code Here

        t.set(0,231);
        assertEquals("231", is.exec(t));

        // test default (should be static)
        is = new InvokeForString("java.lang.String.valueOf", "int");
        assertEquals("231", is.exec(t));

        // Test method with multiple args
        is = new InvokeForString(TestInvoker.class.getName()+".concatStrings", "String String");
        t = tf_.newTuple(2);
        t.set(0, "foo");
View Full Code Here

        // Test method with multiple args
        is = new InvokeForString(TestInvoker.class.getName()+".concatStrings", "String String");
        t = tf_.newTuple(2);
        t.set(0, "foo");
        t.set(1, "bar");
        assertEquals("foobar", is.exec(t));
    }

    @Test
    public void testNoArgInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt id = new InvokeForInt(TestInvoker.class.getName() + ".simpleStaticFunction");
View Full Code Here

      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));

      InvokeForString is = new InvokeForString(TestInvoker.class.getName() + ".concatStringArray", "string[]");
      DataBag strings = newSimpleBag("foo", "bar", "baz");
      assertEquals("foobarbaz", is.exec(tf_.newTuple(strings)));
    }

    @Test
    public void testDoubleInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForDouble il = new InvokeForDouble("java.lang.Double.valueOf", "String");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.