summaryrefslogtreecommitdiff
path: root/tck-android
diff options
context:
space:
mode:
authorIan Parkinson <ianp@google.com>2013-01-30 19:19:46 +0000
committerIan Parkinson <ianp@google.com>2013-01-30 19:19:46 +0000
commit78c496fe0fac4c89993109340aec80d1afa3141f (patch)
tree94d9337ba1596d77321ad7f03a45f25172d9fefc /tck-android
parentf7b455e2c32c6b943a0879d1d571b71915a033a2 (diff)
downloadobjenesis-78c496fe0fac4c89993109340aec80d1afa3141f.tar.gz
Fetch of Objenesis source at r270
Change-Id: Ia7b95c1abb7512272b3b6ae2c6db306e49a48450
Diffstat (limited to 'tck-android')
-rw-r--r--tck-android/.gitignore8
-rw-r--r--tck-android/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--tck-android/AndroidManifest.xml43
-rw-r--r--tck-android/pom.xml103
-rw-r--r--tck-android/src/org/objenesis/tck/android/TckInstrumentation.java53
5 files changed, 212 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+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.
+-->
+
+<!--
+ Describes an Android application with a single Instrumentation,
+ which runs the Objenesis TCK.
+
+ Author: Ian Parkinson, Google Inc.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.objenesis.tck.android"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="1"
+ android:targetSdkVersion="17" />
+
+ <application android:allowBackup="false">
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation
+ android:name=".TckInstrumentation"
+ android:targetPackage="org.objenesis.tck.android">
+ </instrumentation>
+</manifest> \ 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 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>objenesis-tck-android</artifactId>
+ <name>Objenesis Android TCK</name>
+ <description>Objenesis' TCK built for Android devices</description>
+ <packaging>apk</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.objenesis</groupId>
+ <artifactId>objenesis-tck</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.android</groupId>
+ <artifactId>android</artifactId>
+ <version>1.5_r3</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>com.jayway.maven.plugins.android.generation2</groupId>
+ <artifactId>android-maven-plugin</artifactId>
+ <version>3.5.0</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>com.jayway.maven.plugins.android.generation2</groupId>
+ <artifactId>android-maven-plugin</artifactId>
+ <configuration>
+ <sdk>
+ <platform>17</platform>
+ </sdk>
+ </configuration>
+ <extensions>true</extensions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <inherited>false</inherited>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>adb</executable>
+ <arguments>
+ <argument>install</argument>
+ <argument>-r</argument>
+ <argument>${project.build.directory}\${project.build.finalName}.apk</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ <execution>
+ <id>execute</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ <configuration>
+ <executable>adb</executable>
+ <arguments>
+ <argument>shell</argument>
+ <argument>am</argument>
+ <argument>instrument</argument>
+ <argument>-w</argument>
+ <argument>org.objenesis.tck.android/.TckInstrumentation</argument>
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
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);
+ }
+}
+