Install java_test module  test deps and configs in soong-only

This change installs test deps and configs to the `testcase/` directory
for atests use in soong-only builds.

Bug: 391924360
Test: locally set PRODUCT_SOONG_ONLY && m clean && atest signature-host-tests
Change-Id: I6655c2903c2f62c65ff0056b0dbe542df48e3e49
diff --git a/java/java.go b/java/java.go
index 66550d5..5bb5c09 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1764,6 +1764,22 @@
 		}
 	}
 	moduleInfoJSON.TestMainlineModules = append(moduleInfoJSON.TestMainlineModules, j.testProperties.Test_mainline_modules...)
+
+	// Install test deps
+	if !ctx.Config().KatiEnabled() {
+		pathInTestCases := android.PathForModuleInstall(ctx, "testcases", ctx.ModuleName())
+		if j.testConfig != nil {
+			ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".config", j.testConfig)
+		}
+		testDeps := append(j.data, j.extraTestConfigs...)
+		for _, data := range android.SortedUniquePaths(testDeps) {
+			dataPath := android.DataPath{SrcPath: data}
+			ctx.InstallTestData(pathInTestCases, []android.DataPath{dataPath})
+		}
+		if j.installFile != nil {
+			ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".jar", j.installFile)
+		}
+	}
 }
 
 func (j *TestHelperLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/java/java_test.go b/java/java_test.go
index d415679..53d2f5c 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -1916,7 +1916,7 @@
 			}
 
 			actualData := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
-			android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_TEST_DATA", ctx.Config, expectedData, actualData)
+			android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_TEST_DATA", ctx.Config, android.SortedUniqueStrings(expectedData), android.SortedUniqueStrings(actualData))
 		})
 	}
 }