Revert "Add hostside jar test runner."

This reverts commit 666fd82bed2f774757b4b706d2b4878d2a425a08.

Change-Id: I14b8888d76d090a219de4f987b132d535b05b110
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/JarHostTest.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/JarHostTest.java
deleted file mode 100644
index 5bf7739..0000000
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/JarHostTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * 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.
- */
-package com.android.compatibility.common.tradefed.testtype;
-
-import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.build.IFolderBuildInfo;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.testtype.HostTest;
-import com.android.tradefed.testtype.IAbi;
-import com.android.tradefed.testtype.IAbiReceiver;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-import com.android.tradefed.testtype.IRemoteTest;
-import com.android.tradefed.testtype.ITestFilterReceiver;
-import com.android.tradefed.testtype.JUnitRunUtil;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-/**
- * Test runner for host-side JUnit tests.
- */
-public class JarHostTest extends HostTest {
-
-    private CompatibilityBuildHelper mHelper;
-
-    @Option(name="jar", description="The jars containing the JUnit test class to run.",
-            importance = Importance.IF_UNSET)
-    private Set<String> mJars = new HashSet<>();
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setBuild(IBuildInfo build) {
-        super.setBuild(build);
-        mHelper = new CompatibilityBuildHelper((IFolderBuildInfo) build);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected List<Class<?>> getClasses() throws IllegalArgumentException  {
-        List<Class<?>> classes = super.getClasses();
-        for (String jarName : mJars) {
-            JarFile jarFile = null;
-            try {
-                File file = new File(mHelper.getTestsDir(), jarName);
-                jarFile = new JarFile(file);
-                Enumeration<JarEntry> e = jarFile.entries();
-                URL[] urls = {
-                        new URL(String.format("jar:file:%s!/", file.getAbsolutePath()))
-                };
-                URLClassLoader cl = URLClassLoader.newInstance(urls);
-
-                while (e.hasMoreElements()) {
-                    JarEntry je = e.nextElement();
-                    if (je.isDirectory() || !je.getName().endsWith(".class")) {
-                        continue;
-                    }
-                    // -6 because of .class
-                    String className = je.getName().substring(0, je.getName().length() - 6);
-                    className = className.replace('/', '.');
-                    try {
-                        classes.add(cl.loadClass(className));
-                    } catch (ClassNotFoundException cnfe) {
-                        throw new IllegalArgumentException(
-                                String.format("Cannot find test class %s", className));
-                    }
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            } finally {
-                if (jarFile != null) {
-                    try {
-                        jarFile.close();
-                    } catch (IOException e) {
-                        // Ignored
-                    }
-                }
-            }
-        }
-        return classes;
-    }
-
-}
diff --git a/hostsidetests/sample/AndroidTest.xml b/hostsidetests/sample/AndroidTest.xml
index 40a7524..f436e84 100644
--- a/hostsidetests/sample/AndroidTest.xml
+++ b/hostsidetests/sample/AndroidTest.xml
@@ -13,12 +13,11 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<configuration description="Config for CtsSampleHostTestCases">
+<configuration description="Base config for CTS package preparer">
     <include name="common-config" />
     <option name="apk-installer:test-file-name" value="CtsSampleDeviceApp.apk" />
-    <test class="com.android.compatibility.common.tradefed.testtype.HostJUnitTest" >
-        <option name="jar" value="CtsSampleHostTestCases.jar" />
-    </test>
+    <test class="android.sample.cts.SampleHostTest" />
+    <test class="android.sample.cts.SampleHostResultTest" />
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
         <option name="target" value="host" />
         <option name="module-name" value="CtsSampleHostTestCases"/>