diff options
author | Jose <jose@zeroc.com> | 2012-11-15 23:25:45 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-11-15 23:25:45 +0100 |
commit | 6c2684c66a1cfe4977c458d0d10fc0c5a88e4519 (patch) | |
tree | 85600f0d1aa6c9437209a89303e6067652a09cea | |
parent | Update SSL certificates to be compatible with IOS (diff) | |
download | ice-6c2684c66a1cfe4977c458d0d10fc0c5a88e4519.tar.bz2 ice-6c2684c66a1cfe4977c458d0d10fc0c5a88e4519.tar.xz ice-6c2684c66a1cfe4977c458d0d10fc0c5a88e4519.zip |
Android test & demo fixes
27 files changed, 1532 insertions, 96 deletions
diff --git a/java/build.xml b/java/build.xml index 5c0053d2ed3..feb8ae78a91 100644 --- a/java/build.xml +++ b/java/build.xml @@ -577,6 +577,7 @@ <depend srcdir=".:${generated.test.dir}" destdir="${lib.dir}" cache="${cache.dir}"> <exclude name="${generated.test.dir}/**"/> <include name="test/**"/> + <exclude name="test/android/"/> <exclude name="test/Ice/translator/"/> <exclude name="test/Slice/generation/"/> </depend> @@ -594,6 +595,7 @@ <include name="test/**"/> <exclude name="test/Ice/translator/"/> <exclude name="test/Slice/generation/"/> + <exclude name="test/android/"/> <compilerarg value="${javac.lint}"/> </javac> </target> @@ -612,6 +614,7 @@ <jar jarfile="${lib.dir}/IceTest.jar" basedir="${lib.dir}"> <include name="test/**"/> <exclude name="test/Ice/plugin/plugins/**"/> + <exclude name="test/android/**"/> <manifest> <attribute name="Built-By" value="ZeroC, Inc."/> <attribute name="Class-Path" value="Ice.jar"/> diff --git a/java/demo/android/hello/res/raw/certs.bks b/java/demo/android/hello/res/raw/certs.bks Binary files differindex a6469e2c7f9..64d16f817a7 100644 --- a/java/demo/android/hello/res/raw/certs.bks +++ b/java/demo/android/hello/res/raw/certs.bks diff --git a/java/demo/android/hello/src/com/zeroc/hello/HelloApp.java b/java/demo/android/hello/src/com/zeroc/hello/HelloApp.java index d3c8c1b8c3b..106f107f2ca 100644 --- a/java/demo/android/hello/src/com/zeroc/hello/HelloApp.java +++ b/java/demo/android/hello/src/com/zeroc/hello/HelloApp.java @@ -105,7 +105,6 @@ public class HelloApp extends Application initData.properties.setProperty("IceSSL.KeystoreType", "BKS"); initData.properties.setProperty("IceSSL.TruststoreType", "BKS"); initData.properties.setProperty("IceSSL.Password", "password"); - //initData.properties.setProperty("IceSSL.VerifyPeer", "0"); initData.properties.setProperty("Ice.InitPlugins", "0"); initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); } diff --git a/java/test/Ice/admin/AllTests.java b/java/test/Ice/admin/AllTests.java index e0f9ac6c575..912ea6d9dcb 100644 --- a/java/test/Ice/admin/AllTests.java +++ b/java/test/Ice/admin/AllTests.java @@ -9,6 +9,7 @@ package test.Ice.admin; +import java.io.PrintWriter; import test.Ice.admin.Test.*; public class AllTests @@ -77,10 +78,10 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(test.Util.Application app, PrintWriter out) { - System.out.print("testing communicator operations... "); - System.out.flush(); + out.print("testing communicator operations... "); + out.flush(); { // // Test: Exercise addAdminFacet, findAdminFacet, removeAdminFacet with a typical configuration. @@ -129,14 +130,14 @@ public class AllTests testFacets(com); com.destroy(); } - System.out.println("ok"); + out.println("ok"); String ref = "factory:default -p 12010 -t 10000"; RemoteCommunicatorFactoryPrx factory = - RemoteCommunicatorFactoryPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); + RemoteCommunicatorFactoryPrxHelper.uncheckedCast(app.communicator().stringToProxy(ref)); - System.out.print("testing process facet... "); - System.out.flush(); + out.print("testing process facet... "); + out.flush(); { // // Test: Verify that Process::shutdown() operation shuts down the communicator. @@ -151,10 +152,10 @@ public class AllTests com.waitForShutdown(); com.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing properties facet... "); - System.out.flush(); + out.print("testing properties facet... "); + out.flush(); { java.util.Map<String, String> props = new java.util.HashMap<String, String>(); props.put("Ice.Admin.Endpoints", "tcp -h 127.0.0.1"); @@ -213,10 +214,10 @@ public class AllTests com.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing custom facet... "); - System.out.flush(); + out.print("testing custom facet... "); + out.flush(); { // // Test: Verify that the custom facet is present. @@ -230,10 +231,10 @@ public class AllTests tf.op(); com.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing facet filtering... "); - System.out.flush(); + out.print("testing facet filtering... "); + out.flush(); { // // Test: Set Ice.Admin.Facets to expose only the Properties facet, @@ -324,7 +325,7 @@ public class AllTests com.waitForShutdown(); com.destroy(); } - System.out.println("ok"); + out.println("ok"); factory.shutdown(); } diff --git a/java/test/Ice/admin/Client.java b/java/test/Ice/admin/Client.java index 824676dfb2e..5a72ed7f080 100644 --- a/java/test/Ice/admin/Client.java +++ b/java/test/Ice/admin/Client.java @@ -9,44 +9,19 @@ package test.Ice.admin; -public class Client +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - AllTests.allTests(communicator); + AllTests.allTests(this, getWriter()); + return 0; } - public static void - main(String[] args) + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/admin/Server.java b/java/test/Ice/admin/Server.java index 0d83e754c13..7feba5df981 100644 --- a/java/test/Ice/admin/Server.java +++ b/java/test/Ice/admin/Server.java @@ -9,52 +9,32 @@ package test.Ice.admin; -public class Server +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity id = communicator.stringToIdentity("factory"); - adapter.add(new RemoteCommunicatorFactoryI(), id); + adapter.add(new RemoteCommunicatorFactoryI(), communicator.stringToIdentity("factory")); adapter.activate(); - - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/hash/Client.java b/java/test/Ice/hash/Client.java index b8b7911b433..c42912234c2 100644 --- a/java/test/Ice/hash/Client.java +++ b/java/test/Ice/hash/Client.java @@ -9,9 +9,11 @@ package test.Ice.hash; +import java.io.PrintWriter; + import test.Ice.hash.Test.*; -public class Client +public class Client extends test.Util.Application { private static void test(boolean b) @@ -24,6 +26,16 @@ public class Client public static void main(String[] args) { + Client c = new Client(); + int status = c.main("Client", args); + + System.gc(); + System.exit(status); + } + + public int run(String[] args) + { + PrintWriter out = getWriter(); int status = 0; try { @@ -40,7 +52,8 @@ public class Client initData.properties.setProperty("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); Ice.Communicator communicator = Ice.Util.initialize(args, initData); - System.out.print("testing proxy & endpoint hash algorithm collisions... "); + out.print("testing proxy & endpoint hash algorithm collisions... "); + out.flush(); { java.util.Random rand = new java.util.Random(); for(i = 0; proxyCollisions < maxCollisions && @@ -233,9 +246,10 @@ public class Client test(new Ice.ProxyIdentityFacetKey(prx1).hashCode() == new Ice.ProxyIdentityFacetKey(prx10).hashCode()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing struct hash algorithm collisions... "); + out.print("testing struct hash algorithm collisions... "); + out.flush(); { java.util.Map<Integer, PointF> seenPointF = new java.util.HashMap<Integer, PointF>(); java.util.Random rand = new java.util.Random(); @@ -404,7 +418,7 @@ public class Client } test(structCollisions < maxCollisions); } - System.out.println("ok"); + out.println("ok"); if(communicator != null) { @@ -424,8 +438,7 @@ public class Client System.out.println(ex.toString()); status = 1; } - System.gc(); - System.exit(status); + return status; } } diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java index ce01a1208ae..4b7b77e0439 100644 --- a/java/test/Ice/proxy/AllTests.java +++ b/java/test/Ice/proxy/AllTests.java @@ -573,7 +573,9 @@ public class AllTests Ice.InputStream inS = Ice.Util.createInputStream(communicator, inBytes); MyClassPrx cl11 = MyClassPrxHelper.uncheckedCast(inS.readProxy().ice_collocationOptimized(false)); String protocol = communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - test(cl11.toString().equals("test -t -p 1.1 -e 1.1:" + protocol + " -h 127.0.0.1 -p 12010")); + test(cl11.toString().equals("test -t -p 1.1 -e 1.1:" + protocol + " -h 127.0.0.1 -p 12010") || + // Android doesn't set Ice.DefaultHost to 127.0.0.1 + cl11.toString().equals("test -t -p 1.1 -e 1.1:" + protocol + " -p 12010")); try { cl11.ice_ping(); diff --git a/java/test/android/.classpath b/java/test/android/.classpath new file mode 100644 index 00000000000..3c32a26c1e2 --- /dev/null +++ b/java/test/android/.classpath @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="generated"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> + <classpathentry kind="src" path="gen"/> + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> + <classpathentry exported="true" kind="var" path="ICE_HOME/lib/Ice.jar"/> + <classpathentry exported="true" kind="var" path="ICE_HOME/lib/IceTest.jar"/> + <classpathentry kind="output" path="bin/classes"/> +</classpath> diff --git a/java/test/android/.gitignore b/java/test/android/.gitignore new file mode 100644 index 00000000000..36f971e324f --- /dev/null +++ b/java/test/android/.gitignore @@ -0,0 +1 @@ +bin/* diff --git a/java/test/android/.project b/java/test/android/.project new file mode 100644 index 00000000000..407cf166c40 --- /dev/null +++ b/java/test/android/.project @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>testsuite</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.zeroc.Slice2JavaPlugin.Slice2JavaBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.android.ide.eclipse.adt.ApkBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.android.ide.eclipse.adt.AndroidNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.zeroc.Slice2JavaPlugin.Slice2JavaNature</nature> + </natures> +</projectDescription> diff --git a/java/test/android/.settings/com.zeroc.Slice2JavaPlugin.prefs b/java/test/android/.settings/com.zeroc.Slice2JavaPlugin.prefs new file mode 100644 index 00000000000..e16f272214d --- /dev/null +++ b/java/test/android/.settings/com.zeroc.Slice2JavaPlugin.prefs @@ -0,0 +1,3 @@ +#Wed Dec 17 22:14:32 NST 2008 +eclipse.preferences.version=1 +jars= diff --git a/java/test/android/.settings/org.eclipse.jdt.core.prefs b/java/test/android/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..10b58d391b6 --- /dev/null +++ b/java/test/android/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,266 @@ +#Mon Dec 08 10:55:23 NST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=48 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=52 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=21 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=8 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/java/test/android/.settings/org.eclipse.jdt.ui.prefs b/java/test/android/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..377fe71a31b --- /dev/null +++ b/java/test/android/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,9 @@ +#Fri Dec 05 11:14:03 NST 2008 +eclipse.preferences.version=1 +formatter_profile=_ZeroC +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/> diff --git a/java/test/android/AndroidManifest.xml b/java/test/android/AndroidManifest.xml new file mode 100644 index 00000000000..83908442fe9 --- /dev/null +++ b/java/test/android/AndroidManifest.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.zeroc.testsuite" + android:versionCode="1" + android:versionName="1.0.0"> + <application android:icon="@drawable/icon" android:label="@string/app_name" android:name="TestApp"> + <activity android:name=".TestSuite" + android:label="@string/app_name"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + <activity android:name="TestContainer"></activity> +</application> +<uses-permission android:name="android.permission.INTERNET"></uses-permission> +</manifest>
\ No newline at end of file diff --git a/java/test/android/gen/com/zeroc/testsuite/BuildConfig.java b/java/test/android/gen/com/zeroc/testsuite/BuildConfig.java new file mode 100644 index 00000000000..dd14f6c3ca5 --- /dev/null +++ b/java/test/android/gen/com/zeroc/testsuite/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.zeroc.testsuite; + +public final class BuildConfig { + public final static boolean DEBUG = true; +}
\ No newline at end of file diff --git a/java/test/android/gen/com/zeroc/testsuite/R.java b/java/test/android/gen/com/zeroc/testsuite/R.java new file mode 100644 index 00000000000..e1a0ced5896 --- /dev/null +++ b/java/test/android/gen/com/zeroc/testsuite/R.java @@ -0,0 +1,32 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.zeroc.testsuite; + +public final class R { + public static final class attr { + } + public static final class drawable { + public static final int icon=0x7f020000; + } + public static final class id { + public static final int next=0x7f060000; + public static final int secure=0x7f060001; + } + public static final class layout { + public static final int container=0x7f030000; + public static final int main=0x7f030001; + } + public static final class raw { + public static final int client=0x7f040000; + public static final int server=0x7f040001; + } + public static final class string { + public static final int app_name=0x7f050001; + public static final int hello=0x7f050000; + } +} diff --git a/java/test/android/project.properties b/java/test/android/project.properties new file mode 100644 index 00000000000..85aac54016d --- /dev/null +++ b/java/test/android/project.properties @@ -0,0 +1,14 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-8 diff --git a/java/test/android/res/drawable/icon.png b/java/test/android/res/drawable/icon.png Binary files differnew file mode 100644 index 00000000000..75024841d32 --- /dev/null +++ b/java/test/android/res/drawable/icon.png diff --git a/java/test/android/res/layout/container.xml b/java/test/android/res/layout/container.xml new file mode 100644 index 00000000000..20352f7eb96 --- /dev/null +++ b/java/test/android/res/layout/container.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + > + + <ListView + android:id="@android:id/list" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:stackFromBottom="true" + android:transcriptMode="alwaysScroll"/> + + <Button + android:id="@+id/next" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="Next" + /> + + </LinearLayout> + diff --git a/java/test/android/res/layout/main.xml b/java/test/android/res/layout/main.xml new file mode 100644 index 00000000000..671840e5c70 --- /dev/null +++ b/java/test/android/res/layout/main.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:padding="5dip" + > + + <ListView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@android:id/list" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1" + android:stackFromBottom="true" + + /> + + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingBottom="5dip" + > + + <TextView + android:layout_width="0dip" + android:layout_height="wrap_content" + android:layout_weight="30" + android:text="SSL" + /> + + <CheckBox + android:id="@+id/secure" + android:layout_width="0dip" + android:layout_weight="70" + android:layout_height="wrap_content" + /> + + </LinearLayout> +</LinearLayout>
\ No newline at end of file diff --git a/java/test/android/res/raw/client.bks b/java/test/android/res/raw/client.bks Binary files differnew file mode 100644 index 00000000000..3bb5449adc3 --- /dev/null +++ b/java/test/android/res/raw/client.bks diff --git a/java/test/android/res/raw/server.bks b/java/test/android/res/raw/server.bks Binary files differnew file mode 100644 index 00000000000..b8f5a15d8de --- /dev/null +++ b/java/test/android/res/raw/server.bks diff --git a/java/test/android/res/values/strings.xml b/java/test/android/res/values/strings.xml new file mode 100644 index 00000000000..39d9dff779e --- /dev/null +++ b/java/test/android/res/values/strings.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="hello">Hello World, TestSuite</string> + <string name="app_name">Test Suite</string> +</resources> diff --git a/java/test/android/src/com/zeroc/testsuite/TestApp.java b/java/test/android/src/com/zeroc/testsuite/TestApp.java new file mode 100644 index 00000000000..390f59ff5c0 --- /dev/null +++ b/java/test/android/src/com/zeroc/testsuite/TestApp.java @@ -0,0 +1,748 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.testsuite; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManagerFactory; + +import test.Util.Application.CommunicatorListener; +import Ice.Communicator; +import android.app.Application; +import android.os.Handler; +import android.os.Build.VERSION; + +public class TestApp extends Application +{ + static private class TestSuiteEntry + { + TestSuiteEntry(String name, Class<? extends test.Util.Application> client, + Class<? extends test.Util.Application> server, + Class<? extends test.Util.Application> collocated) + { + _name = name; + _client = client; + _server = server; + _collocated = collocated; + } + + String getName() + { + return _name; + } + + test.Util.Application getClient() + throws IllegalAccessException, InstantiationException + { + if(_client == null) + { + return null; + } + return _client.newInstance(); + } + + test.Util.Application getServer() + throws IllegalAccessException, InstantiationException + { + if(_server == null) + { + return null; + } + + return _server.newInstance(); + } + + test.Util.Application getCollocated() + throws IllegalAccessException, InstantiationException + { + if(_collocated == null) + { + return null; + } + + return _collocated.newInstance(); + } + + private String _name; + private Class<? extends test.Util.Application> _client; + private Class<? extends test.Util.Application> _server; + private Class<? extends test.Util.Application> _collocated; + } + + static final private TestSuiteEntry[] _tests = + { + new TestSuiteEntry("adapterDeactivation", test.Ice.adapterDeactivation.Client.class, + test.Ice.adapterDeactivation.Server.class, test.Ice.adapterDeactivation.Collocated.class), + new TestSuiteEntry("admin", test.Ice.admin.Client.class, test.Ice.admin.Server.class, null), + new TestSuiteEntry("ami", test.Ice.ami.Client.class, test.Ice.ami.Server.class, null), + new TestSuiteEntry("binding", test.Ice.binding.Client.class, test.Ice.binding.Server.class, null), + new TestSuiteEntry("checksum", test.Ice.checksum.Client.class, test.Ice.checksum.Server.class, null), + new TestSuiteEntry("classLoader", test.Ice.classLoader.Client.class, test.Ice.classLoader.Server.class, null), + new TestSuiteEntry("custom", test.Ice.custom.Client.class, test.Ice.custom.Server.class, + test.Ice.custom.Collocated.class), + new TestSuiteEntry("defaultServant", test.Ice.defaultServant.Client.class, null, null), + new TestSuiteEntry("defaultValue", test.Ice.defaultValue.Client.class, null, null), + new TestSuiteEntry("dispatcher", test.Ice.dispatcher.Client.class, test.Ice.dispatcher.Server.class, null), + new TestSuiteEntry("enums", test.Ice.enums.Client.class, test.Ice.enums.Server.class, null), + new TestSuiteEntry("exceptions", test.Ice.exceptions.Client.class, test.Ice.exceptions.Server.class, + test.Ice.exceptions.Collocated.class), + new TestSuiteEntry("facets", test.Ice.facets.Client.class, test.Ice.facets.Server.class, + test.Ice.facets.Collocated.class), + // Require SSL + //new TestSuiteEntry("hash", test.Ice.hash.Client.class, null, null), + new TestSuiteEntry("hold", test.Ice.hold.Client.class, test.Ice.hold.Server.class, null), + // The info test is not currently enabled - it relies on sockets to accurately return + // address and port information, which really only works in Android 2.3+. + //new TestSuiteEntry("info", test.Ice.info.Client.class, test.Ice.info.Server.class, null), + new TestSuiteEntry("inheritance", test.Ice.inheritance.Client.class, test.Ice.inheritance.Server.class, + test.Ice.inheritance.Collocated.class), + new TestSuiteEntry("interceptor", test.Ice.interceptor.Client.class, null, null), + new TestSuiteEntry("invoke", test.Ice.invoke.Client.class, test.Ice.invoke.Server.class, null), + new TestSuiteEntry("location", test.Ice.location.Client.class, test.Ice.location.Server.class, null), + // The metrics test uses too much memory. + //new TestSuiteEntry("metrics", test.Ice.metrics.Client.class, test.Ice.metrics.Server.class, null), + new TestSuiteEntry("objects", test.Ice.objects.Client.class, test.Ice.objects.Server.class, + test.Ice.objects.Collocated.class), + new TestSuiteEntry("operations", test.Ice.operations.Client.class, test.Ice.operations.Server.class, + test.Ice.operations.Collocated.class), + new TestSuiteEntry("optional", test.Ice.optional.Client.class, test.Ice.optional.Server.class, null), + new TestSuiteEntry("packagemd", test.Ice.packagemd.Client.class, test.Ice.packagemd.Server.class, null), + new TestSuiteEntry("proxy", test.Ice.proxy.Client.class, test.Ice.proxy.Server.class, + test.Ice.proxy.Collocated.class), + new TestSuiteEntry("retry", test.Ice.retry.Client.class, test.Ice.retry.Server.class, null), + new TestSuiteEntry("seqMapping", test.Ice.seqMapping.Client.class, test.Ice.seqMapping.Server.class, + test.Ice.seqMapping.Collocated.class), + new TestSuiteEntry("serialize", test.Ice.serialize.Client.class, test.Ice.serialize.Server.class, null), + new TestSuiteEntry("servantLocator", test.Ice.servantLocator.Client.class, + test.Ice.servantLocator.Server.class, test.Ice.servantLocator.Collocated.class), + new TestSuiteEntry("slicing/exceptions", test.Ice.slicing.exceptions.Client.class, + test.Ice.slicing.exceptions.Server.class, null), + new TestSuiteEntry("slicing/objects", test.Ice.slicing.objects.Client.class, + test.Ice.slicing.objects.Server.class, null), + new TestSuiteEntry("stream", test.Ice.stream.Client.class, null, null), + // The throughput test uses too much memory. + //new TestSuiteEntry("throughput", test.Ice.throughput.Client.class, test.Ice.throughput.Server.class, null), + new TestSuiteEntry("timeout", test.Ice.timeout.Client.class, test.Ice.timeout.Server.class, null), + }; + + static final private TestSuiteEntry[] _ssltests = + { + new TestSuiteEntry("adapterDeactivation", test.Ice.adapterDeactivation.Client.class, + test.Ice.adapterDeactivation.Server.class, test.Ice.adapterDeactivation.Collocated.class), + new TestSuiteEntry("ami", test.Ice.ami.Client.class, test.Ice.ami.Server.class, null), + new TestSuiteEntry("binding", test.Ice.binding.Client.class, test.Ice.binding.Server.class, null), + new TestSuiteEntry("checksum", test.Ice.checksum.Client.class, test.Ice.checksum.Server.class, null), + new TestSuiteEntry("classLoader", test.Ice.classLoader.Client.class, test.Ice.classLoader.Server.class, null), + new TestSuiteEntry("custom", test.Ice.custom.Client.class, test.Ice.custom.Server.class, + test.Ice.custom.Collocated.class), + new TestSuiteEntry("defaultServant", test.Ice.defaultServant.Client.class, null, null), + new TestSuiteEntry("defaultValue", test.Ice.defaultValue.Client.class, null, null), + new TestSuiteEntry("dispatcher", test.Ice.dispatcher.Client.class, test.Ice.dispatcher.Server.class, null), + new TestSuiteEntry("enums", test.Ice.enums.Client.class, test.Ice.enums.Server.class, null), + new TestSuiteEntry("exceptions", test.Ice.exceptions.Client.class, test.Ice.exceptions.Server.class, + test.Ice.exceptions.Collocated.class), + new TestSuiteEntry("facets", test.Ice.facets.Client.class, test.Ice.facets.Server.class, + test.Ice.facets.Collocated.class), + // The hash test uses too much memory. + //new TestSuiteEntry("hash", test.Ice.hash.Client.class, null, null), + new TestSuiteEntry("hold", test.Ice.hold.Client.class, test.Ice.hold.Server.class, null), + // The info test is not currently enabled - it relies on sockets to accurately return + // address and port information, which really only works in Android 2.3+. + //new TestSuiteEntry("info", test.Ice.info.Client.class, test.Ice.info.Server.class, null), + new TestSuiteEntry("inheritance", test.Ice.inheritance.Client.class, test.Ice.inheritance.Server.class, + test.Ice.inheritance.Collocated.class), + new TestSuiteEntry("interceptor", test.Ice.interceptor.Client.class, null, null), + new TestSuiteEntry("invoke", test.Ice.invoke.Client.class, test.Ice.invoke.Server.class, null), + new TestSuiteEntry("location", test.Ice.location.Client.class, test.Ice.location.Server.class, null), + // The metrics test uses too much memory. + //new TestSuiteEntry("metrics", test.Ice.metrics.Client.class, test.Ice.metrics.Server.class, null), + new TestSuiteEntry("objects", test.Ice.objects.Client.class, test.Ice.objects.Server.class, + test.Ice.objects.Collocated.class), + new TestSuiteEntry("operations", test.Ice.operations.Client.class, test.Ice.operations.Server.class, + test.Ice.operations.Collocated.class), + new TestSuiteEntry("optional", test.Ice.optional.Client.class, test.Ice.optional.Server.class, null), + new TestSuiteEntry("packagemd", test.Ice.packagemd.Client.class, test.Ice.packagemd.Server.class, null), + new TestSuiteEntry("proxy", test.Ice.proxy.Client.class, test.Ice.proxy.Server.class, + test.Ice.proxy.Collocated.class), + new TestSuiteEntry("retry", test.Ice.retry.Client.class, test.Ice.retry.Server.class, null), + new TestSuiteEntry("serialize", test.Ice.serialize.Client.class, test.Ice.serialize.Server.class, null), + new TestSuiteEntry("seqMapping", test.Ice.seqMapping.Client.class, test.Ice.seqMapping.Server.class, + test.Ice.seqMapping.Collocated.class), + new TestSuiteEntry("servantLocator", test.Ice.servantLocator.Client.class, + test.Ice.servantLocator.Server.class, test.Ice.servantLocator.Collocated.class), + new TestSuiteEntry("slicing/exceptions", test.Ice.slicing.exceptions.Client.class, + test.Ice.slicing.exceptions.Server.class, null), + new TestSuiteEntry("slicing/objects", test.Ice.slicing.objects.Client.class, + test.Ice.slicing.objects.Server.class, null), + new TestSuiteEntry("stream", test.Ice.stream.Client.class, null, null), + new TestSuiteEntry("timeout", test.Ice.timeout.Client.class, test.Ice.timeout.Server.class, null), + }; + private TestSuiteEntry[] _curtests = _tests; + + class MyWriter extends Writer + { + @Override + public void close() + throws IOException + { + flush(); + } + + @Override + public void flush() + throws IOException + { + final String s = _data.toString(); + if(s.length() > 0) + { + postOnOutput(s); + } + _data = new StringBuffer(); + } + + @Override + public void write(char[] buf, int offset, int count) + throws IOException + { + _data.append(buf, offset, count); + } + + private StringBuffer _data = new StringBuffer(); + } + + private Handler _handler; + private LinkedList<String> _strings = new LinkedList<String>(); + + public interface TestListener + { + public void onStartTest(String test); + + public void onOutput(String s); + + public void onComplete(int status); + } + + private TestListener _listener = null; + + private boolean _complete = false; + private int _status = 0; + private int _currentTest = -1; + + private boolean _ssl = false; + private boolean _sslInitialized = false; + private boolean _sslSupported = false; + private SSLContext _clientContext = null; + private SSLContext _serverContext = null; + private SSLInitializationListener _ssllistener; + + static abstract class TestThread extends Thread + { + test.Util.Application _app; + protected int _status; + + TestThread(test.Util.Application app) + { + _app = app; + } + + public int getStatus() + { + return _status; + } + + protected String[] setupssl(String[] args, final SSLContext context) + { + String[] sslargs = + { + "--Ice.Plugin.IceSSL=IceSSL.PluginFactory", "--Ice.Default.Protocol=ssl", "--Ice.InitPlugins=0" + }; + + // + // Froyo apparently still suffers from Harmony bug 6047, requiring that we + // disable server-side verification of client certificates. + // + if(VERSION.SDK_INT == 8) // android.os.Build.VERSION_CODES.FROYO (8) + { + String[] arr = new String[sslargs.length + 1]; + System.arraycopy(sslargs, 0, arr, 0, sslargs.length); + arr[arr.length - 1] = "--IceSSL.VerifyPeer=0"; + sslargs = arr; + } + + String[] nargs = new String[args.length + sslargs.length]; + System.arraycopy(args, 0, nargs, 0, args.length); + System.arraycopy(sslargs, 0, nargs, args.length, sslargs.length); + args = nargs; + _app.setCommunicatorListener(new CommunicatorListener() + { + public void communicatorInitialized(Communicator c) + { + IceSSL.Plugin plugin = (IceSSL.Plugin)c.getPluginManager().getPlugin("IceSSL"); + plugin.setContext(context); + c.getPluginManager().initializePlugins(); + } + }); + return args; + } + } + + class ClientThread extends TestThread + { + private test.Util.Application _server; + + ClientThread(test.Util.Application c, test.Util.Application s) + { + super(c); + _server = s; + setName("ClientThread"); + } + + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" + }; + if(_ssl) + { + args = setupssl(args, _clientContext); + } + _status = _app.main("Client", args); + // If the client failed, then stop the server -- the test is over. + if(_status != 0 && _server != null) + { + _server.stop(); + } + } + } + + class ServerThread extends TestThread + { + private test.Util.Application _client; + private ClientThread _clientThread; + + ServerThread(test.Util.Application c, test.Util.Application s) + { + super(s); + setName("ServerThread"); + _client = c; + } + + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", + "--Ice.Warn.Connections=1", + "--Ice.ThreadPool.Server.Size=1", + "--Ice.ThreadPool.Server.SizeMax=3", + "--Ice.ThreadPool.Server.SizeWarn=0", + "--Ice.Default.Host=127.0.0.1" + }; + if(_ssl) + { + args = setupssl(args, _serverContext); + } + _app.setServerReadyListener(new test.Util.Application.ServerReadyListener() + { + public void serverReady() + { + if(_client != null) + { + _clientThread = new ClientThread(_client, _app); + _clientThread.start(); + } + } + }); + + _status = _app.main("Server", args); + if(_clientThread != null) + { + while(_clientThread.isAlive()) + { + try + { + _clientThread.join(); + } + catch(InterruptedException e1) + { + } + } + if(_clientThread.getStatus() != 0) + { + _status = _clientThread.getStatus(); + } + } + } + } + + class CollocatedThread extends TestThread + { + CollocatedThread(test.Util.Application c) + { + super(c); + setName("CollocatedThread"); + } + + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1" + }; + if(_ssl) + { + args = setupssl(args, _clientContext); + } + _status = _app.main("Collocated", args); + } + } + + class TestRunner extends Thread + { + private List<TestThread> _threads; + + TestRunner(List<TestThread> l) + { + _threads = l; + } + + public void run() + { + for(TestThread t : _threads) + { + t.start(); + while(t.isAlive()) + { + try + { + t.join(); + } + catch(InterruptedException e) + { + } + } + int status = t.getStatus(); + if(status != 0) + { + postOnComplete(status); + return; + } + } + postOnComplete(0); + } + } + + synchronized private void postOnOutput(final String s) + { + _strings.add(s); + if(_listener != null) + { + final TestListener l = _listener; + _handler.post(new Runnable() + { + public void run() + { + l.onOutput(s); + } + }); + } + } + + synchronized private void postOnComplete(final int status) + { + _status = status; + _complete = true; + if(_listener != null) + { + final TestListener l = _listener; + _handler.post(new Runnable() + { + public void run() + { + l.onComplete(status); + } + }); + } + } + + public interface SSLInitializationListener + { + public void onComplete(); + + public void onError(); + + public void onWait(); + } + + // This is called from the SSL initialization thread. + synchronized private void sslContextInitialized(SSLContext clientContext, SSLContext serverContext) + { + _clientContext = clientContext; + _serverContext = serverContext; + _sslInitialized = true; + + if(_ssllistener != null) + { + final SSLInitializationListener listener = _ssllistener; + if(_clientContext == null | _serverContext == null) + { + _handler.post(new Runnable() + { + public void run() + { + listener.onError(); + } + }); + } + else + { + _handler.post(new Runnable() + { + public void run() + { + listener.onComplete(); + } + }); + } + } + } + + @Override + public void onCreate() + { + _handler = new Handler(); + + if(VERSION.SDK_INT == 8) // android.os.Build.VERSION_CODES.FROYO (8) + { + // + // Workaround for a bug in Android 2.2 (Froyo). + // + // See http://code.google.com/p/android/issues/detail?id=9431 + // + java.lang.System.setProperty("java.net.preferIPv4Stack", "true"); + java.lang.System.setProperty("java.net.preferIPv6Addresses", "false"); + } + + // + // The SSLEngine class only works properly in Froyo (or later). + // + _sslSupported = VERSION.SDK_INT >= 8; + } + + @Override + public void onTerminate() + { + } + + public List<String> getTestNames() + { + List<String> s = new ArrayList<String>(); + for(TestSuiteEntry t : _curtests) + { + s.add(t.getName()); + } + return s; + } + + synchronized public void setTestListener(TestListener listener) + { + _listener = listener; + if(_listener != null && _currentTest != -1) + { + _listener.onStartTest(_curtests[_currentTest].getName()); + for(String s : _strings) + { + _listener.onOutput(s); + } + if(_complete) + { + _listener.onComplete(_status); + } + } + } + + public void startNextTest() + { + assert _complete; + startTest((_currentTest + 1) % _curtests.length); + } + + synchronized public void startTest(int position) + { + assert !_ssl || (_ssl && _sslInitialized); + + PrintWriter pw = new PrintWriter(new MyWriter()); + + _currentTest = position; + _complete = false; + _strings.clear(); + + TestSuiteEntry entry = _curtests[position]; + test.Util.Application client; + test.Util.Application server; + test.Util.Application collocated; + + if(_listener != null) + { + _listener.onStartTest(entry.getName()); + } + + try + { + client = entry.getClient(); + server = entry.getServer(); + collocated = entry.getCollocated(); + } + catch(IllegalAccessException e) + { + e.printStackTrace(pw); + postOnComplete(-1); + return; + } + catch(InstantiationException e) + { + e.printStackTrace(pw); + postOnComplete(-1); + return; + } + + List<TestThread> l = new ArrayList<TestThread>(); + if(server != null) + { + server.setWriter(new MyWriter()); + // All servers must have a client. + assert client != null; + client.setWriter(new MyWriter()); + l.add(new ServerThread(client, server)); + if(collocated != null) + { + collocated.setWriter(new MyWriter()); + l.add(new CollocatedThread(collocated)); + } + } + else + { + client.setWriter(new MyWriter()); + l.add(new ClientThread(client, null)); + } + TestRunner r = new TestRunner(l); + r.setDaemon(true); + r.start(); + } + + public boolean isSSLSupported() + { + return _sslSupported; + } + + public void setSSL(boolean ssl) + { + assert(!ssl || (ssl && _sslSupported)); + _ssl = ssl; + if(_ssl) + { + _curtests = _ssltests; + } + else + { + _curtests = _tests; + } + if(_currentTest > _curtests.length-1) + { + _currentTest = _curtests.length-1; + } + + if(_ssl && !_sslInitialized) + { + if(_ssllistener != null) + { + _ssllistener.onWait(); + } + Runnable r = new Runnable() + { + private SSLContext initializeContext(java.io.InputStream cert) + throws NoSuchAlgorithmException, KeyStoreException, IOException, CertificateException, + FileNotFoundException, UnrecoverableKeyException, KeyManagementException + { + SSLContext context = SSLContext.getInstance("TLS"); + KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + + KeyStore ks = KeyStore.getInstance("BKS"); + char[] passphrase = "password".toCharArray(); + ks.load(cert, passphrase); + kmf.init(ks, passphrase); + + TrustManagerFactory tmf = + TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + tmf.init(ks); + + context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + return context; + } + + public void run() + { + SSLContext clientContext = null; + SSLContext serverContext = null; + try + { + clientContext = initializeContext(getResources().openRawResource(R.raw.client)); + serverContext = initializeContext(getResources().openRawResource(R.raw.server)); + } + catch(Exception ex) + { + ex.printStackTrace(); + } + sslContextInitialized(clientContext, serverContext); + } + }; + + Thread t = new Thread(r); + t.setName("Initialize SSL Thread"); + t.setDaemon(true); + t.start(); + } + } + + synchronized public void setSSLInitializationListener(SSLInitializationListener listener) + { + _ssllistener = listener; + if(_ssl) + { + if(!_sslInitialized) + { + listener.onWait(); + } + else if(_clientContext == null || _serverContext == null) + { + listener.onError(); + } + else + { + listener.onComplete(); + } + } + } +} diff --git a/java/test/android/src/com/zeroc/testsuite/TestContainer.java b/java/test/android/src/com/zeroc/testsuite/TestContainer.java new file mode 100644 index 00000000000..6344d20bc5c --- /dev/null +++ b/java/test/android/src/com/zeroc/testsuite/TestContainer.java @@ -0,0 +1,113 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.testsuite; + +import java.util.LinkedList; + +import android.app.ListActivity; +import android.os.Bundle; +import android.widget.ArrayAdapter; +import android.widget.Button; + +public class TestContainer extends ListActivity implements TestApp.TestListener +{ + private LinkedList<String> _strings = new LinkedList<String>(); + private ArrayAdapter<String> _adapter; + private boolean _partial = false; + private Button _next; + + /** Called when the activity is first created. */ + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.container); + _adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, _strings); + setListAdapter(_adapter); + + _next = (Button)findViewById(R.id.next); + _next.setOnClickListener(new android.view.View.OnClickListener() + { + public void onClick(android.view.View v) + { + TestApp app = (TestApp)getApplication(); + app.startNextTest(); + } + }); + _next.setEnabled(false); + } + + @Override + public void onResume() + { + super.onResume(); + TestApp app = (TestApp)getApplication(); + app.setTestListener(this); + } + + @Override + public void onStop() + { + super.onStop(); + TestApp app = (TestApp)getApplication(); + app.setTestListener(null); + } + + public void onStartTest(String test) + { + setTitle(test); + _partial = false; + _strings.clear(); + _adapter.notifyDataSetChanged(); + _next.setEnabled(false); + } + + public void onComplete(int status) + { + _next.setEnabled(true); + } + + public void onOutput(String s) + { + int start = 0; + int end = s.length(); + int pos; + do + { + pos = s.indexOf('\n', start); + if(pos != -1) + { + addData(s.substring(start, pos), false); + start = pos+1; + } + } + while(start < end && pos != -1); + if(start < end) + { + addData(s.substring(start, end), true); + } + } + + private void addData(String s, boolean partialLine) + { + if(_partial) + { + String last = _strings.removeLast(); + last = last + s; + _strings.add(last); + _adapter.notifyDataSetChanged(); + } + else + { + _adapter.add(s); + } + _partial = partialLine; + } +} diff --git a/java/test/android/src/com/zeroc/testsuite/TestSuite.java b/java/test/android/src/com/zeroc/testsuite/TestSuite.java new file mode 100644 index 00000000000..aa4b1b1c6f1 --- /dev/null +++ b/java/test/android/src/com/zeroc/testsuite/TestSuite.java @@ -0,0 +1,134 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package com.zeroc.testsuite; + +import java.util.ArrayList; +import java.util.List; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ListActivity; +import android.app.ProgressDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.ListView; +import android.widget.CompoundButton.OnCheckedChangeListener; + +public class TestSuite extends ListActivity +{ + private static final int DIALOG_INITIALIZING = 1; + private static final int DIALOG_SSL_FAILED = 2; + private List<String> _tests = new ArrayList<String>(); + + @Override + public void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + final TestApp app = (TestApp)getApplication(); + _tests.addAll(app.getTestNames()); + final ArrayAdapter<String> adapter = + new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, _tests); + setListAdapter(adapter); + app.setSSLInitializationListener(new TestApp.SSLInitializationListener() + { + private boolean dismiss = false; + + public void onComplete() + { + if(dismiss) + { + dismissDialog(DIALOG_INITIALIZING); + } + } + + public void onError() + { + if(dismiss) + { + dismissDialog(DIALOG_INITIALIZING); + } + showDialog(DIALOG_SSL_FAILED); + } + + public void onWait() + { + // Show the initializing dialog. + dismiss = true; + showDialog(DIALOG_INITIALIZING); + } + }); + CheckBox secure = (CheckBox)findViewById(R.id.secure); + if(app.isSSLSupported()) + { + secure.setOnCheckedChangeListener(new OnCheckedChangeListener() + { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) + { + app.setSSL(isChecked); + _tests.clear(); + _tests.addAll(app.getTestNames()); + adapter.notifyDataSetChanged(); + } + }); + } + else + { + secure.setEnabled(false); + } + } + + protected void onListItemClick(ListView l, View v, int position, long id) + { + TestApp app = (TestApp)getApplication(); + app.startTest(position); + startActivity(new Intent(this, TestContainer.class)); + } + + @Override + protected Dialog onCreateDialog(int id) + { + switch (id) + { + case DIALOG_INITIALIZING: + { + ProgressDialog dialog = new ProgressDialog(this); + dialog.setTitle("Initializing"); + dialog.setMessage("Please wait while initializing SSL..."); + dialog.setIndeterminate(true); + dialog.setCancelable(false); + return dialog; + } + + case DIALOG_SSL_FAILED: + { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Error"); + builder.setMessage("SSL Initialization failed"); + builder.setCancelable(false); + builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() + { + public void onClick(DialogInterface dialog, int whichButton) + { + finish(); + } + }); + return builder.create(); + } + } + return null; + } +} |