Export a few utility methods

Add a few utility methods to support generating TradeFed test plan in C-Suite

Test: go test .
Change-Id: I86a505068b5d5aa0f5a37b3e3a2465839a7480ef
diff --git a/java/java.go b/java/java.go
index 59ec94d..8ad9084 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2451,6 +2451,10 @@
 	j.deps(ctx)
 }
 
+func (j *TestHost) AddExtraResource(p android.Path) {
+	j.extraResources = append(j.extraResources, p)
+}
+
 func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
 	j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template,
 		j.testProperties.Test_suites, j.testProperties.Auto_gen_config, j.testProperties.Test_options.Unit_test)
@@ -2609,12 +2613,22 @@
 	module.AddProperties(&module.testProperties)
 	module.AddProperties(&module.testHostProperties)
 
-	module.Module.properties.Installable = proptools.BoolPtr(true)
+	InitTestHost(
+		module,
+		proptools.BoolPtr(true),
+		nil,
+		nil)
 
 	InitJavaModuleMultiTargets(module, android.HostSupported)
 	return module
 }
 
+func InitTestHost(th *TestHost, installable *bool, testSuites []string, autoGenConfig *bool) {
+	th.properties.Installable = installable
+	th.testProperties.Auto_gen_config = autoGenConfig
+	th.testProperties.Test_suites = testSuites
+}
+
 //
 // Java Binaries (.jar file plus wrapper script)
 //
diff --git a/java/java_test.go b/java/java_test.go
index e7776c3..30586ec 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2429,3 +2429,16 @@
 		t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual)
 	}
 }
+
+func TestDefaultInstallable(t *testing.T) {
+	ctx, _ := testJava(t, `
+		java_test_host {
+			name: "foo"
+		}
+	`)
+
+	buildOS := android.BuildOs.String()
+	module := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
+	assertDeepEquals(t, "Default installable value should be true.", proptools.BoolPtr(true),
+		module.properties.Installable)
+}