Compiling test cases

Hello,
The main application builds properly, but the test does not, even with the same set of jars defined. I’m not having a problem with the test itself, but rather that the jars are not being picked up in the path the test application. So far I haven’t found anything that works.

I would appreciate any ideas or suggestions on getting the test application to compile correctly.

If you have any questions, please free to ask.

Thanks,

Harlan…

Output:
user1@linuxdesktop:~/workspace/project/trunk$ gradle --info build
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file ‘/home/user1/workspace/project/trunk/build.gradle’.
Included projects: [root project ‘trunk’]
Evaluating root project ‘trunk’ using build file ‘/home/user1/workspace/project/trunk/build.gradle’.
All projects evaluated.
Selected primary task ‘build’ from project :
Tasks to be executed: [task ‘:compileJava’, task ‘:processResources’, task ‘:classes’, task ‘:jar’, task ‘:assemble’, task ‘:compileTestJava’, task ‘:processTestResources’, task ‘:testClasses’, task ‘:test’, task ‘:check’, task ‘:build’]
:compileJava (Thread[main,5,main]) started.
:compileJava
Skipping task ‘:compileJava’ as it is up-to-date (took 2.156 secs).
:compileJava UP-TO-DATE
:compileJava (Thread[main,5,main]) completed. Took 2.243 secs.
:processResources (Thread[main,5,main]) started.
:processResources
Skipping task ‘:processResources’ as it has no source files.
:processResources UP-TO-DATE
:processResources (Thread[main,5,main]) completed. Took 0.002 secs.
:classes (Thread[main,5,main]) started.
:classes
Skipping task ‘:classes’ as it has no actions.
:classes UP-TO-DATE
:classes (Thread[main,5,main]) completed. Took 0.007 secs.
:jar (Thread[main,5,main]) started.
:jar
Skipping task ‘:jar’ as it is up-to-date (took 0.021 secs).
:jar UP-TO-DATE
:jar (Thread[main,5,main]) completed. Took 0.027 secs.
:assemble (Thread[main,5,main]) started.
:assemble
Skipping task ‘:assemble’ as it has no actions.
:assemble UP-TO-DATE
:assemble (Thread[main,5,main]) completed. Took 0.002 secs.
:compileTestJava (Thread[main,5,main]) started.
:compileTestJava
Executing task ‘:compileTestJava’ (up-to-date check took 0.281 secs) due to:
No history is available.
All input files are considered out-of-date for incremental task ‘:compileTestJava’.
Compiling with JDK Java compiler API.
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:24: error: cannot find symbol
@Test
^
symbol: class Test
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:24: error: cannot find symbol
@Test
^
symbol: class Test
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:29: error: cannot find symbol
ObjectInspector stringOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
^
symbol: variable PrimitiveObjectInspectorFactory
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:30: error: cannot find symbol
ObjectInspector listOI = ObjectInspectorFactory.getStandardListObjectInspector(stringOI);
^
symbol: variable ObjectInspectorFactory
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:31: error: cannot find symbol
JavaBooleanObjectInspector resultInspector = (JavaBooleanObjectInspector) example.initialize(new ObjectInspector{listOI, stringOI});
^
symbol: class JavaBooleanObjectInspector
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:31: error: cannot find symbol
JavaBooleanObjectInspector resultInspector = (JavaBooleanObjectInspector) example.initialize(new ObjectInspector{listOI, stringOI});
^
symbol: class JavaBooleanObjectInspector
location: class GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:31: error: cannot find symbol
JavaBooleanObjectInspector resultInspector = (JavaBooleanObjectInspector) example.initialize(new ObjectInspector{listOI, stringOI});
^
symbol: method initialize(ObjectInspector)
location: variable example of type GeoMainTest
/home/user1/workspace/project/trunk/src/test/java/com/company/group1/group2/project2/GeoMainTest.java:42: error: cannot find symbol
Object result = example.evaluate(‘1’,‘2’,‘3’);
^
symbol: method evaluate(char,char,char)
location: variable example of type GeoMainTest
7 errors
:compileTestJava FAILED
:compileTestJava (Thread[main,5,main]) completed. Took 2.08 secs.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:compileTestJava’.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 9.757 secs
Stopped 0 compiler daemon(s).

build.gradle:
apply plugin: ‘java’
apply plugin: ‘idea’
apply plugin: ‘maven’
apply plugin: ‘maven-publish’
sourceCompatibility = 1.7
targetCompatibility = 1.7

    repositories {
            maven {
                    //url 'http://system.company.com:8080/'
    credentials {
        username = gradleUser
        password = gradlePassword
    }
  }

}

configurations {
provided
compile.extendsFrom provided
}

dependencies {
compile files(“${System.properties[‘java.home’]}/…/lib/tools.jar”)
compile ‘org.apache.hadoop:hadoop-core:1.2.1’
compile ‘org.apache.hive:hive-exec:2.0.0.2.3.5.0-81’

    testCompile files("${System.properties['java.home']}/../lib/tools.jar")
    testCompile 'junit:junit:4.8.2'
    testCompile 'org.apache.hadoop:hadoop-core:1.2.1'
    testCompile 'org.apache.hive:hive-exec:2.0.0.2.3.5.0-81'

}

test{
maxHeapSize = “4096m”
forkEvery = 1 // prevent Java OOM error on over 1 GB of mem usage
testLogging {
// Show that tests are run in the command-line output
events ‘started’, ‘passed’
}
}

GeoMainTest.java:
package com.company.group1.group2.project;

import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.udf.UDFType;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFUtils;
import org.apache.hadoop.io.Text;

import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.serde2.objectinspector.ListObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category;
import java.util.ArrayList;

import java.util.Iterator;
import java.util.*;

public class GeoMainTest {

@Test
public void testComplexUDFReturnsCorrectValues() throws HiveException {

// set up the models we need
GeoMainTest example = new GeoMainTest();
ObjectInspector stringOI = PrimitiveObjectInspectorFactory.javaStringObjectInspector;
ObjectInspector listOI = ObjectInspectorFactory.getStandardListObjectInspector(stringOI);
JavaBooleanObjectInspector resultInspector = (JavaBooleanObjectInspector) example.initialize(new ObjectInspector[]{listOI, stringOI});

// create the actual UDF arguments
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");*/

// the value exists
Object result = example.evaluate('1','2','3');
//Assert.assertEquals(true, resultInspector.get(result));

}
}

Hello,
Does anyone have any ideas on this?

Thanks,

Harlan…