From 78c496fe0fac4c89993109340aec80d1afa3141f Mon Sep 17 00:00:00 2001 From: Ian Parkinson Date: Wed, 30 Jan 2013 19:19:46 +0000 Subject: Fetch of Objenesis source at r270 Change-Id: Ia7b95c1abb7512272b3b6ae2c6db306e49a48450 --- tck-android/.gitignore | 8 ++ tck-android/.settings/org.eclipse.jdt.core.prefs | 5 + tck-android/AndroidManifest.xml | 43 +++++++++ tck-android/pom.xml | 103 +++++++++++++++++++++ .../objenesis/tck/android/TckInstrumentation.java | 53 +++++++++++ 5 files changed, 212 insertions(+) create mode 100644 tck-android/.gitignore create mode 100644 tck-android/.settings/org.eclipse.jdt.core.prefs create mode 100644 tck-android/AndroidManifest.xml create mode 100644 tck-android/pom.xml create mode 100644 tck-android/src/org/objenesis/tck/android/TckInstrumentation.java (limited to 'tck-android') diff --git a/tck-android/.gitignore b/tck-android/.gitignore new file mode 100644 index 0000000..70bdce3 --- /dev/null +++ b/tck-android/.gitignore @@ -0,0 +1,8 @@ +bin/ +gen/ +target/ +.classpath +.project +org.eclipse.m2e.core.prefs +org.eclipse.core.resources.prefs +org.eclipse.pde.core.prefs diff --git a/tck-android/.settings/org.eclipse.jdt.core.prefs b/tck-android/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..abec6ca --- /dev/null +++ b/tck-android/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/tck-android/AndroidManifest.xml b/tck-android/AndroidManifest.xml new file mode 100644 index 0000000..b17fbbc --- /dev/null +++ b/tck-android/AndroidManifest.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tck-android/pom.xml b/tck-android/pom.xml new file mode 100644 index 0000000..abb64a1 --- /dev/null +++ b/tck-android/pom.xml @@ -0,0 +1,103 @@ + + + 4.0.0 + + org.objenesis + objenesis-parent + 2.0-SNAPSHOT + + objenesis-tck-android + Objenesis Android TCK + Objenesis' TCK built for Android devices + apk + + + + org.objenesis + objenesis-tck + ${project.version} + + + com.google.android + android + 1.5_r3 + provided + + + + src + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + 3.5.0 + true + + + + + + maven-compiler-plugin + + 1.5 + 1.5 + + + + + com.jayway.maven.plugins.android.generation2 + android-maven-plugin + + + 17 + + + true + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + false + + + install + integration-test + + exec + + + adb + + install + -r + ${project.build.directory}\${project.build.finalName}.apk + + + + + execute + integration-test + + exec + + + adb + + shell + am + instrument + -w + org.objenesis.tck.android/.TckInstrumentation + + + + + + + + + diff --git a/tck-android/src/org/objenesis/tck/android/TckInstrumentation.java b/tck-android/src/org/objenesis/tck/android/TckInstrumentation.java new file mode 100644 index 0000000..23ee5cf --- /dev/null +++ b/tck-android/src/org/objenesis/tck/android/TckInstrumentation.java @@ -0,0 +1,53 @@ +/** + * Copyright 2006-2013 the original author or authors. + * + * 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 org.objenesis.tck.android; + +import android.app.Activity; +import android.app.Instrumentation; +import android.os.Bundle; + +import org.objenesis.tck.Main; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; + +/** + * Wraps the Objenesis TCK so that it can be invoked on Android as an {@link Instrumentation}. + * + * @author Ian Parkinson (Google Inc.) + */ +public class TckInstrumentation extends Instrumentation { + + public void onCreate(Bundle arguments) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + PrintStream printStream = new PrintStream(outputStream); + System.setOut(printStream); + + try { + Main.main(new String[0]); + } catch (IOException e) { + e.printStackTrace(); + } + + Bundle bundle = new Bundle(); + String fromStdout = outputStream.toString(); + bundle.putString(Instrumentation.REPORT_KEY_STREAMRESULT, fromStdout); + finish(Activity.RESULT_OK, bundle); + } +} + -- cgit v1.2.3